# usage: # type /np to spam the filename in the current channel # - uses /action (or /me) to spam with __module_name__ = "SteelGolem's VLC NP spammer" __module_version__ = "1.1.1" __module_description__ = "VLC Now Playing spammer" print "\0034" + __module_name__, __module_version__, "has been loaded\003" print "\0034Type \"/np\" to spam the filename of whatever's playing in VLC in chat." import xchat, commands def command_np(word, word_eol, userdata): pid = commands.getoutput("ps --no-headers -C vlc | awk '{print $1}'") procentry = commands.getoutput("ls -l /proc/" + pid + "/fd | egrep '.mkv|.avi|.mpg|.mp3|.wmv|.mp4|.flac'") splitparts = procentry.split('/') filename = splitparts[len(splitparts)-1] if filename == "": print "\0034SG VLC NP error: unknown file type, or nothing loaded\003" elif filename == "fd: not found": print "\0034SG VLC NP error: unknown error, document" elif filename == "fd: No such file or directory": print "\0034SG VLC NP error: VLC not running\003" else: xchat.command("action np: " + filename) return xchat.EAT_ALL xchat.hook_command("NP", command_np, help="Displays filename of whatever's playing in VLC.")