Es schnappt sich die Auswahl oder den Inhalt der Library und erstellt von allen betroffenen Alben Wiedergabelisten.... na ja, die Funktionalität ist sich sicherlich noch ausbaufähig.... hm?
Warum überhaupt so ein Skript?
Deshalb und weil... ich mal wieder schlafen kann =)
Code zum markieren einmal anklicken
propertyFolderPlaylistName:"Album Playlists"
globalmin_count_for_album_playlist
setmin_count_for_album_playlisttotext returnedof(display dialog"Only show Procces Albums with more than x Songs"default answer"5")asinteger
setalbumlisttoget_Album_list(button returnedof(display dialog"Process Library or Selection?"buttons{"Library","Selection"}default button{"Selection"}))
iTunes:AppleScript -> Album Playlisten erstellen
Was tut das Skript?:
Es schnappt sich die Auswahl oder den Inhalt der Library und erstellt von allen betroffenen Alben Wiedergabelisten.... na ja, die Funktionalität ist sich sicherlich noch ausbaufähig.... hm?Warum überhaupt so ein Skript?
Deshalb und weil... ich mal wieder schlafen kann =)property FolderPlaylistName : "Album Playlists"
global min_count_for_album_playlist
set min_count_for_album_playlist to text returned of (display dialog "Only show Procces Albums with more than x Songs" default answer "5") as integer
set albumlist to get_Album_list(button returned of (display dialog "Process Library or Selection?" buttons {"Library", "Selection"} default button {"Selection"}))
set FolderPlaylist to makeFolderPlaylist(FolderPlaylistName)
do_lists(albumlist, FolderPlaylist)
on do_lists(albumlist, FolderPlaylist)
tell application "iTunes"
repeat with myalbum in albumlist
set albumcount to (count of (every track whose album = (myalbum as text)))
if albumcount ≥ min_count_for_album_playlist then
set these_tracks_to_add to (every track whose album = myalbum)
set artist_list to {artist of (item 1 of these_tracks_to_add)}
repeat with this_track_to_add in these_tracks_to_add
if artist_list contains (artist of this_track_to_add) then
set is_various to false
else
set is_various to true
exit repeat
end if
end repeat
if is_various = true then
set playlist_name to "Various - " & myalbum
else
set playlist_name to artist_list & " - " & myalbum as text
end if
set new_playlist to ""
repeat with this_p in (every playlist of source 1)
if (exists parent of this_p) and (parent of this_p is FolderPlaylist) and (name of this_p = playlist_name) then
set new_playlist to this_p
exit repeat
end if
end repeat
if new_playlist ≠ "" then
delete every track of new_playlist
else
set new_playlist to make new playlist with properties {name:playlist_name} at FolderPlaylist
end if
repeat with this_track_to_add in these_tracks_to_add
try
set tmp to location of this_track_to_add
duplicate this_track_to_add to new_playlist
end try
end repeat
end if
end repeat
end tell
end do_lists
on makeFolderPlaylist(FolderPlaylistName)
tell application "iTunes"
tell source 1
if (count of every folder playlist) > 0 then
if (name of every folder playlist) does not contain FolderPlaylistName then
return make new folder playlist with properties {name:FolderPlaylistName}
else
return folder playlist FolderPlaylistName
end if
else
return make new folder playlist with properties {name:FolderPlaylistName}
end if
end tell
end tell
end makeFolderPlaylist
on get_Album_list(mycommand)
tell application "iTunes"
set albumlist to {}
if mycommand = "Library" then
repeat with i from 1 to (count of every track of library playlist 1 of source 1)
if albumlist does not contain (album of track i of library playlist 1 of source 1) then
set albumlist to albumlist & {album of track i of library playlist 1 of source 1}
end if
end repeat
else if mycommand = "selection" then
set these_tracks to selection of browser window 1
if these_tracks = {} then error "Hey, nothing selected!"
repeat with this_track in these_tracks
if albumlist does not contain (album of this_track) then
set albumlist to albumlist & {album of this_track}
end if
end repeat
end if
return albumlist
end tell
end get_Album_list