Atheuz

Untitled

May 11th, 2011 (edited)
212
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.79 KB | None | 0 0
  1. # IMDb lookup plugin
  2.  
  3. from util import hook, http
  4.  
  5. @hook.command
  6. def imdb(inp):
  7.     '''.imdb <movie> -- gets information about <movie> from IMDb'''
  8.  
  9.     content = http.get_json('http://www.imdbapi.com/', t=inp)
  10.  
  11.     if content['Response'] == 'Movie Not Found':
  12.         return 'movie not found'
  13.     elif content['Response'] == 'True':
  14.         content['URL'] = 'http://www.imdb.com/title/%(ID)s' % content
  15.         out = '\x02%(Title)s\x02 (%(Year)s) (%(Genre)s): %(Plot)s'
  16.         if content['Runtime'] != 'N/A':
  17.             out += ' \x02%(Runtime)s\x02.'
  18.         if content['Rating'] != 'N/A' and content['Votes'] != 'N/A':
  19.             out += ' \x02%(Rating)s/10\x02 with \x02%(Votes)s\x02 votes.'
  20.         out += ' %(URL)s'
  21.         return out % content
  22.     else:
  23.         return 'unknown error'
Add Comment
Please, Sign In to add comment