2011-01-12 02:16:17 +00:00
|
|
|
# IMDb lookup plugin by Ghetto Wizard (2011).
|
|
|
|
|
|
|
|
from util import hook, http
|
|
|
|
|
|
|
|
|
|
|
|
@hook.command
|
|
|
|
def imdb(inp):
|
|
|
|
'''.imdb <movie> -- gets information about <movie> from IMDb'''
|
|
|
|
|
2012-09-19 16:22:48 +00:00
|
|
|
content = http.get_json("http://www.omdbapi.com/", t=inp)
|
2011-01-12 02:16:17 +00:00
|
|
|
|
|
|
|
if content['Response'] == 'Movie Not Found':
|
|
|
|
return 'movie not found'
|
|
|
|
elif content['Response'] == 'True':
|
2013-01-27 22:04:19 +00:00
|
|
|
content['URL'] = 'http://www.imdb.com/title/%(imdbID)s' % content
|
2011-01-12 02:16:17 +00:00
|
|
|
|
2011-05-11 21:40:53 +00:00
|
|
|
out = '\x02%(Title)s\x02 (%(Year)s) (%(Genre)s): %(Plot)s'
|
|
|
|
if content['Runtime'] != 'N/A':
|
|
|
|
out += ' \x02%(Runtime)s\x02.'
|
2013-01-27 22:04:19 +00:00
|
|
|
if content['imdbRating'] != 'N/A' and content['imdbVotes'] != 'N/A':
|
|
|
|
out += ' \x02%(imdbRating)s/10\x02 with \x02%(imdbVotes)s\x02 votes.'
|
2011-05-11 21:40:53 +00:00
|
|
|
out += ' %(URL)s'
|
|
|
|
return out % content
|
2011-01-12 02:16:17 +00:00
|
|
|
else:
|
|
|
|
return 'unknown error'
|