From 31bd935c3b0df3982fca080d0edd1ef8ba396c20 Mon Sep 17 00:00:00 2001 From: Yves Fischer Date: Thu, 11 Dec 2014 00:09:10 +0100 Subject: skip if some data is not available --- imdb-lookup/index.jinja2.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'imdb-lookup') diff --git a/imdb-lookup/index.jinja2.html b/imdb-lookup/index.jinja2.html index b09abf1..e55c855 100644 --- a/imdb-lookup/index.jinja2.html +++ b/imdb-lookup/index.jinja2.html @@ -86,14 +86,14 @@ {% for (path, imdb_id) in input %} {% set info = tmdbcache.infos(imdb_id) %} - {% if info %} + {% set imdb_data = tmdbcache.imdb_movie(imdb_id)['data'] %} + {% set omdb_data = tmdbcache.omdb_movie(imdb_id) %} + {% if info and imdb_data and omdb_data %} {% set year = int(info['release_date'].split('-')[0]) %} {% set age = gmtime.tm_year - year %} {% set centuries = int(age / 10) %} {% set posterBase64 = tmdbcache.poster_base64(info['poster_path'],'w154') %} {% set local_title = tmdbcache.alternative_title(imdb_id, "DE") %} - {% set imdb_data = tmdbcache.imdb_movie(imdb_id)['data'] %} - {% set omdb_data = tmdbcache.omdb_movie(imdb_id) %} {% set votes = imdb_data['num_votes'] %} {% set popularity = int( 9*(1 - (1+math.exp(-1))/(1+math.exp(votes/70000.0 -1 ))) + 1 ) %} {% set fresh = (omdb_data.tomatoMeter != 'N/A') and int(omdb_data.tomatoMeter) or None %} -- cgit v1.2.1