3

I'd like a hot-key to tell (ask politely) Growl to throw up a notification of what's currently playing in iTunes.

I've poked around a bit but couldn't find an answer "out there."

Any thoughts?

4 Answers 4

2

If you prefer the format that GrowlTunes supplies, you can also create a script that uses it:

tell application "GrowlTunes" to show current track
3

My hacked Applescript posted below. This matches the Growl output of iScrobbler. Thanks to The Tentacle for the work! There's information on how to set Quicksilver to launch the script here.

tell application "GrowlHelperApp"
-- Make a list of all the notification types
-- that this script will ever send:
set the allNotificationsList to {"iTunes Playing Track"}
-- Make a list of the notifications
-- that will be enabled by default.
-- Those not enabled by default can be enabled later
-- in the 'Applications' tab of the growl prefpane.
set the enabledNotificationsList to {"iTunes Playing Track"}
-- Register our script with growl.
-- You can optionally (as here) set a default icon
-- for this scripts notifications.
register as application "Growl iTunes Notification" all notifications allNotificationsList default notifications enabledNotificationsList icon of application "iTunes"

set title_text to "Null"
set body_text to ""
set body_temp to ""
set has_artwork to false

tell application "iTunes"
    if player state is playing then
        set trck to current track

        if artworks of trck is not {} then
            get artwork 1 of trck
            set pic to data of result
            set has_artwork to true
        end if

        set title_text to "Now Playing"

        get name of trck
        set body_text to "Track: " & result

        get rating of trck
        set rate to result / 20

        repeat rate times
            set body_temp to body_temp & "★"
        end repeat

        if rate is less than 5 then
            repeat (5 - rate) times
                set body_temp to body_temp & "☆"
            end repeat
        end if

        set body_text to body_text & " (" & body_temp & ")" & return

        get album of trck
        set body_text to body_text & "Album: " & result & return

        get artist of trck
        set body_text to body_text & "Artist: " & result

    end if
end tell

if has_artwork then
    notify with name "iTunes Playing Track" title title_text description body_text application name "Growl iTunes Notification" pictImage the pic
else
    notify with name "iTunes Playing Track" title title_text description body_text application name "Growl iTunes Notification" image from location "file:///Users/drewbeck/Library/Scripts/Custom/no_album.tiff"
end if 

end tell

2
  • Don't forget that last "end tell." It ended up outside the code box for some reason?! Aug 23, 2009 at 7:38
  • You should be able to edit your post to get that last staement in the code block? Anyway, glad it helped... Aug 23, 2009 at 14:08
2

You need a plugin for iTunes. Here it is.

1
  • GrowlTunes works for getting notifications (as does iScrobbler, which I use), but I it doesn't seem to be able to let me tell it explicitly to show a notification when I want, only on "Changed Tracks" or "Started Playing." So how can I explicitly poll iTunes (with GrowlTunes, iScrobbler, or another application) for What's Playing? Aug 23, 2009 at 1:22
1

You can use an applescript for this (don't remember where I got this) -- I compile this to an application triggered by Quicksilver, to get immediate notification of what is playing when I want, keeping iTunes minimised at all times:

growl

 tell application "GrowlHelperApp"
    -- Make a list of all the notification types
    -- that this script will ever send:
    set the allNotificationsList to {"iTunes Playing Track"}
    -- Make a list of the notifications
    -- that will be enabled by default.
    -- Those not enabled by default can be enabled later
    -- in the 'Applications' tab of the growl prefpane.
    set the enabledNotificationsList to {"iTunes Playing Track"}
    -- Register our script with growl.
    -- You can optionally (as here) set a default icon
    -- for this scripts notifications.
    register as application "Growl iTunes Notification" all notifications allNotificationsList default notifications enabledNotificationsList icon of application "iTunes"

    set title_text to "Nothing playing"
    set body_text to ""
    set has_artwork to false

    tell application "iTunes"
        if player state is playing then
            set trck to current track

            if artworks of trck is not {} then
                get artwork 1 of trck
                set pic to data of result
                set has_artwork to true
            end if

            get name of trck
            set title_text to result

            get time of trck
            set title_time to result
            set body_text to title_time & " =["

            get rating of trck
            set rate to result / 20

            repeat rate times
                set body_text to body_text & " ❤ "

            end repeat

            get artist of trck
            set body_text to body_text & "]   ❧ " & result

            get album of trck
            set body_text to body_text & " ⇒ " & result

        end if
    end tell

    if has_artwork then
        notify with name "iTunes Playing Track" title title_text description body_text application name "Growl iTunes Notification" pictImage the pic
    else
        notify with name "iTunes Playing Track" title title_text description body_text application name "Growl iTunes Notification"
        "iTunesLibraryPlaylistIcon.icns"
    end if

end tell
1
  • Beautiful. I hacked it a bit to make the output look like the iScrobbler output. Code posted below. Much <3! Aug 23, 2009 at 7:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .