diff options
author | Sebastien Helleu <flashcode@flashtux.org> | 2007-01-22 10:44:46 +0000 |
---|---|---|
committer | Sebastien Helleu <flashcode@flashtux.org> | 2007-01-22 10:44:46 +0000 |
commit | cd75488d0d1549a2db108d24b2e522ae7fa591be (patch) | |
tree | 4ea1853cace908bddf4de3f97bbab7560d431ac3 /scripts/python/mp3blaster.py | |
parent | dc80d87b0ebab47ac37cc98f901e442a3e460006 (diff) | |
download | weechat-cd75488d0d1549a2db108d24b2e522ae7fa591be.zip |
Added mp3blaster.py script
Diffstat (limited to 'scripts/python/mp3blaster.py')
-rw-r--r-- | scripts/python/mp3blaster.py | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/scripts/python/mp3blaster.py b/scripts/python/mp3blaster.py new file mode 100644 index 000000000..d30c96133 --- /dev/null +++ b/scripts/python/mp3blaster.py @@ -0,0 +1,36 @@ +# mp3blaster nowplaying script by Stalwart <stlwrt@gmail.com> +# written for Caleb +# released under GNU GPL v2 or newer + +import weechat +from os.path import expandvars, expanduser + +def mp3blasternp(server, args): + try: + statusfile = open(expandvars(expanduser(weechat.get_plugin_config('statusfile'))), 'rU') + info = statusfile.readlines() + statusfile.close() + artist = title = path = '' + for line in info: + if (line.split()[0] == 'artist'): + artist = line.strip(' \n')[7:] + elif (line.split()[0] == 'title'): + title = line.strip(' \n')[6:] + elif (line.split()[0] == 'path'): + path = line.strip(' \n')[5:] + if (title): + if (artist): + weechat.command('/me np: '+artist+' - '+title) + else: + weechat.command('/me np: '+title) + else: + weechat.command('/me np: '+path) + except: + if (weechat.get_plugin_config('statusfile') == ''): + weechat.set_plugin_config('statusfile', '~/.mp3blasterstatus') + weechat.prnt('mp3blaster status file not found. Set proper using /setp python.mp3blaster.statusfile = /path/to/file') + + return 0 + +weechat.register ('mp3blaster', '1.0', '', 'Posts track now played by mp3blaster') +weechat.add_command_handler ('np', 'mp3blasternp') |