summaryrefslogtreecommitdiff
path: root/imdb-lookup/index.jinja2.html
blob: ff9434866db5cb5d405b65dcf784ffd0004816ba (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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
<!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, .td4 {
   width: 1em;
   font-size: 18pt;
   padding: 5px;
   vertical-align: top;
  }
  .td1 .on { color: #ffd700; }
  .td2 .on { color: blue; }
  .td1, .td2 .off { color:  gray; }
  .td1 .num, .td2 .num { font-size: 12pt; color: gray; }
  .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: 1em; }
  .files {
    list-style: none;
    padding-left: 0px;
  }
  .files li:before { margin: 0 1em; content: '▶'; }
  </style>
 </head>
 <body>
  {% 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]) %}
   {% set centuries = int(age / 10) %}
   {% set posterBase64 = tmdbcache.poster_base64(info['poster_path']) %}
   {% set imdb_data = tmdbcache.imdb_movie(imdb_id)['data'] %}
   {% set votes = imdb_data['num_votes'] %}
   {% set popularity = int( 9*(1 - (1+math.exp(-1))/(1+math.exp(votes/70000.0 -1 ))) + 1 ) %}
   <div class="box">
    <table>
     <tr>
      {% if "vote_average" in info.keys() %}
      <td class="td1" title="TMDB Rating">
      <span class="off">{{ " ".join(["☆"] * (10-int(info["vote_average"]))) }}</span>
      <span class="on">{{ " ".join(["★"] * int(info["vote_average"])) }}</span>
      <span class="num">{{info["vote_average"]}}</span>
      </td>
      <td class="td2" title="IMDB Rating">
      <span class="off">{{ " ".join(["☆"] * (10-int(imdb_data["rating"]))) }}</span>
      <span class="on">{{ " ".join(["★"] * int(imdb_data["rating"])) }}</span>
      <span class="num">{{imdb_data["rating"]}}</span>
      </td>
      <td class="td3" title="IMDB Popularity">
      <span class="off">{{ " ".join(["☆"] * (10-popularity)) }}</span>
      <span class="on">{{ " ".join(["★"] * popularity) }}</span>
      </td>
      <td class="td4" title="Centuries since release">
      <span class="off">{{ " ".join(["&nbsp;&nbsp;"] * (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 }}
        {% if info.title != info.original_title %}
        &ensp;({{ info.original_title }})
        {% endif %}
       </div>
       <div>{{ info.overview }}</div>
       <table class="details">
        {% if 'runtime' in info %}
        <tr>
         <td style="font-style: italic">Runtime</td>
         <td>{{ info['runtime'] }}</td>
        </tr>
        {% endif %}
        {% if 'homepage' in info and info['homepage'] %}
        <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>   
       <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 {{path}} {{imdb_id}}
   </div>
   {% endif %}
  {% endfor %}
 </body>
</html>
<!--
vim: tabstop=1 expandtab shiftwidth=1 softtabstop=1:
-->