alan little’s weblog

dealing with idiots

25th November 2005 permanent link

The continuing saga of trying to get iTunes to handle classical music in a half-sensible manner. Andy Baker convinced me that there is actually a case for putting the composer instead of the performer in the “Artist” field – at least for people who for whatever reason choose to use benighted software that doesn’t recognise the standard ID3 Composer tag. This one is quick and easy to fix in iTunes anyway. I really can’t begin to imagine what the people who came up with the other common anti-pattern were thinking. (Achtung! wide picture)

idiotic

Here we have “Song” used for the title of the work and “Artist” (!) holding the names of the movements. Composer might be embedded in the album title if you’re lucky, and you have to guess the performer. <unahimsic>The idiot(s) responsible for this should be shot</unahimsic>. This nonsense is so widespread that I suspect the idiot responsible is the author of some widely used piece of crap software – my naïve faith in the human race is such that I have difficulty bringing myself to believe in a large number of people all choosing to do the same utterly stupid thing in exactly the same way. This one is much more of a pain to fix – iTunes doesn’t let you bulk edit the movement names from “artist” across into “song name”, you have to cut and paste them one by one.

Which is of course a time-wasting pain in the arse, and after you’ve done it too many times (because it’s still marginally better than typing everything from scratch) you realise that it might be worth spending half an hour learning Applescript. A quick search for “itunes classical applescript” reveals nothing that directly does the job, but a huge library of other scripts for doing things with iTunes which we can easily borrow & adapt. Applescript turns out to be quite a cute little scripting language, and a few minutes’ work produces this:

(*
"Artist to Song Name" for iTunes
fixes one of the most common problems with CDDB classical data, 
where movement names are idiotically placed in the "Artist" field
written by Alan Little
contact@alanlittle.org

based on
"Track Number to Song Name Prefix" for iTunes
by Doug Adams
*)

tell application "iTunes"
	
	if selection is not {} or view of front window is not library playlist 1 then
		if selection is not {} then -- use selection
			set theseTracks to selection
		else -- use whole playlist (this doesn't work)
			set theseTracks to every file track of view of front window
		end if
	else
		display dialog "Select some tracks or a Playlist..." buttons {"Cancel"} default button 1 with icon 2
	end if
	
	display dialog "Overwrite Song Name with Artist, or append?" buttons {"Overwrite", "Append"} default button 2
	if the button returned of the result is "Append" then
		set myAppend to true
	else
		set myAppend to false
	end if
	
	display dialog "Artist" default answer "" buttons {"OK"} default button 1
	set newArtist to text returned of result
	
	set fixed indexing to true
	
	with timeout of 30000 seconds
		repeat with aTr in theseTracks
			set newName to artist of aTr
			if myAppend then
				set newName to name of aTr & " " & newName
			end if
			set name of aTr to newName
			set artist of aTr to newArtist
		end repeat
	end timeout
	
	set fixed indexing to false
	
end tell

… which works.

related entries: Music Mac

all text and images © 2003–2008