Created
March 23, 2011 20:42
-
-
Save sonicrules1234/883919 to your computer and use it in GitHub Desktop.
Revisions
-
sonicrules1234 created this gist
Mar 23, 2011 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,38 @@ import xchat, urllib, re __module_name__ = "vlcnowplaying" __module_version__ = "1.0" __module_description__ = "sonicrules1234's Now playing script for vlc" metare = re.compile("""<meta\-information\> \<title\>\<\!\[CDATA\[(.*)\]\]\>\<\/title\> \<artist\>\<\!\[CDATA\[(.*)\]\]\>\<\/artist\> \<genre\>\<\!\[CDATA\[(.*)\]\]\>\<\/genre\> \<copyright\>\<\!\[CDATA\[(.*)\]\]\>\<\/copyright\> \<album\>\<\!\[CDATA\[(.*)\]\]\>\<\/album\> \<track\>\<\!\[CDATA\[(\d*)\]\]\>\<\/track\> \<description\><\!\[CDATA\[(.*)\]\]\>\<\/description\> \<rating\>\<\!\[CDATA\[(.*)\]\]\>\<\/rating\> \<date\>\<\!\[CDATA\[(.*)\]\]\>\<\/date\> \<url\>\<\!\[CDATA\[(.*)\]\]\>\<\/url\> \<language\>\<\!\[CDATA\[(.*)\]\]\>\<\/language\> \<now\_playing\>\<\!\[CDATA\[(.*)\]\]\>\<\/now\_playing\> \<publisher\>\<\!\[CDATA\[(.*)\]\]\>\<\/publisher\> \<encoded\_by\>\<\!\[CDATA\[(.*)\]\]\>\<\/encoded\_by\> \<art\_url\>\<\!\[CDATA\[(.*)\]\]\>\<\/art\_url\> \<track\_id\>\<\!\[CDATA\[(.*)\]\]\>\<\/track\_id\> \<\/meta\-information\>""") def on_NowPlaying(word, word_eol, userdata) : x = urllib.urlopen("http://127.0.0.1:8080/requests/status.xml") xml = x.read() x.close() regex = userdata["regex"] groups = regex.search(xml).groups() data = dict(title=groups[0], artist=groups[1], genre=groups[2],\ cpyright=groups[3], album=groups[4], track=groups[5],\ description=groups[6], rating=groups[7], date=groups[8],\ url=groups[9], language=groups[10], now_playing=groups[11],\ publisher=groups[12], encoded_by=groups[13], art_url=groups[14],\ track_id=groups[15]) xchat.command("me is now playing \x02%(title)s from the album %(album)s by %(artist)s.\x02" % dict(channel=userdata["context"], title=data["title"], album=data["album"], artist=data["artist"])) return xchat.EAT_ALL xchat.hook_command("NP", on_NowPlaying, userdata={"regex":metare, "context":xchat.get_info("channel")})