iTunes:AppleScript -> Album Playlisten erstellen

7/02/2009

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 =)
Code zum markieren einmal anklicken

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

No Comments

iTunes Titelliste als Email veschicken

28/10/2008
Ein kleines Skript (quick&dirty) um die Ausgewählten iTunes Titel (Name, Interpret und Album) als Liste via Email zu verschicken:

set thelist to ""

tell application "iTunes"

set h to selection of browser window 1

set i to 1

repeat with s in h

set thelist to thelist & i & ". " & name of s & " -- " & artist of s & " -- " & album of s & return

set i to i + 1

end repeat

end tell


tell application "Mail"

--close every window

set newMessage to make new outgoing message with properties {content:thelist as text}

tell newMessage

set visible to true

end tell

end tell


No Comments

iPod Playlisten über den Finder kopieren

5/08/2008
Es kann einen schon zur Weißglut bringen, wenn man seine schöne OnTheGo-Playliste nicht mehr vom iPod sichern kann, für solche und andere Fälle gibt es natürlich einen Haufen Tools, mit denen man den iPod kopieren kann. Aber kaum eines ist so simple, klein und elegant wie iTunesFS. Der iPod mit allen Playlisten wird einfach als Volumen gemountet (MacFuse lässt grüßen) und man kann einfach die Playlisten kopieren. Genial, simpel und mit 140 kbyte angenehm klein.
No Comments

iTunes Wiedergabe nach einiger Zeit automatisch stoppen

8/02/2008
itunes stop iconIch schlafe gerne mit Musik ein und dafür habe ich mir mal diese Anwendung geschrieben. Ist ein simples Skript, das wahrscheinlich auch Einzug in die iTunes-Skript-Sammlung erhalten wird. Dies aber schon vorab.Alles was man machen muss, ist das Skript starten, angeben, wie lange die Musik noch laufen muss... Nun, es erklärt sich wirklich von alleine =)Ach so, und Leopard-kompatibel ist es sogar auch schon ;-)
2 Comments

FireFly Media Server

20/01/2008
ff_logo_lg.jpg Ist wirklich ein geniales Projekt. Anscheinend wurde die Projektseite seit einiger Zeit nicht mehr gepflegt, aber die Software scheint wirklich gut zu sein.Einfach Handhabung und vor allen Dingen scheint es merklich schneller als iTunes zu sein!Ich teste es noch, aber so wie das gerade hier auf meinem iBook700 abgeht, denke ich, es ist eine gelungene Alternative zu der bisherigen iTunes-Sever-Lösung.Zudem kann ich jetzt auf die iTunes-Scripte verzichten, die immer regelmäßig die Ordner auf neu Dateien durchsucht haben.****
No Comments