summaryrefslogtreecommitdiff
path: root/imdb-lookup
diff options
context:
space:
mode:
authorYves Fischer <yvesf-git@xapek.org>2014-12-04 22:04:49 +0100
committerYves Fischer <yvesf-git@xapek.org>2014-12-04 22:04:49 +0100
commit818bd098b2d40914001d21c6d4adfe0f8ff9638c (patch)
tree113f9fbde0caac2e16c529eef5d6f571250c886f /imdb-lookup
parent9a23ebb6cca446b3a61aa5e3ea59ef46e136d902 (diff)
downloadscripts-818bd098b2d40914001d21c6d4adfe0f8ff9638c.tar.gz
scripts-818bd098b2d40914001d21c6d4adfe0f8ff9638c.zip
more data!
Diffstat (limited to 'imdb-lookup')
-rwxr-xr-ximdb-lookup/imdbinfo.py22
1 files changed, 17 insertions, 5 deletions
diff --git a/imdb-lookup/imdbinfo.py b/imdb-lookup/imdbinfo.py
index e4e2aab..8521e98 100755
--- a/imdb-lookup/imdbinfo.py
+++ b/imdb-lookup/imdbinfo.py
@@ -201,13 +201,25 @@ def do_aka(args, imdb_ids):
print(tmdbcache.alternative_title(imdb_id, locale=args.lang))
def do_data(args, imdb_ids):
+ def print_data(data, io, indent=0):
+ if isinstance(data, dict):
+ for (key, val) in data.items():
+ if val is None:
+ continue
+ else:
+ io.write("\n{}{}: ".format(indent*" ", key))
+ print_data(val, io, indent+1)
+ elif isinstance(data, list) and len(data)>0:
+ for val in data:
+ print_data(val, io, indent+2)
+ elif type(data) in (bool,str,int,float):
+ io.write(str(data))
+
with TMDBCache() as tmdbcache:
for (filename, imdb_id) in imdb_ids:
- selected_properties = ["imdb_id", "revenue", "vote_average", "vote_count", "runtime", "budget", "vote_avarage", "release_date", "popularity", ]
- kv = map(lambda kv: "{}={}".format(*kv),
- filter(lambda kv: kv[0] in selected_properties,
- tmdbcache.infos(imdb_id).items()))
- print(" ".join(kv))
+ print_data({
+ "TMDB" : tmdbcache.infos(imdb_id),
+ "IMDB" : tmdbcache.imdb_movie(imdb_id)}, sys.stdout)
def do_year(args, imdb_ids):
with TMDBCache() as tmdbcache: