__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 = dict()
song['artist'] = commands.getoutput('dcop amarok player artist')
song['song'] = commands.getoutput('dcop amarok player title')
song['ctime'] = commands.getoutput('dcop amarok player currentTime')
song['ttime'] = commands.getoutput('dcop amarok player totalTime')
song['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..')