Advertisement
lukibeni

XChat Banshee Script 0.3

Aug 20th, 2011
227
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.96 KB | None | 0 0
  1. #!/usr/bin/python
  2. # -*- coding: utf-8 -*-
  3.  
  4. __module_name__ = "Banshee Info"
  5. __module_version__  = "0.3"
  6. __module_description__  = "Banshee Info Script"
  7.  
  8. import xchat
  9. import commands
  10.  
  11. def banshee(word,word_eol,userdata):
  12.     artist = commands.getoutput("banshee --query-artist | cut -c 9-")
  13.     album = commands.getoutput("banshee --query-album | cut -c 8-")
  14.     title = commands.getoutput("banshee --query-title | cut -c 8-")
  15.     bit = commands.getoutput("banshee --query-bit-rate | cut -c 11-")
  16.     year = commands.getoutput("banshee --query-year | cut -c 7-")
  17.     version = commands.getoutput("banshee --version | grep banshee | cut -c 1-19")
  18.     position = commands.getoutput("banshee --query-position | cut -c 11-13 | tr -d [:punct:]")
  19.     duration = commands.getoutput("banshee --query-duration | cut -c 11-13")
  20.     operc = int(duration) /60
  21.     omp = int(duration) % 60
  22.     eperc = int(position) / 60
  23.     emp = int(position) % 60
  24.     if emp < 10: emp = "0" + str(emp)
  25.     else: emp = emp
  26.     if omp < 10: omp = "0" + str(omp)
  27.     else: omp = omp
  28.     if year == "": xchat.command("me éppen a(z) " + title + " című számot hallgatja " + artist + " előadó " + album + " című albumáról. [" + str(operc) + ":" + str(omp) + "/" + str(eperc) + ":" + str(emp) + "] (" + bit + " kbit/s) :: " + version)
  29.     else:
  30.         if album == "": xchat.command("me éppen a(z) " + title + " című számot hallgatja " + artist + " előadótól. [" + str(operc) + ":" + str(omp) + "/" + str(eperc) + ":" + str(emp) + "] (" + bit + " kbit/s) :: " + version)
  31.         else: xchat.command("me éppen a(z) " + title + " című számot hallgatja " + artist + " előadó " + album + " (" + year + ") című albumáról. [" + str(operc) + ":" + str(omp) + "/" + str(eperc) + ":" + str(emp) + "] (" + bit + " kbit/s) :: " + version)
  32.     return xchat.EAT_ALL
  33. xchat.hook_command("banshee", banshee, help="Kiírja a Banshee által lejátszott zeneszám adatait.")
  34.  
  35. print "XChat2 Banshee Info Script Betöltve"
  36. # Másold be a ./xchat2 mappába valami.py néven
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement