imdb: ignore unknown fields. PEP8 rottentomatoes

This commit is contained in:
Ryan Hitchman 2011-05-11 16:40:53 -05:00
parent 61e07cc0ae
commit bf7aeb07da
2 changed files with 9 additions and 4 deletions

View File

@ -14,8 +14,12 @@ def imdb(inp):
elif content['Response'] == 'True':
content['URL'] = 'http://www.imdb.com/title/%(ID)s' % content
return "\x02%(Title)s\x02 (%(Year)s) (%(Genre)s): %(Plot)s " \
"\x02%(Runtime)s\x02. \x02%(Rating)s/10\x02 with " \
"\x02%(Votes)s\x02 votes. %(URL)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['Rating'] != 'N/A' and content['Votes'] != 'N/A':
out += ' \x02%(Rating)s/10\x02 with \x02%(Votes)s\x02 votes.'
out += ' %(URL)s'
return out % content
else:
return 'unknown error'

View File

@ -7,6 +7,7 @@ movie_reviews_url = api_root+'movies/%s/reviews.json?apikey=%s&review_type=all'
response = u"%s - critics: \x02%d%%\x02 (%d\u2191%d\u2193) audience: \x02%d%%\x02 - %s"
@hook.command('rt')
def rottentomatoes(inp, bot=None):
'.rt <title> -- gets ratings for <title> from Rotten Tomatoes'
@ -33,4 +34,4 @@ def rottentomatoes(inp, bot=None):
fresh = critics_score * review_count / 100
rotten = review_count - fresh
return response % (title, critics_score, fresh, rotten, audience_score, url)
return response % (title, critics_score, fresh, rotten, audience_score, url)