growl4itunes

I found that GrowlTunes, the application that notifies Growl whenever iTunes changes status, outputed just too much information; so I did a little script just to output the ‘title’, ‘artist’ and ‘album’ of the current playing song.

growl4itunes
You can find this script under the homonimous folder in my Green Apples repository. Or you can read it here:

#!/usr/bin/env python
from popen2 import popen2
from time import sleep

PERIOD = 5
data = None

while True:
    o, i = popen2("osascript -e 'tell application \"iTunes\" to if player state is playing then name of current track & \"\n\" & artist of current track & \"\n\" & album of current track'")
    newdata = o.readlines()
    if data != newdata:
        data = newdata
        try:
            popen2("growlnotify -m \"" + data[1] + data[2] + "\" -t \"" + data[0] + "\"")
        except:
            pass

    sleep(PERIOD)

1 Comment

  1. Simao wrote:

    Eu adicionei “-a itunes” aos argumentos do growlnotify para mostrar o icon do itunes. Fica mais bonito :)

    obrigado!

    Posted 23 Jun 2009 at 3:08 pm permalink

Post a Comment

Your email is never published nor shared. Required fields are marked *