From 79ba03a5a84a4ac5c526cb69f1337b2fdc876c54 Mon Sep 17 00:00:00 2001 From: Yves Fischer Date: Wed, 24 Dec 2014 15:33:29 +0100 Subject: filtering --- imdb-lookup/imdbinfo.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'imdb-lookup/imdbinfo.py') diff --git a/imdb-lookup/imdbinfo.py b/imdb-lookup/imdbinfo.py index 370e124..fe4bd60 100755 --- a/imdb-lookup/imdbinfo.py +++ b/imdb-lookup/imdbinfo.py @@ -336,6 +336,16 @@ def do_index(args, imdb_ids): return out else: return None + + def compile_summary(imdb,omdb,tmdb): + buf = [] + if "directors_summary" in imdb: + buf += ["By " + ", ".join(map(lambda i: i["name"]["name"], imdb["directors_summary"]))] + if "cast_summary" in imdb: + buf += ["Starring: " + ", ".join(map(lambda i: i["name"]["name"], imdb["cast_summary"]))] + if omdb["Rated"] != "N/A": + buf += ["Rated: " + omdb["Rated"]] + return ". ".join(buf) path, imdb_id = a db = Protector(TMDBCache()) @@ -349,6 +359,7 @@ def do_index(args, imdb_ids): return { 'id': imdb_id, 'title': tmdb['title'], + 'summary': compile_summary(imdb, omdb, tmdb), 'poster': poster(imdb_id), 'tagline': 'tagline' in imdb and imdb['tagline'] or None, 'plot': 'plot' in imdb and imdb['plot']['outline'] or None, @@ -359,10 +370,8 @@ def do_index(args, imdb_ids): 'imdbRating': imdb['rating'], 'imdbVotes': imdb['num_votes'], 'omdbTomatoConsensus': (omdb['tomatoConsensus'] != 'N/A') and omdb['tomatoConsensus'] or None, - 'omdbTomato': (omdb['tomatoMeter'] != 'N/A') and float(omdb['tomatoMeter']) or None, - 'omdbUserTomato': (omdb['tomatoUserMeter'] != 'N/A') and float(omdb['tomatoUserMeter']) or None, + 'omdbTomatoMeter': (omdb['tomatoMeter'] != 'N/A') and float(omdb['tomatoMeter']) or None, 'omdbTomatoRating': (omdb['tomatoRating'] != 'N/A') and float(omdb['tomatoRating']) or None, - 'omdbTomatoUserRating': (omdb['tomatoUserRating'] != 'N/A') and float(omdb['tomatoUserRating']) or None, 'tmdbId': tmdb['id'], } -- cgit v1.2.1