convert all midi files to mp3

Hi,

I would really appreciate it if someone can help me with this. i need to convert 60,000 midi files into mp3 so I can listen to them on my mp3 player. I tried to just drag and drop into iTunes, but it gives all files a generic name instead of it original filename. I want to do it with automator but it doesn’t allow me to rename the tracks.

So this is what I want to do:

…/Artist/Album/song.mid → …/Artist_Album_song.mp3

I found this from macosxhints.com. Can you modify this?


tell application "iTunes"
	set oldencoder to name of current encoder
	set allencoders to name of every encoder
	set targettype to (choose from list {"AIFF audio file", "WAV audio file", "Apple Lossless audio file", "MPEG audio file", "AAC audio file"} with prompt "Which kind of songs do you want to convert?" OK button name "Choose" without multiple selections allowed and empty selection allowed) as string
	
	set newencoder to (choose from list allencoders with prompt "Please Choose an encoder to convert your " & targettype & "s" OK button name "Choose" without multiple selections allowed and empty selection allowed) as string
	
	set current encoder to encoder newencoder
	set conitems to every track of playlist 1 of source 1 whose kind is targettype
	repeat with i from 1 to (number of items in conitems)
		set fileloc to location of (item i of conitems)
		tell application "Finder" to set fileloc2 to the POSIX path of file (fileloc as string)
		convert (item i of conitems)
		delete (item i of conitems)
		do shell script "rm " & quote & fileloc2 & quote
	end repeat
	set current encoder to encoder oldencoder
	display dialog (number of items in conitems as string) & " item(s) converted." buttons "Done" default button 1 with icon 1
end tell