Resolution to iTunes List to Toast List Problem
Resolution to iTunes List to Toast List Problem
- Subject: Resolution to iTunes List to Toast List Problem
- From: Eric Mittler <email@hidden>
- Date: Fri, 27 Dec 2002 11:59:08 -0800
AppleScripters,
Here is a solution to a problem I posted to this group a few months back.
Thanks to Rachel and Duncan (of this group) for help and inspiration.
This works. It's ugly code (I should post cleaner code :) but it's just a
hack to get my problem solve not to sell etc. And heck it's cleaner than
most code from Microsoft :). I'm sure there is more efficient way of doing
this. I welcome your feedback and I share in hopes to help the community.
Cheers,
Eric
email@hidden
BACKGROUND:
There are MP3 CD players that will not play MP3 CDs made from iTunes!
Beware! But, there is a way! You can burn the CD via Toast. But Toast is
not as fun as iTunes to use. So wouldn't it be nice to work with iTunes to
make song list and then burn it with Toast. The drag and drop does not work
well because some of the songs will not copy (if they have the same file
name for instance) and the order of songs will scramble.
PROBLEM:
Write an AppleScript to move a song list from iTunes to a Roxio Toast
Titanium MP3 list - all in Mac OS X. The order of the songs in iTunes must
be maintained. Songs with the same name should not be ignored.
SOLUTION:
1. Copy the iTunes files to a special directory in the User home directory
with the same name as the song list.
2. Re-name the files in this new (temp) directory with a 3 digit number at
the beginning ensuring unique file names and correct order.
3. Import the files into Toast.
(burning is done manually via Toast)
THE SCRIPT:
property tempFolderName : "iTunes to Toast Copy Temp"
property pickedPlayListName : ""
set pickedPlayListName to getPickedPlayListName()
if pickedPlayListName is not "false" then
set tempFolder to makeTempFolder()
copyiTunesMP3FilesToTempFolder(tempFolder)
makeMP3CD(tempFolder)
end if
activate
display dialog "Complete" giving up after 10
(* Pick the iTunes play list to export *)
on getPickedPlayListName()
tell application "iTunes"
set playListNames to name of playlists
set pickedPlayListName to (choose from list playListNames) as text
end tell
return pickedPlayListName
end getPickedPlayListName
(* Create a temp folder for the files *)
on makeTempFolder()
tell application "Finder"
if not (exists folder tempFolderName of folder "Music" of home) then
make new folder at folder "Music" of home with properties
{name:tempFolderName}
end if
if (exists folder pickedPlayListName of folder tempFolderName of
folder "Music" of home) then
delete folder pickedPlayListName of folder tempFolderName of
folder "Music" of home
end if
make new folder at folder tempFolderName of folder "Music" of home
with properties {name:pickedPlayListName}
set tempFolder to folder pickedPlayListName of folder tempFolderName
of folder "Music" of home
return tempFolder
end tell
end makeTempFolder
(* Loop thru MP3 of pickedPlayListName and copy them to the temp folder *)
on copyiTunesMP3FilesToTempFolder(tempFolder)
tell application "iTunes"
tell playlist pickedPlayListName
repeat with trackNum from 1 to count of tracks
set filePrefix to (trackNum as number) as text
if trackNum < 10 then set filePrefix to ("0" & filePrefix)
as text
if trackNum < 100 then set filePrefix to "0" & filePrefix
set trackID to file track trackNum
set trackName to name of file track trackNum
set trackLocation to location of file track trackNum
tell application "Finder"
set newFileRef to duplicate trackLocation to tempFolder
set name of newFileRef to filePrefix & " " & trackName &
".mp3"
end tell
end repeat
end tell
end tell
end copyiTunesMP3FilesToTempFolder
(* Copy files to Toast *)
on makeMP3CD(tempFolder)
tell application "Finder"
set fileList to items of tempFolder
end tell
tell application "Toast Titanium 5.1.4"
make new MP3 disc
add to current disc items (tempFolder as alias)
activate
set the title of the current disc to pickedPlayListName
activate
end tell
end makeMP3CD
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.