Atheuz

Untitled

May 11th, 2011 (edited)
207
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.87 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 = ''
  16.         out += '\x02%(Title)s\x02 '
  17.         out += '(%(Year)s) '
  18.         out += '(%(Genre)s): '
  19.         out += '%(Plot)s '
  20.         if content['Runtime'] != 'N/A':
  21.             out += '\x02%(Runtime)s\x02. '
  22.         if content['Rating'] != 'N/A' and content['Votes'] != 'N/A':
  23.             out += '\x02%(Rating)s/10\x02 with \x02%(Votes)s\x02 votes. '
  24.         out += '%(URL)s'
  25.         return out % content
  26.     else:
  27.         return 'unknown error'
Add Comment
Please, Sign In to add comment