summaryrefslogtreecommitdiff
path: root/imdb-lookup/imdbinfo.py
diff options
context:
space:
mode:
authorYves Fischer <yvesf-git@xapek.org>2014-12-08 23:49:07 +0100
committerYves Fischer <yvesf-git@xapek.org>2014-12-08 23:49:07 +0100
commita6ff2d8166723026b3db0092399fe6f694fa0750 (patch)
tree11a8482fbe52efe4390f149e06ae5de78f59d08f /imdb-lookup/imdbinfo.py
parente16f2428ad410645db1a640d4a56d63df74efd4a (diff)
downloadscripts-a6ff2d8166723026b3db0092399fe6f694fa0750.tar.gz
scripts-a6ff2d8166723026b3db0092399fe6f694fa0750.zip
more data!
Diffstat (limited to 'imdb-lookup/imdbinfo.py')
-rwxr-xr-ximdb-lookup/imdbinfo.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/imdb-lookup/imdbinfo.py b/imdb-lookup/imdbinfo.py
index 5c88fc1..eeea947 100755
--- a/imdb-lookup/imdbinfo.py
+++ b/imdb-lookup/imdbinfo.py
@@ -167,6 +167,18 @@ class TMDBCache(object):
key = "imdb_maindetails_{}".format(movie_id)
return self._cache(key, do_request)
+ def omdb_movie(self, movie_id):
+ def do_request():
+ BASE_URI="http://www.omdbapi.com/"
+ params={'i':movie_id, 'plot':'short', 'r':'json', 'tomatoes':'true'}
+ r = requests.get(BASE_URI, params=params)
+ assert r.status_code == 200, "Request must return status-code 200"
+ data = json.loads(r.text)
+ assert data is not None and data['Response'] == 'True', "Data must not be empty"
+ return data
+ key = "omdb_{}".format(movie_id)
+ return self._cache(key, do_request)
+
def weight_rating(infos):
""" add 'rating' to all infos"""