Yukiteru

Audacious Script XChat

Mar 21st, 2012
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.46 KB | None | 0 0
  1. __module_name__ = "Audacious2 MP3"
  2. __module_version__ = "1.0"
  3. __module_description__ = "Otorga informacion sobre la reproduccion de musica en Audacious"
  4.  
  5. from dbus import Bus, DBusException
  6. import xchat
  7. import commands
  8. bus = Bus(Bus.TYPE_SESSION)
  9.  
  10. def check_audacious():
  11.     try:
  12.         return bus.get_object('org.mpris.audacious', '/Player')
  13.     except DBusException:
  14.         print "\x02Audacious no esta ejecutandose, o ha ocurrido un error en el subsistema DBUS"
  15.         return None
  16.  
  17.  
  18. def mp3_info(word, word_eol, userdata):
  19.  
  20.     mp3 = check_audacious()
  21.     mp3data = mp3.GetMetadata()
  22.     artist = commands.getoutput("audtool --current-song-tuple-data artist")
  23.     titulo = commands.getoutput("audtool --current-song-tuple-data title")
  24.     album = commands.getoutput("audtool --current-song-tuple-data album")
  25.     bitrate = commands.getoutput("audtool --current-song-tuple-data bitrate")
  26.     genero = commands.getoutput("audtool --current-song-tuple-data genre")
  27.     calidad = commands.getoutput("audtool --current-song-tuple-data quality")
  28.     duracion = commands.getoutput("audtool --current-song-length")
  29.  
  30.     xchat.command("me || Audacious: (" + artist + " - " +  titulo + " - " + album + " - " + duracion +") - ("  + bitrate + " kbps - " + genero + " - " + calidad + ") ||"  )
  31.    
  32.     return xchat.EAT_ALL
  33.    
  34.  
  35. xchat.hook_command("aump3", mp3_info, help="Despliega la informacion de la reproduccion en Audacious")
  36.  
  37. print "Audacious MP3 loaded"
Advertisement
Add Comment
Please, Sign In to add comment