Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

A replacement script to greatly speed Clutter Apps
Unfortunately, Clutter development seems to be stopped. This little app is the greatest iTunes companion, but with a big library (mine contains 30,000 songs), selecting an album to play was very slow.

Clutter make extensive use of AppleScript to create the playlist that will contain the album you want to listen to. To find the tracks of the corresponding artist and album in your library, the AppleScript routine was scanning every song -- way too slow!

Read the rest of the hint for one solution to this problem...

Inside Clutter's package (Control-click Clutter, select Show Package Contents, then navigate to Contents -> Resources), there's a file called PlayArtistAlbum.scpt. I replaced its content with the following 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
Now double-clicking a cover plays the desire album in a second.

[robg adds: This made a notable improvement even with my smaller 3,000 song library. I also chose to make a backup of the existing script first, just in case...]
    •    
  • Currently 1.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (1 vote cast)
 
[6,139 views]  

A replacement script to greatly speed Clutter | 8 comments | Create New Account
Click here to return to the 'A replacement script to greatly speed Clutter' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
A replacement script to greatly speed Clutter
Authored by: hangon on May 04, '04 03:06:27PM

[code]set AlbP to (make new playlist with properties {name:("test")})
repeat with aTr in (search pl for theArtist only artists)
if the album of aTr is equal to theAlbum then
duplicate aTr to AlbP
end if
end repeat[/code]



it seems to be more efficient this way



[ Reply to This | # ]
A replacement script to greatly speed Clutter
Authored by: eno on May 04, '04 05:24:17PM
A replacement script to greatly speed Clutter
Authored by: hangon on May 04, '04 06:37:00PM

No cluttr is unique...it's a good way to drop on your desktop the albums you want to listen in a near futur....

i'm so sad clutter developper stopped its developpement



[ Reply to This | # ]
A replacement script to greatly speed Clutter
Authored by: Anonymous on May 04, '04 11:16:13PM

Is anyone else having problems getting this script to work with "compilations"???

Other thatn the compilations though, works great.... Nice to see that this backdoor development of Clutter is happening. Why don't we start an email campaign to ask if the Clutter developer wanted to Open Source it?

---
http://www.adamyap.com/



[ Reply to This | # ]
A replacement script to greatly speed Clutter
Authored by: hangon on May 05, '04 04:49:47AM

i agree with you but the developper doesn't seem to answer ....
developing a Clutter Clone is an other way...anyone?



[ Reply to This | # ]
A replacement script to greatly speed Clutter
Authored by: thomster on May 05, '04 08:38:01PM

yes, this doesn't work with compilations for me either. I have 10.3.? and iTunes 4.5 and it gives me an error when trying to open applications.



[ Reply to This | # ]
Clutter now open source
Authored by: freekdb on Jun 03, '04 06:19:29AM
Great news! The developer of Clutter released the sources... http://sourceforge.net/projects/clutter

[ Reply to This | # ]
A replacement script to greatly speed Clutter
Authored by: adamh on Jan 16, '05 12:52:15AM
Fix for compilations.

Change this:
     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
To this:
    set noArtist to (theArtist is equal to null)
    set search_trackz to (search pl for theAlbum only albums)
    repeat with aTr in search_trackz
        if noArtist then
	    duplicate aTr to AlbP
	else
	    if the artist of aTr is equal to theArtist then
		duplicate aTr to AlbP
	    end if
	end if
    end repeat


[ Reply to This | # ]