This repository has been archived on 2023-04-13. You can view files and clone it, but cannot push or open issues or pull requests.
CloudBot/plugins/imdb.py
2012-05-15 20:07:27 -07:00

27 lines
860 B
Python
Executable file

# 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."
content = http.get_json("http://www.imdbapi.com/", t=inp)
if content['Response'] == 'Movie Not Found':
return 'movie not found'
elif content['Response'] == 'True':
content['URL'] = 'http://www.imdb.com/title/%(imdbID)s' % content
out = '\x02%(Title)s\x02 (%(Year)s) (%(Genre)s): %(Plot)s'
if content['Runtime'] != 'N/A':
out += ' \x02%(Runtime)s\x02.'
if content['imdbRating'] != 'N/A' and content['imdbVotes'] != 'N/A':
out += ' \x02%(imdbRating)s/10\x02 with \x02%(imdbVotes)s\x02' \
' votes.'
out += ' %(URL)s'
return out % content
else:
return 'unknown error'