ITunes
DeComments need cleaning
iTunes has a very large AppleScript Dictionary. Just about every aspect of iTunes is scriptable and there have been some really interesting examples published on the web, of how to make use of iTunes scripting. For example you can have iTunes play music in the morning to wake you... and you can control iTunes with remote controllers and across a network connection.
Sometimes when you acquire .mp3 tracks there can be all manner of data embedded in the comments associated with the track. The following small script will clear out all comment fields from all tracks in iTunes. I continue to be amazed by the expressive power (ie readability) of AppleScript, despite its detractors and detractions (noun from verb!).
-- DeComment iTunes tracks -- Vers 0.1, Ian W. Parker first worked on 2009-05-24, last worked on 2009-05-24 -- clear comments from iTunes Music playlist (all) tell application "iTunes" set song_title_list to name of every track in playlist "Music" repeat with next_song in song_title_list try -- if some tracks don't have comments, back out set comment of track next_song to "" end try end repeat end tell
Clean Up Music Folder - 01
Sometimes you need to remove files from a folder that contain uninteresting information. For example you might download a music file that contains an advertisement tagged by " Ad " appearing in the filename. The following short AppleScript will allow you to periodically "clean" your music folder and tell you how many files it removed.
-- Clean up music folder - remove files with sub-string tags in file name
-- For example some downloaded music files may have particular embedded string tags
-- in their names, that you don't want to be retained
-- Vers 0.1, Ian W. Parker first worked on 2010-08-28, last worked on 2010-10-09
set {items_deleted, work_folder} to {"No", path to music folder}
-- get list of every file in the folder
repeat with next_item in list folder work_folder
-- reset the do_delete flag!
set {do_delete, a_file_name} to {false, ((work_folder & next_item) as string)}
if (a_file_name contains " Ad ") or (a_file_name contains " Advert ") then set do_delete to true
--if (a_file_name contains "<some>") then set do_delete to true
-- use pattern of last line to ad (pun intended!) more sub-string tags
if do_delete then
tell application "Finder" to delete (a_file_name as alias)
set items_deleted to items_deleted + 1
end if
end repeat
display dialog (items_deleted & " files deleted from music folder") as string with icon note giving up after 10
A really excellent site for more scripts to manage iTunes can be found at Doug's Scripts