1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>{{title}}</title>
<style>
.box {
margin: 2em 5em auto;
border-radius: 5px;
box-shadow: 0px 0px 30px 0px gray;
background-color: #fafafa;
clear: both;
position: relative;
}
.error {
background-color: #EFAAAA;
height: 150px;
}
.td1, .td2, .td3, .td4, .td5 {
width: 1em;
font-size: 18pt;
padding: 2px;
vertical-align: top;
}
.td1 .on { color: #ffd700; }
.td2 .on { color: blue; }
.td3 .on { color: red; }
.td4 .on { color: black; }
.td1 .off, .td2 .off, .td3 .off, .td4 .off, .td5 .off{ color: #c0c0c0; }
.poster {
margin: 10px;
width: 185px;
float: left;
min-height: 200px;
box-shadow: 0px 0px 5px 0px gray;
}
.info {
padding-left: 2em;
vertical-align: top;
}
.info table td { padding: .2em; }
.details { padding: 0.5em; }
.files {
list-style: none;
padding-left: 0px;
font-size: 0.7em;
margin: 0px;
}
.imdbid {
font-family: monospace;
padding: 3px;
background-color: #f0f0f0;
border: 1px solid #e0e0e0;
border-radius: 4px;
}
.files li:before { margin: 0 1em; content: '▶'; }
.headline { font-size: 0.9em; color: 3e3e3e; }
.box-footer {
position: absolute;
bottom: 0px;
right: 0px;
font-size: 1.4em;
color: #ccc;
font-style: italic;
}
.rated {
border: 1px solid black;
border-radius: 5px;
font-size:0.7em;
padding: 2px;
}
</style>
</head>
<body>
{% for (path, imdb_id) in input %}
{% set info = tmdbcache.infos(imdb_id) %}</h2>
{% if info %}
{% 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']) %}
{% 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 %}
{% set userMeter = (omdb_data.tomatoUserMeter != 'N/A') and int(omdb_data.tomatoUserMeter) or None %}
<div class="box">
<table>
<tr>
{% if "vote_average" in info.keys() %}
<td class="td1" title="IMDB Rating: {{imdb_data.rating}}">
<span class="off">{{ " ".join(["☆"] * (10-int(imdb_data["rating"]))) }}</span>
<span class="on">{{ " ".join(["★"] * int(imdb_data["rating"])) }}</span>
</td>
{% if userMeter %}
<td class="td2" title="Rotten tomatoes user rating: {{userMeter}}%">
<span class="off">{{ " ".join(["☆"] * (10-int(userMeter/10))) }}</span>
<span class="on">{{ " ".join(["★"] * int(userMeter/10)) }}</span>
</td>
{% else %}
<td class="td2"></td>
{% endif %}
{% if fresh %}
<td class="td3" title="Rotten tomatoes: {{fresh}}% fresh">
<span class="off">{{ " ".join(["☆"] * (10-int(fresh/10))) }}</span>
<span class="on">{{ " ".join(["★"] * int(fresh/10)) }}</span>
</td>
{% else %}
<td class="td3"></td>
{% endif %}
<td class="td4" title="IMDB Popularity: {{votes}} votes">
<span class="off">{{ " ".join(["☆"] * (10-popularity)) }}</span>
<span class="on">{{ " ".join(["★"] * popularity) }}</span>
</td>
<td class="td5" title="Centuries since release">
<span class="off">{{ " ".join(["⌚"] * (9-centuries)) }}</span>
<span class="on">{{ " ".join(["⌚"] * (centuries + 1)) }}</span>
</td>
{% endif %}
<td class="poster">
{% if posterBase64 %}
<a href="{{urlencode(path)}}"><img src="{{ posterBase64 }}" /></a>
{% else %}
<span> no image </span>
{% endif %}
</td>
<td class="info">
<div style="font-size: 2em;">
{{ info.title }}
</div>
<div class="headline">
{% if local_title != info.title %} “{{ local_title }}”, {% endif %}
{% if info.original_title != info.title %} “{{ info.original_title }}”, {% endif %}
</div>
<div class="headline">
by {{ imdb_data["directors_summary"] | join(", ", attribute="name.name") }},
runtime {{ info['runtime'] }} min, {{year}}
{% if omdb_data.Rated != 'N/A' %}
<span class="rated">{{omdb_data.Rated}}</span>
{% endif %}
</div>
<div class="headline">
Starring: {{ imdb_data["cast_summary"] | join(", ", attribute="name.name") }}
</div>
<br />
<div>{{ imdb_data.plot.outline }}</div>
<table class="details">
{% if 'homepage' in info and info['homepage'] %}
<tr>
<td colspan="2">
➜ <a href="{{ info['homepage'] }}">{{ info['homepage'] }}</a>
</td>
</tr>
{% elif omdb_data.Website != "N/A" %}
<tr>
<td colspan="2">
➜ <a href="{{ omdb_data.Website }}">{{ omdb_data.Website }}</a>
</td>
</tr>
{% endif %}
<tr>
<td colspan="2">
➜ <a href="http://www.themoviedb.org/movie/{{ info.id }}" rel="noreferrer">themoviedb.org</a>
 
➜ <a href="http://www.imdb.com/title/{{ info.imdb_id }}" rel="noreferrer">imdb.com</a>
 
➜ <a href="http://letterboxd.com/tmdb/{{ info.id }}" rel="noreferrer">letterboxd.com</a>
 
➜ <a href="http://www.ofdb.de/view.php?page=suchergebnis&Kat=IMDb&SText={{ info.imdb_id }}" rel="noreferrer">ofdb.db</a>
 
➜ <span class="imdbid">{{ info.imdb_id }}</span>
</td>
</tr>
</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 class="box-footer">
{{ info.tagline }}
</div>
</div>
{% else %}
<div class="box error">
No infos for <a href="{{path}}">{{path}}</a> {{imdb_id}}
</div>
{% endif %}
{% endfor %}
</body>
</html>
<!--
vim: tabstop=1 expandtab shiftwidth=1 softtabstop=1:
-->
|