summaryrefslogtreecommitdiff
path: root/imdb-lookup
diff options
context:
space:
mode:
authorYves Fischer <yvesf-git@xapek.org>2014-11-22 18:24:34 +0100
committerYves Fischer <yvesf-git@xapek.org>2014-11-22 18:24:34 +0100
commit58d309ed92dc37670635fb7c60a37d7fdada68bf (patch)
tree807c799cc58bd7e53800dc1f690d576a50aca06b /imdb-lookup
parent5ce5f9663939042380a858887b22f06e6283223e (diff)
downloadscripts-58d309ed92dc37670635fb7c60a37d7fdada68bf.tar.gz
scripts-58d309ed92dc37670635fb7c60a37d7fdada68bf.zip
ratings
Diffstat (limited to 'imdb-lookup')
-rwxr-xr-ximdb-lookup/imdbinfo.py3
-rw-r--r--imdb-lookup/index.jinja2.html10
2 files changed, 11 insertions, 2 deletions
diff --git a/imdb-lookup/imdbinfo.py b/imdb-lookup/imdbinfo.py
index 26129b8..71fd5f7 100755
--- a/imdb-lookup/imdbinfo.py
+++ b/imdb-lookup/imdbinfo.py
@@ -175,7 +175,7 @@ def do_index(args, imdb_ids):
print("Failed to import jinja2 library for html-templating")
sys.exit(1)
template_file = os.path.join(os.path.dirname(__file__), "index.jinja2.html")
- template = Template(open(template_file).read())
+ template = Template(open(template_file, "rb").read().decode('utf-8'))
with TMDBCache() as tmdbcache:
#infos = list(map(tmdbcache.infos, imdb_ids))
#posters = list(map(asBase64, map(tmdbcache.poster, map(lambda info: info['poster_path'], infos))))
@@ -184,6 +184,7 @@ def do_index(args, imdb_ids):
'tmdbcache' : Protector(tmdbcache),
'title' : 'Movie overview',
'urlencode' : urlencode,
+ 'int' : int,
}
assert not os.path.exists("index.html"), "index.html already exists"
stream = template.generate(mapping)
diff --git a/imdb-lookup/index.jinja2.html b/imdb-lookup/index.jinja2.html
index abf194e..a87092e 100644
--- a/imdb-lookup/index.jinja2.html
+++ b/imdb-lookup/index.jinja2.html
@@ -13,7 +13,15 @@
{% set posterBase64 = tmdbcache.poster_base64(info['poster_path']) %}
{% if info %}
<div style="clear: left; padding-top: 3em;">
- <h2 style="">{{ info.title }}</h2>
+ <h2 style="">
+ {% if "vote_average" in info.keys() %}
+ {{ " ".join(["★"] * int(info["vote_average"])) }}
+ <span style="color:gray;">
+ {{ " ".join(["☆"] * (10-int(info["vote_average"]))) }}
+ </span>
+ {% endif %}
+ {{ info.title }}
+ </h2>
<div style="width: 185px; float: left; min-height: 200px; border: 2px solid gray;">
{% if posterBase64 %}
<a href="{{urlencode(filename)}}">