Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'It works, but...' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
It works, but...
Authored by: excarnate on Dec 04, '09 11:50:47AM
I think I found something (Track Parser) that will move things around for me.

I notice this line in the script:
delete every item of folder FixedFolder
That's not very good! I want to use ~/Library/Caches/TemporaryItems/ but it deletes everything there. I tried changing it to:
delete theseFiles
but that also deletes everything...I see why, now. Fixing this is beyond my time available + skill available.

Essentially the script assumes that it has a folder dedicated to its own use, when it should keep track of, well, tracks, or better yet, make and destroy its own temp folder within the temp folder. I think.
Edited on Dec 04, '09 11:54:49AM by excarnate


[ Reply to This | # ]
Important Fix!
Authored by: excarnate on Dec 07, '09 11:29:02PM

The script as originally written will delete everything in whatever folder is chosen. Which could be bad. Here is a briefly tested fix that uses a folder in the user's Temporary Items folder. I only added the if/else/end.


tell application "Finder"
	--This is where you put the path to the compiled fixid3tag
	set FixerLocation to "/usr/local/bin/fixid3tag"
	--This is the path to your temporary folder
	-- Quick hack to stop stepping on all items in whatever folder was chosen, sheesh, what if someone picked ~/Documents?
	if not (exists folder "podcast2music" of folder (path to temporary items from user domain)) then
		set FixedFolder to (make new folder at (path to temporary items from user domain) with properties {name:"podcast2music"}) as string
	else
		set FixedFolder to folder "podcast2music" of folder (path to temporary items from user domain) as string
	end if
end tell

tell application "iTunes"
	set trackList to the selection of window 1
	repeat with theTrack in trackList
		set theTrackName to ((the location of theTrack))
		do shell script FixerLocation & " " & quoted form of POSIX path of theTrackName
		do shell script "cp " & quoted form of POSIX path of theTrackName & " " & quoted form of POSIX path of FixedFolder
		delete theTrack
		do shell script "rm " & quoted form of POSIX path of theTrackName
	end repeat
end tell

--add fixed files to iTunes
tell application "Finder"
	set theseFiles to (files of folder FixedFolder as alias list)
end tell
try
	tell application "iTunes" to add theseFiles
on error err
end try

--delete converted temp files
tell application "Finder"
	delete every item of folder FixedFolder
end tell
Edited on Dec 07, '09 11:54:12PM by excarnate


[ Reply to This | # ]