Added notify plugin

This plugin will display a notification when the song is changed.
This commit is contained in:
Bryan Schumaker 2010-12-12 16:47:42 -05:00
parent 5b555b841f
commit ed9d853065

34
plugins/notify.py Normal file
View File

@ -0,0 +1,34 @@
# Bryan Schumaker (12/12/2010)
import pynotify
import ocarina
libsaria = ocarina.libsaria
get_attrs = libsaria.sources.get_attrs
image = ocarina.components.image.Image()
def notify(*args):
title, artist, art = get_attrs("title", "artist", "art")
try:
image.set_from_file(art)
image.set_height(64)
n = pynotify.Notification(title, "by %s" % artist)
n.set_icon_from_pixbuf(image.get_pixbuf())
n.set_timeout(10)
n.show()
except Exception, e:
pass
def start():
if pynotify.init(ocarina.__vers__):
libsaria.event.invite("POSTLOAD", notify)
def stop():
pass
def check_version():
if ocarina.__major__ != 4:
return False
if ocarina.__minor__ == 3:
return True
return True