__module_name__ = "amarok_xchat"
__module_version__ = "0.2"
__module_description__ = "python module for xchat to display titles playing in amarok"
import xchat
import commands
def amarok_send(word, word_eol, userdata):
if commands.getoutput('dcop amarok player isPlaying') != 'true':
xchat.command('me is not listening at music right now')
else:
song = {
'artist': commands.getoutput('dcop amarok player artist'),
'song': commands.getoutput('dcop amarok player title'),
'ctime': commands.getoutput('dcop amarok player currentTime'),
'ttime': commands.getoutput('dcop amarok player totalTime'),
'brate': commands.getoutput('dcop amarok player bitrate')
}
xchat.command('me is listening to %(song)s by %(artist)s [ %(ctime)s of %(ttime)s ] @ %(brate)sKbps' % song)
return xchat.EAT_ALL
xchat.hook_command('amarok', amarok_send)
xchat.prnt('amarok_xchat v0.2 loaded..')