[Rhythmbox-devel] XChat announce script



I took the liberty of messing with Klaus' announce script a bit to try
my luck with Python

Anyways I think I stumbled on a bug, the GUI clearly shows that a song
the user has not manually rated is set at 3, but when I call the rating
it returns 2.

Anyways as requested this handles the state where rb isn't started, and
as it seem to be required these days it spits out more useless
information to annoy your fellow man.


__module_name__ = "rhythmbox announce"
__module_version__ = "1.1"
__module_description__ = "announces the current listening data"
                                                                               
import xchat
import bonobo
                                                                               
def rb_announce(word, word_eol, userdata):
    context = xchat.get_context()
    try:
        rb = bonobo.get_object("OAFIID:GNOME_Rhythmbox",
"GNOME/Rhythmbox")
    except Exception, e:
        context.command("me is listening to the sound of silence")
        return xchat.EAT_XCHAT
                                                                               
    rb_bag = rb.getPlayerProperties()
    song = rb_bag.getValue("song").value()
                                                                               
    context.command("me is listening to"
        + " [ " + song.artist + " - " + song.title + " ]"
        + " rated at "
        + "[" + song.rating * "*" + (5-song.rating) * " " + "]"
        )
                                                                               
    return xchat.EAT_XCHAT
                                                                               
-- 
David Nielsen <dnielsen breakmygentoo net>



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]