Ein Ersatz-Skript um Clutter zu beschleunigen

Dienstag, 04 Mai 2004
0.0/5 Bewertung (0 Stimmen)
Beschreibung

Leider scheint die Entwicklung von [URL=http://www.sprote.com/clutter/]Clutter[/URL] gestoppt worden zu sein. Dieses kleine Programm ist ein grossartiger iTunes-Zusatz, aber mit einer grossen Bibliothek (meine enthält 30.000 Songs), verhält es sich bei der Auswahl eines Albums zum Abspielen sehr langsam.
Clutter macht umfangreichen Gebrauch von AppleScript um die Wiedergabeliste für das Album zu erstellen, das Sie sich anhören möchten. Um die Musiktitel eines Interpreten in Ihrer Bibliothek zu finden, überprüft die entsprechende AppleScript-Routine jeden einzelnen Song - viel zu langsam! Lesen Sie den Rest dieses Tipps für eine Lösung dieses Problems...
Im Clutter-Paket ([Control]-Klick auf das Programmsymbol, ”Paketinhalt zeigen” aus dem Kontextmenü wählen und in den Ordner [I]Contents -> Resources[/I] navigieren) befindet sich eine Datei namens ”PlayArtistAlbum.scpt”. Dessen Inhalt ersetzte ich durch folgenden Code:

on clutterPlaylist(src)
tell application ”iTunes”
tell src
-- Find or create a playlist named ”(Clutter)”:
if (first user playlist of src whose name ¬
is ”(Clutter)”) exists then
set pl to first user playlist of src whose name is ”(Clutter)”
else
set pl to (make new user playlist in src)
set name of pl to ”(Clutter)”
end if
return pl
end tell
end tell
end clutterPlaylist
on open info
tell application ”iTunes”
with timeout of 30 seconds
set theArtist to item 1 of info
set theAlbum to item 2 of info
set theTrack to item 3 of info
if theArtist = ”” then set theArtist to null
--display dialog ”theArtist=” & theArtist & ”, theAlbum=” & theAlbum

repeat with src in every source
repeat with pl in every library playlist of src
set oldShuf to (shuffle of pl)
-- disable shuffle first
-- otherwise tracks are copied to dstPl in random order!
set shuffle of pl to false
set dstPl to my clutterPlaylist(src)
delete tracks of dstPl

set AlbP to (make new playlist with properties {name:(”test”)})
repeat with aTr in (search pl for theAlbum only albums)
if the artist of aTr is equal to theArtist then
duplicate aTr to AlbP
end if
end repeat

duplicate (every track of AlbP) to dstPl
set n to the number of items of the result
set shuffle of pl to oldShuf

try
delete AlbP
end try

if n > 0 then
-- Success!
set view of browser window 1 to dstPl

if theTrack = null or theTrack = ”” then
play dstPl
else
play track theTrack of dstPl
end if
return true
end if
end repeat
end repeat
return false
end timeout
end tell
end open
on run
-- for debugging, so it can be run in the Script Editor
open {”Chet Baker”, ”My Prince”, ””}
end run

Ein Doppelklick auf ein Cover spielt jetzt das gewünschte Album in Sekunden.
[Anmerkung von robg: Dies brachte sogar für meine kleine Bibliothek mit 3000 Songs eine bemerkenswerte Verbesserung. Ich entschied mich trotzdem vorher ein Backup des bestehenden Skripts zu erstellen, nur für den Fall...]

Spezifikationen

Hits

1403

© by macjaner.ch | Powered by GoeGG-ArT.ch