diff --git a/plugins/bigassmessage.py b/plugins/bigassmessage.py index 9aae4d8..6d1d41d 100644 --- a/plugins/bigassmessage.py +++ b/plugins/bigassmessage.py @@ -4,20 +4,20 @@ from util import hook, http @hook.command def bam(inp): ".bam [basic|magic|heart|krugr] -- creates a big ass message" - + host = 'http://bigassmessage.com/' path = 'BAM.php?' params = {'action': 'SAVE', 'theStyle': 'basic', 'theMessage': inp} - + if ' ' in inp: style, message = inp.split(None, 1) if style in ['basic', 'magic', 'heart', 'krugr']: params['theStyle'] = style params['theMessage'] = message - + response = http.get_xml(host + path, params) status = response.xpath('//status/text()')[0] - + if status == 'ok': return host + response.xpath('//msgid/text()')[0] else: diff --git a/plugins/sieve.py b/plugins/sieve.py index b415d07..b087ced 100644 --- a/plugins/sieve.py +++ b/plugins/sieve.py @@ -12,11 +12,11 @@ def sieve_suite(bot, input, func, kind, args): if kind == "command": if input.trigger in bot.config.get('disabled_commands', []): return None - + ignored = bot.config.get('ignored', []); if input.host in ignored or input.nick in ignored: return None - + fn = re.match(r'^plugins.(.+).py$', func._filename) disabled = bot.config.get('disabled_plugins', []) @@ -39,5 +39,5 @@ def sieve_suite(bot, input, func, kind, args): if input.host not in admins and input.nick not in admins: return None - + return input diff --git a/plugins/tvdb.py b/plugins/tvdb.py index b006086..08edea6 100644 --- a/plugins/tvdb.py +++ b/plugins/tvdb.py @@ -138,7 +138,7 @@ def tv_last(inp): ended = episodes["ended"] episodes = episodes["episodes"] - prev_ep = None + prev_ep = None today = datetime.date.today() for episode in reversed(episodes): diff --git a/plugins/vimeo.py b/plugins/vimeo.py index 90370ce..3596382 100644 --- a/plugins/vimeo.py +++ b/plugins/vimeo.py @@ -1,27 +1,15 @@ - -from util import http,hook import re -video_regex = (r'(?i)http://(?:www\.)?vimeo.com/([A-Za-z0-9\-]+)') -r'([a-zA-Z]+://|www\.)[^ ]+' -video_request_base = "http://vimeo.com/api/v2/video/%s.json" +from util import http,hook -video_info = "\x02%(title)s\x02 - length \x02%(duration)ss\x02 - \x02%(stats_number_of_likes)s\x02 likes - \x02%(stats_number_of_plays)s\x02 plays - \x02%(user_name)s\x02 on \x02%(upload_date)s\x02" +@hook.regex(r'vimeo.com/([0-9]+)') +def vimeo_url(match): + info = http.get_json('http://vimeo.com/api/v2/video/%s.json' + % match.group(1)) - -def viemo_video_info(video_id): - - json_url = video_request_base % (video_id,) - - json_responses = http.get_json(json_url) - - if json_responses: - - video_details = json_responses[0] - - return video_info % video_details - - -@hook.regex(video_regex) -def viemo_url(url_match): - return viemo_video_info(url_match.group(1)) + if info: + return ("\x02%(title)s\x02 - length \x02%(duration)ss\x02 - " + "\x02%(stats_number_of_likes)s\x02 likes - " + "\x02%(stats_number_of_plays)s\x02 plays - " + "\x02%(user_name)s\x02 on \x02%(upload_date)s\x02" + % info[0])