Here are two AppleScripts that turn write-protection on and off for your music library. If you want to add or edit stuff, run the script ResetWriteProtectMusic. If you want to protect your music files from accidental alteration or deletion, run the script WriteProtectMusic. These can be placed in the user's ~/Library/iTunes/Scripts directory, and they appear in the iTunes script menu item (here as the bottom two entries):
<p><a href="https://audiophilestyle.com/uploads/monthly_2014_07/menu_iTunes_Scripts.png.2ca9ab456e125a704513078a620a72b7.png" class="ipsAttachLink ipsAttachLink_image"><img data-fileid="28275" src="https://audiophilestyle.com/uploads/monthly_2014_07/menu_iTunes_Scripts.png.2ca9ab456e125a704513078a620a72b7.png" class="ipsImage ipsImage_thumbnailed" alt=""></a></p>
The AppleScripts (Updated for 10.11 and iTunes 12.3, should be back-compatible):
[ATTACH]21546[/ATTACH]
The scripts assume a normal iTunes-organized music library, but you can alter them easily enough if your situation is non-standard.
It is designed to "just work" for a standard iTunes library, regardless of where you have it located.
Here is how this is discovered:
The first line contains a line of unix code (embedded as an Osascript) that looks like this:
defaults read ~/Library/Preferences/com.apple.iApps.plist iTunesRecentDatabases | grep file | perl -p -e 's|file://localhost||g' | perl -p -e 's|iTunes%20Music%20Library.xml||g' | perl -p -e 's|iTunes%20Library.xml||g' | perl -p -e 's| \"||g' | perl -p -e 's|\"||g'
It reads the iTunes library XML file to find where you keep your music. On my iMac, it returns this:
/Users/wgscott/Music/iTunes/
and on my mac mini, it returns this:
/Volumes/Media/iTunes/
<p><a href="https://audiophilestyle.com/uploads/monthly_2014_07/Scripts_7_21_2014_150_zip.7a47d2e5f4ffd7f5bc2819f5dbab584a" class="ipsAttachLink ipsAttachLink_image"><img data-fileid="28276" src="https://audiophilestyle.com/uploads/monthly_2014_07/Scripts_7_21_2014_150_zip.7a47d2e5f4ffd7f5bc2819f5dbab584a" class="ipsImage ipsImage_thumbnailed" alt=""></a></p><p><a href="https://audiophilestyle.com/uploads/monthly_2014_07/menu_iTunes_Scripts.png.dac64611e7d172b7c96964b624bbee92.png" class="ipsAttachLink ipsAttachLink_image"><img data-fileid="28525" src="https://audiophilestyle.com/uploads/monthly_2014_07/menu_iTunes_Scripts.png.dac64611e7d172b7c96964b624bbee92.png" class="ipsImage ipsImage_thumbnailed" alt=""></a></p><p><a href="https://audiophilestyle.com/uploads/monthly_2014_07/Scripts_7_21_2014_150_zip.391cdbd313844fce01a19a92c6fcb21e" class="ipsAttachLink ipsAttachLink_image"><img data-fileid="28526" src="https://audiophilestyle.com/uploads/monthly_2014_07/Scripts_7_21_2014_150_zip.391cdbd313844fce01a19a92c6fcb21e" class="ipsImage ipsImage_thumbnailed" alt=""></a></p>
8 Comments
Recommended Comments