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


Click here to return to the 'GeekTool - Useful and fun info on the desktop' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
GeekTool - Useful and fun info on the desktop
Authored by: Frederico on Jul 11, '04 06:47:45AM

Hmmmm... never mind that I neglected to account for the Radio playlist being active... Good thing I rarely ever listen to it.... (;



[ Reply to This | # ]
GeekTool - Useful and fun info on the desktop
Authored by: Frederico on Jul 12, '04 08:45:00PM
This version accounts for both Radio and Music Store:

--iTunesTracker: Copyright 2000 - Jayson Cote -- modified by Frederico
tell application "System Events" to set the process_flag to (exists process "iTunes")
if the process_flag then
	tell application "iTunes"
		set ps to player state
		if ps contains playing or ps contains paused or ps ¬
			contains stopped or ps contains rewinding or ps contains fast forwarding ¬
			then
			set e to player position
			set rT to my doTime(e)
			try
				set {foo1, foo2, foo3} to {artist, name, time} of current track
				if foo3 is missing value then set {foo1, foo2, foo3} to {"Internet Radio: " & foo2, current stream title, "(stream)"}
			on error
				set {foo1, foo2, foo3} to {"iTunes Music Store", "(unknown sample track)", "0:30"}
			end try
			set foo4 to rT & " / " & foo3
			set foo5 to "[" & foo1 & "]" & "  :||:  " & foo2 & "  :||:  " & foo4
		else
			return "iTunes Player State unknown"
		end if
	end tell
	return foo5
end if
on doTime(x)
	set m to x div 60
	set s to (x - m * 60)
	if s < 10 then set s to "0" & s
	return m & ":" & s
end doTime


[ Reply to This | # ]