summaryrefslogtreecommitdiff
path: root/imdb-lookup/index.jinja2.html
blob: 181e7ffa4c8b3b92af59c25c2a66befe96b2c037 (plain)
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
<!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;
  }
  .error {
    background-color: #EFAAAA;
  }
  .td1, .td2, .td3 {
   width: 1em;
   font-size: 18pt;
   padding: 5px;
  }
  .td1 .on { color: #ffd700; }
  .td2 .on { color: blue; }
  .td1, .td2 .off { color:  gray; }
  .poster {
   margin: 10px;
   width: 185px;
   float: left;
   min-height: 200px;
   box-shadow: 0px 0px 5px 0px gray;
  }
  .infos {
   padding-left: 2em;
   vertical-align: top;
  }
  .infos table td { padding: .2em; }
  </style>
 </head>
 <body>
  {% for (filename, imdb_id) in input %}
   {% set info = tmdbcache.infos(imdb_id) %}</h2>
   {% if info %}
   {% set age = gmtime.tm_year - int(info['release_date'].split('-')[0]) %}
   {% set centuries = int(age / 10) %}
   {% set posterBase64 = tmdbcache.poster_base64(info['poster_path']) %}
   <div class="box">
    <table>
     <tr>
      {% if "vote_average" in info.keys() %}
      <td class="td1">
      <span class="off">{{ " ".join(["☆"] * (10-int(info["vote_average"]))) }}</span>
      <span class="on">{{ " ".join(["★"] * int(info["vote_average"])) }}</span>
      </td>
      <!--
      <td class="td2">
      <span class="off">{{ " ".join(["☆"] * (10-int(info["popularity"]*10))) }}</span>
      <span class="on">{{ " ".join(["★"] * int(info["popularity"]*10)) }}</span>
      </td>
      -->
      <td class="td3">
      <span class="off">{{ " ".join(["&nbsp;&nbsp;"] * (10-centuries)) }}</span>
      <span class="on">{{ " ".join(["⌚"] * centuries) }}</span>
      </td>
      {% endif %}
      <td class="poster">
       {% if posterBase64 %}
       <a href="{{urlencode(filename)}}"><img src="{{ posterBase64 }}" /></a>
       {% else %}
       <span> no image </span>
       {% endif %}
      </td>
      <td class="infos">
       <div style="font-size: 2em;">
        {{ info.title }}
        {% if info.title != info.original_title %}
        &ensp;({{ info.original_title }})
        {% endif %}
       </div>
       <div>{{ info.overview }}</div>
       <table style="padding: 2em;">
        {% if 'runtime' in info %}
        <tr>
         <td style="font-style: italic">Runtime</td>
         <td>{{ info['runtime'] }}</td>
        </tr>
        {% endif %}
        {% if 'homepage' in info %}
        <tr>
         <td style="font-style: italic">Homepage</td>
         <td><a href="{{ info['homepage'] }}">{{ info['homepage'] }}</a></td>
        </tr>
        {% endif %}
        <tr>
         <td style="font-style: italic">Release</td>
         <td>{{ info['release_date'] }} {% if age > 0 %} &ensp;({{ age }} year{% if age > 1 %}s{% endif %} &ensp; old){% endif %}</td>
        </tr>
        <tr>
         <td colspan="2">
          <a href="http://www.themoviedb.org/movie/{{ info.id }}" rel="noreferrer">→ themoviedb.org</a>
          &ensp;
          <a href="http://www.imdb.com/title/{{ info.imdb_id }}" rel="noreferrer">→ imdb.com</a>
          &ensp;
          <a href="http://letterboxd.com/tmdb/{{ info.id }}" rel="noreferrer">→ letterboxd.com</a>
          &ensp;
          <a href="http://www.ofdb.de/view.php?page=suchergebnis&Kat=IMDb&SText={{ info.imdb_id }}" rel="noreferrer">→ ofdb.db</a>
         </td>
        </tr>
       </table>
      </td>
     </tr>
    </table>
   </div>
   {% else %}
   <div class="box error">
       No infos for {{filename}} {{imdb_id}}
   </div>
   {% endif %}
  {% endfor %}
 </body>
</html>
<!--
vim: tabstop=1 expandtab shiftwidth=1 softtabstop=1:
-->