summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-ximdb-lookup/imdbinfo.py9
-rw-r--r--imdb-lookup/index.jinja2.html31
2 files changed, 31 insertions, 9 deletions
diff --git a/imdb-lookup/imdbinfo.py b/imdb-lookup/imdbinfo.py
index caf00a4..259b2c6 100755
--- a/imdb-lookup/imdbinfo.py
+++ b/imdb-lookup/imdbinfo.py
@@ -140,7 +140,7 @@ class Protector(object):
if callable(attr):
return protected
else:
- return o
+ return attr
def do_aka(args, imdb_ids):
with TMDBCache() as tmdbcache:
@@ -178,6 +178,12 @@ def do_rating(args, imdb_ids):
def do_index(args, imdb_ids):
"""creates a index website"""
+ def listMovieFiles(path):
+ for root, dirs, files in os.walk(path):
+ for curfile in files:
+ if sum(map(curfile.endswith, [".mkv", ".avi", ".mov", ".mp4"])):
+ yield os.path.join(root, curfile)
+
def asBase64(poster):
contentType, data = poster
data64 = filter(lambda c: c!='\n', base64.encodestring(data))
@@ -197,6 +203,7 @@ def do_index(args, imdb_ids):
'title' : 'Movie overview',
'urlencode' : urlencode,
'int' : int,
+ 'listMovieFiles' : listMovieFiles,
}
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 181e7ff..6eae465 100644
--- a/imdb-lookup/index.jinja2.html
+++ b/imdb-lookup/index.jinja2.html
@@ -31,15 +31,21 @@
min-height: 200px;
box-shadow: 0px 0px 5px 0px gray;
}
- .infos {
+ .info {
padding-left: 2em;
vertical-align: top;
}
- .infos table td { padding: .2em; }
+ .info table td { padding: .2em; }
+ .details { padding: 1em; }
+ .files {
+ list-style: none;
+ padding-left: 0px;
+ }
+ .files li:before { margin: 0 1em; content: '▶'; }
</style>
</head>
<body>
- {% for (filename, imdb_id) in input %}
+ {% for (path, imdb_id) in input %}
{% set info = tmdbcache.infos(imdb_id) %}</h2>
{% if info %}
{% set age = gmtime.tm_year - int(info['release_date'].split('-')[0]) %}
@@ -66,12 +72,12 @@
{% endif %}
<td class="poster">
{% if posterBase64 %}
- <a href="{{urlencode(filename)}}"><img src="{{ posterBase64 }}" /></a>
+ <a href="{{urlencode(path)}}"><img src="{{ posterBase64 }}" /></a>
{% else %}
<span> no image </span>
{% endif %}
</td>
- <td class="infos">
+ <td class="info">
<div style="font-size: 2em;">
{{ info.title }}
{% if info.title != info.original_title %}
@@ -79,7 +85,7 @@
{% endif %}
</div>
<div>{{ info.overview }}</div>
- <table style="padding: 2em;">
+ <table class="details">
{% if 'runtime' in info %}
<tr>
<td style="font-style: italic">Runtime</td>
@@ -107,14 +113,23 @@
<a href="http://www.ofdb.de/view.php?page=suchergebnis&Kat=IMDb&SText={{ info.imdb_id }}" rel="noreferrer">→ ofdb.db</a>
</td>
</tr>
- </table>
+ </table>
+ <ul class="files">
+ {% for file in listMovieFiles(path) %}
+ <li>
+ <a href="{{urlencode(file)}}">
+ {{ " → ".join(file.split("/")[1:]) }}
+ </a>
+ </li>
+ {% endfor %}
+ </ul>
</td>
</tr>
</table>
</div>
{% else %}
<div class="box error">
- No infos for {{filename}} {{imdb_id}}
+ No infos for {{path}} {{imdb_id}}
</div>
{% endif %}
{% endfor %}