Marco Islas Blog

Christine: rola_christine.py


xchat command to get christine current track

Similar to what Gnuget do with rola-banshee.py I did the same but for christine:
#! /usr/bin/env python
# -*- coding: utf-8 -*-
 
#Author: Marco Islas
#Correo: markuz@islascruz.org
#Based on rola-banshee.py http://gnuget.org/blog/view/203/rola-banshee-py
 
version = "1.0"
 
__module_name__ = "rola_christine.py"
__module_version__ = version
__module_description = 'Shows the track in christine (requires christine from SVN)'
 
import dbus
import xchat
from dbus.mainloop.glib import DBusGMainLoop
 
class RolaChristine:
        def __init__(self):
                mainloop = DBusGMainLoop()
                self.dbus_session = dbus.SessionBus(mainloop = mainloop)
                self.christine = self.dbus_session.get_object('org.christine',
                                '/org/christine')
                xchat.prnt("rola-christine.py Version %s loaded!" %version)
                xchat.prnt("/rola-christine")
       
        def rola(self,word,word_eol,userdata):
                tags = self.christine.now_playing()
                title = '%s'%tags.get('title','')
                if not title:
                        xchat.command('Nada a mostrar..')
                        return xchat.EAT_XCHAT
                artist = "%s"%tags.get('artist','')
                if artist:
                        artist = "%s -"%artist
                xchat.command("me esta escuchando: %s %s" %(artist,title))
                return xchat.EAT_XCHAT
control = RolaChristine()
xchat.hook_command("rola-christine",control.rola)
 
This make me check my code, and the script above works only with christine on the svn. This code was done on the afternoon and may get broken at some place, but is nice if you want to play.

#1 Re: Christine: rola_christine.py

k001, <E-Mail> / Saturday 01 August 2009 11:45pm  
avatar

Oye mi buen markuz estoy tratando de usar tu pluing para xchat pero no jala, me marca el mismo error del que acabo de reportar https://sourceforge.net/apps/trac/christine/ticket/13

[ Reply (1) ]

#1.1 Re: Re: Christine: rola_christine.py

Marco Antonio Islas Cruz, <E-Mail> / Sunday 02 August 2009 12:34am  
avatar

Checando.

[ Reply (0) ]
blog comments powered by Disqus
Comment XML feeds: RSS | Atom
twitter logo