14

Displays info from iTunes

Posted in Music by auditor 782 days ago

A iTunes geeklet that will display information in the following way:

Song - Artist (Album) | rating | progress%

screenshot

Please note

The script will automatically open iTunes on boot up, but this means that whenever you close iTunes it will automatically re-open.

Geeklet files to download

Comments

User Avatar
Sinani201 631 days ago
It works well. Good replacement for those who don't like the mini player.
User Avatar
martizzle 507 days ago
It won't let geektool run without iTunes running as well. When I close iTunes it starts back up again.
User Avatar
The_RocketRat 352 days ago
I like the script, but I'd like to display the Trackname, Artist or Album only, and get rid of everything else (especially the track duration).  Everything I try just erases everything.  Any advice?

PS.  I can close Itunes (10) without the script reopening it again.
User Avatar
jcroucher56 161 days ago
If you just want Trackname - Artistname ( Albumname ), use this code:

#!/bin/sh

if ps x | grep iTunes | grep -q -v grep; then

osascript -e 'tell application "iTunes"

set trackname to name of current track

set artistname to artist of current track

set albumname to album of current track

if albumname is null then

set albumshow to " "

else if albumname is "" then

set albumshow to " "

else

set albumshow to " ( " & albumname & " ) "

end if

set trackduration to duration of current track

set trackposition to player position

set output to "" & trackname & " - " & artistname & albumshow

end tell' | iconv -f utf-8 -t ucs-2-internal

fi
User Avatar
ifuxusux 265 days ago
I think if you add "tell application "System Events" to set num to count (every process whose name is "iTunes")

if num > 0 then" before the AppleScript code and "end if" after it, it will solve the issue of it keeping iTunes open.
User Avatar
jcroucher56 161 days ago
Can you explain this a little differently? I don't quite understand. I made a few modifications to the original code. How and where would I put the script that you're talking about? Here's what I've got:

#!/bin/sh

if ps x | grep iTunes | grep -q -v grep; then

osascript -e 'tell application "iTunes"

set trackname to name of current track

set artistname to artist of current track

set albumname to album of current track

if albumname is null then

set albumshow to ""

else if albumname is "" then

set albumshow to "( Unknown )"

else

set albumshow to albumname

end if

set trackduration to duration of current track

set trackposition to player position

set elapsed to round (trackposition / trackduration * 100)

set myRating to round ((rating of current track) / 20)

if myRating is 1 then

set myRating to " | I Star"

else if myRating is 2 then

set myRating to " | II Stars"

else if myRating is 3 then

set myRating to " | III Stars"

else if myRating is 4 then

set myRating to " | IV Stars"

else if myRating is 5 then

set myRating to " | V Stars"

else

set myRating to ""

end if

set myRating to myRating

set output to "" & "Artist: " & artistname & "\n" & "Track: " & trackname & "\n" & "Album: " & albumshow & myRating

end tell' | iconv -f utf-8 -t ucs-2-internal

fi

Log in to comment or register here.