/usr/share/pyshared/flashbake/plugins/current_track.scpt is in flashbake 0.26.2-4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | if checkProcess("iTunes") then
tell application "iTunes"
if player state is playing then
set trck to current track
set title_text to (get name of trck)
set artist_text to (get artist of trck)
set album_text to (get album of trck)
set playpos to (get player position)
set displayTime to (my calc_total_time(playpos))
set title_time to (get time of trck)
set rate to (get rating of trck) / 20
set rate_text to ""
repeat rate times
set rate_text to rate_text & " * "
end repeat
set body_text to title_text & "
" & artist_text & " - " & album_text & "
" & displayTime & "/" & title_time & " - " & rate_text
else
set body_text to "Nothing playing in iTunes"
end if
end tell
else
set body_text to "iTunes is not open"
end if
----------------------------------------------------------------
to calc_total_time(totalSeconds)
set theHour to totalSeconds div 3600
if theHour is not 0 then
copy (theHour as string) & ":" to theHour
else
set theHour to ""
end if
set theMinutes to (totalSeconds mod 3600) div 60
if theMinutes is not 0 then
--if theMinutes is less than 10 then set theMinutes to "0" & (theMinutes as string)
copy (theMinutes as string) & ":" to theMinutes
else
set theMinutes to "0:"
end if
set theSeconds to totalSeconds mod 60
if theSeconds is less than 10 then set theSeconds to "0" & (theSeconds as string)
return theHour & theMinutes & theSeconds as string
end calc_total_time
----------------------------------------------------------------
on checkProcess(processName)
tell application "System Events"
set isRunning to ((application processes whose (name is equal to processName)) count)
end tell
if isRunning is greater than 0 then
return true
else
return false
end if
end checkProcess
|