Advertisement
Guest User

Untitled

a guest
Jul 23rd, 2017
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. # usage:
  2. # type /npv to spam the filename in the current channel
  3. # - uses /action (or /me) to spam with
  4.  
  5. __module_name__ = "SteelGolem's VLC NP spammer"
  6. __module_version__ = "1.1.0"
  7. __module_description__ = "VLC Now Playing spammer"
  8.  
  9. print "\0034" + __module_name__, __module_version__, "has been loaded\003"
  10.  
  11. import xchat, commands
  12.  
  13. def command_npv(word, word_eol, userdata):
  14. pid = commands.getoutput("ps --no-headers -C vlc | awk '{print $1}'")
  15. procentry = commands.getoutput("ls -l /proc/" + pid + "/fd | egrep '.mkv|.avi|.mpg|.mp3|.wmv|.mp4|.flac|.flv|.webm|.VOB'")
  16. splitparts = procentry.split('/')
  17. filename = splitparts[len(splitparts)-1]
  18. if filename == "":
  19. print "\0034SG VLC NP error: unknown file type, or nothing loaded\003"
  20. elif filename == "fd: file not found":
  21. print "\0034SG VLC NP error: unknown error, document"
  22. elif filename == "fd: No such file or directory":
  23. print "\0034SG VLC NP error: VLC not running\003"
  24. else:
  25. xchat.command("say VLC NP: " + filename)
  26. return xchat.EAT_ALL
  27.  
  28. xchat.hook_command("NPV", command_npv, help="Displays filename of whatever's playing in VLC.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement