rendered paste body# Basado en: amarok_xchat by sven kissner (aka chimaera)
# simple script to display the song currently played in amarok
#
# Modificado por: Nacx
__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):
# Codigos de color: gris, marron y gris fuerte
g = '15'
m = '7'
n = '14'
# Comprobamos que este reproduciendo
reproduciendo = commands.getoutput('dcop amarok player isPlaying')
if reproduciendo != 'true':
xchat.prnt('AmaroK no esta reproduciendo.')
return xchat.EAT_ALL
# Informacion de la cancion
artista = commands.getoutput('dcop amarok player artist')
titulo = commands.getoutput('dcop amarok player title')
volumen = commands.getoutput('dcop amarok player getVolume')
lenTotal = commands.getoutput('dcop amarok player totalTime')
lenActual = commands.getoutput('dcop amarok player currentTime')
secTotal = commands.getoutput('dcop amarok player trackTotalTime')
secActual = commands.getoutput('dcop amarok player trackCurrentTime')
secPorcentaje = str( (int(secActual) * 100) / int(secTotal) )
bitrate = commands.getoutput('dcop amarok player bitrate')
calidad = commands.getoutput('dcop amarok player sampleRate')
# Cadena a enviar
cadena = g + 'Reproductor: ' + n + '(' + m + ' AmaroK ' + n + ') '
cadena += g + 'Titulo: ' + n + '(' + m + ' ' + artista + ' - ' + titulo + ' ' + n + ') '
cadena += g + 'Tiempo: ' + n + '(' + m + ' ' + lenActual + '/' + lenTotal + ' (' + secPorcentaje + '%) ' + n + ') '
cadena += g + 'Volumen: ' + n + '(' + m + ' ' + volumen + '% ' + n + ') '
cadena += g + 'Calidad: ' + n + '(' + m + ' ' + bitrate + ' - ' + calidad + ' Hz ' + n + ')'
# Enviamos la cadena
xchat.command('say ' + cadena)
return xchat.EAT_ALL
xchat.hook_command('amarok', amarok_send)
xchat.prnt('AmaroK plugin cargado.')