custom clutter modification to speed it up...

GO TO ADMIN PANEL > ADD-ONS AND INSTALL VERTIFORO SIDEBAR TO SEE FORUMS AND SIDEBAR

hangon

New member
Joined
Aug 22, 2003
Messages
8
Points
0
hi, itunes brings a new feature....search ... accessible by applescript


i edited the clutter file named PlayArtistAlbum.scpt
(inside the application packege)


HERE IS THE CODE...


MUCH MUCH FASTER CLUTTER NOW
(if you have a huge amount of files managed by itunes)


Code:
[SIZE=1]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)
					set shuffle of pl to false -- otherwise tracks are copied to dstPl in random order!
					set dstPl to my clutterPlaylist(src)
					delete tracks of dstPl
					
					set searchpattern to theArtist & " " & theAlbum
					set newP to (make new playlist with properties {name:("test")})
					repeat with aTr in (search pl for searchpattern)
						duplicate aTr to newP
					end repeat
					
					duplicate (every track of newP) to dstPl
					set n to the number of items of the result
					set shuffle of pl to oldShuf
					try
						delete newP
					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 {"de la soul", "dead", ""}
end run[/SIZE]
 
Last edited by a moderator:

hangon

New member
Joined
Aug 22, 2003
Messages
8
Points
0
hmmm...some improvement on this little hack for clutter:

here is the code...
(i decided to use the new search function in place of 'select track from that playlist with this artist name'...which was very slow with a big playlist)

so...the code:

Code:
[SIZE=1]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)
					set shuffle of pl to false -- otherwise tracks are copied to dstPl in random order!
					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", "Someday My Prince Will Come", ""}
end run[/SIZE]
 
Last edited by a moderator:

hangon

New member
Joined
Aug 22, 2003
Messages
8
Points
0
i doubt about this ... isend a few email to clutter developer...no answer....
it's been a year the app was not updated...
 
Joined
Jul 1, 2003
Messages
705
Points
0
Location
Providence, RI, USA
Website
dougscripts.com
(I edited your code for display purposes only.)
it's been a year
Really. I didn't know that.

I actually might still be using Clutter. But I can't be certain because I haven't seen my desktop in months. Not even sure of the desktop picture. It may be bluish. Or black. Can't tell from here.

:D
 
Last edited:
Top