Return vimeo.py to where it was before, but with better duration and comma-grouped likes and plays
This commit is contained in:
parent
86be633213
commit
b2b5270686
1 changed files with 12 additions and 13 deletions
|
@ -4,18 +4,17 @@ from util import hook, http, timeformat
|
||||||
@hook.regex(r'vimeo.com/([0-9]+)')
|
@hook.regex(r'vimeo.com/([0-9]+)')
|
||||||
def vimeo_url(match):
|
def vimeo_url(match):
|
||||||
"vimeo <url> -- returns information on the Vimeo video at <url>"
|
"vimeo <url> -- returns information on the Vimeo video at <url>"
|
||||||
info = http.get_json('http://vimeo.com/api/v2/video/%s.json' % match.group(1))
|
info = http.get_json('http://vimeo.com/api/v2/video/%s.json'
|
||||||
|
% match.group(1))
|
||||||
|
|
||||||
if info:
|
if info:
|
||||||
info = info[0]
|
info[0]["duration"] = timeformat.timeformat(info[0]["duration"])
|
||||||
return ("\x02{title}\x02 - length \x02{duration}\x02 - "
|
info[0]["stats_number_of_likes"] = format(
|
||||||
"\x02{likes}\x02 likes - "
|
info[0]["stats_number_of_likes"], ",d")
|
||||||
"\x02{plays}\x02 plays - "
|
info[0]["stats_number_of_plays"] = format(
|
||||||
"\x02{username}\x02 on \x02{uploaddate}\x02".format(
|
info[0]["stats_number_of_plays"], ",d")
|
||||||
title=info["title"],
|
return ("\x02%(title)s\x02 - length \x02%(duration)s\x02 - "
|
||||||
duration=timeformat.timeformat(info["duration"]),
|
"\x02%(stats_number_of_likes)s\x02 likes - "
|
||||||
likes=info["stats_number_of_likes"],
|
"\x02%(stats_number_of_plays)s\x02 plays - "
|
||||||
plays=info["stats_number_of_plays"],
|
"\x02%(user_name)s\x02 on \x02%(upload_date)s\x02"
|
||||||
username=info["user_name"],
|
% info[0])
|
||||||
uploaddate=info["upload_date"])
|
|
||||||
)
|
|
||||||
|
|
Reference in a new issue