Yukiteru

Script para Clementine (Funcional)

Apr 10th, 2011
178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.51 KB | None | 0 0
  1. __module_name__ = "Clementine MP3"
  2. __module_version__ = "1.1"
  3. __module_description__ = "Otorga informacion sobre la reproduccion de musica en Clementine"
  4.  
  5. from dbus import Bus, DBusException
  6. import xchat
  7. import commands
  8. bus = Bus(Bus.TYPE_SESSION)
  9.  
  10. def check_clementine():
  11.     try:
  12.         return bus.get_object('org.mpris.clementine', '/Player')
  13.     except DBusException:
  14.         print "\x02Clementine 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_clementine()
  21.     mp3data = mp3.GetMetadata()
  22.     artist = commands.getoutput("qdbus org.mpris.clementine /Player GetMetadata | grep artist: | sed 's/artist://'")
  23.     titulo = commands.getoutput("qdbus org.mpris.clementine /Player GetMetadata | grep title: | sed 's/title://'")
  24.     album = commands.getoutput("qdbus org.mpris.clementine /Player GetMetadata | grep album: | sed 's/album://'")
  25.     bitrate = commands.getoutput("qdbus org.mpris.clementine /Player GetMetadata | grep audio-bitrate: | sed 's/audio-bitrate://'")
  26.     genero = commands.getoutput("qdbus org.mpris.clementine /Player GetMetadata | grep genre: | sed 's/genre://'")
  27.        
  28.     xchat.command("me || Clementine: " + artist + " - " +  titulo + " - " + album + " - " + bitrate + " kbps - " + genero + " ||" )
  29.    
  30.     return xchat.EAT_ALL
  31.    
  32.  
  33.   xchat.hook_command("mp3", mp3_info, help="Despliega la informacion de la reproduccion en Clementine")
  34.  
  35. print "Clementine MP3 loaded"
Advertisement
Add Comment
Please, Sign In to add comment