iTunes Playlist-Copy-Script

Cye

Mitglied
Thread Starter
Dabei seit
01.12.2003
Beiträge
93
Reaktionspunkte
1
Hi,

ich würde gerne alle Tracks meiner iTunes Playlists
in einen Ordner kopieren lassen (mit dem Namen der
Playlist).

Damit könnt ich nämlich mal meine iTunes Bibliothek
ausräumen und die ganzen Tracks die eh nicht in ner
Playlist sind löschen ..
 
Äh, ganz einfach ohne Script:
[Apfel] + [N] auf dem Desktop
[Apfel] + [A] in der Playlist von iTunes
und dann einfach mit der Mouse verschieben, schon hast die Titel im Ordner, nur benennen musst die selber.

Ist natürlich aufwendiger mit mehreren Playlists, alternativ einfach die Sterne in den Playlists vergeben [Apfel] + und dann die Files ohne Sterne einfach löschen?
 
Zuletzt bearbeitet:
Ich suche auch so ein Script.
Der Nachteil von "Alles markieren" in iTunes ist, das es unheimlich lange dauert bis die Titel markiert sind. Außerdem sind dann die so exportierten Lieder nicht in Ordnern sortiert.

Am besten wäre ein Script, was die Lieder einer Playlist so wegkopiert, wie die Ordner in iTunes angelegt sind und am besten mit den beigefügten Grafiken.
 
Ich habe mir jetzt mal ein Script zusammen geschrieben. Es kopiert selektierte Titel, bzw. Titel eines selektierten Playlist, in einen Ordner und benennt die Dateien entsprechend. Ich werde das irgendwann noch weiter ausbauen um Ordner für die Interpreten und Alben zu erstellen. Vielleicht hat jemand anders Lust das zu tun und hier kund zu tun?

Hier das Script "Selektion to Folder" von mir:

property spacertrackArtist : " | "
property spacertrackAlbum : ""
property spacerTrackNo1 : " #"
property spacerTrackNo2 : "# "

property logFile_Name : "# Error Log"
property logFile_UsedFlag : false
property logFile_NewExport : "--------------- iTunes Export to folder --------------- " & return

property text_exportFinished : "Export from iTunes to folder done successfuly"
property text_exportFinishedWithError : "Export from iTunes to folder done with errors. See file " & "'" & logFile_Name & "'"


tell application "iTunes"

set logFile_UsedFlag to false

set trackList to the selection of window 1 -- any window with a selection
if ((count trackList) is 0) then
display dialog "No Selection made in iTunes!" with icon caution buttons {"OK"} default button 1
return
end if

set theFolder to choose folder with prompt "Select Folder as destination."
if theFolder is not "" then

set the log_file to ((theFolder) as text) & logFile_Name

repeat with theTrack in trackList

set trackName to ((the location of theTrack)) -- may need to coerce to alias for OS 9

set trackArtist to ((the artist of theTrack))
if trackArtist is "" then set trackArtist to "Unknown Artist"

set trackAlbum to ((the album of theTrack))
if trackAlbum is "" then set trackAlbum to "Unknown Album"

set trackNo to ((the track number of theTrack))
if trackNo is 0 then set trackNo to ""

set trackYear to ((the year of theTrack))


set theFolder2 to (theFolder)


-- set theFolder2 to theFolder & trackArtist & (trackYear as string)& trackAlbum


set filename to last item of my text_to_list(trackName as string, ":")


tell application "Finder"
try

duplicate file trackName to theFolder2

set filename2 to (trackArtist & spacertrackArtist & trackAlbum & spacertrackAlbum & ¬
spacerTrackNo1 & trackNo & spacerTrackNo2 & filename)
set newLocation to ((theFolder2 as string) & filename)
set newLocation2 to ((theFolder2 as string) & filename2)

set the name of file newLocation to filename2

on error
tell application "iTunes"
if logFile_UsedFlag is false then
my write_to_file(logFile_NewExport, log_file, false)
end if
set logFile_UsedFlag to true
set errorLocation to the database ID of theTrack
my write_to_file("Error at database id: " & errorLocation & return, log_file, true)
end tell
end try
end tell

end repeat
if logFile_UsedFlag is false then
display dialog text_exportFinished buttons {"OK"} default button 1 with icon 3
else
display dialog text_exportFinishedWithError buttons {"OK"} default button 1 with icon 3
end if
end if
end tell







on text_to_list(txt, delim)
set saveD to AppleScript's text item delimiters
try
set AppleScript's text item delimiters to {delim}
set theList to every text item of txt
on error errStr number errNum
set AppleScript's text item delimiters to saveD
error errStr number errNum
end try
set AppleScript's text item delimiters to saveD
return (theList)
end text_to_list

on write_to_file(this_data, target_file, append_data)
try
set the target_file to the target_file as text
set the open_target_file to ¬
open for access file target_file with write permission
if append_data is false then ¬
set eof of the open_target_file to 0
write this_data to the open_target_file starting at eof
close access the open_target_file
return true
on error
try
close access file target_file
end try
return false
end try
end write_to_file
 
Zurück
Oben Unten