migrate episode heatmap to CouchDB
[mygpo.git] / mygpo / web / templates / episode.html
blob019bbbe4531c3c5c2f3fddeaef07e7d624183866
1 {% extends "base.html" %}
2 {% load i18n %}
3 {% load humanize %}
4 {% load episodes %}
5 {% load devices %}
6 {% load podcasts %}
7 {% load mygpoutil %}
8 {% load time %}
9 {% load youtube %}
10 {% load flickr %}
11 {% load facebook %}
12 {% load charts %}
14 {% load menu %}
15 {% block mainmenu %}{{ "/podcast/"|main_menu }}{% endblock %}
16 {% block sectionmenu %}
17 {% if episode.podcast.title %}
18 {{ "/podcast/"|section_menu:episode.podcast.title }}
19 {% else %}
20 {{ "/podcast/"|section_menu:"Unnamed Podcast" }}
21 {% endif %}
22 {% endblock %}
24 {% block head %}
25 <script type="text/javascript" src="/media/js/jquery-1.4.2.min.js"></script>
26 <script type="text/javascript" src="/media/js/jquery.watermark.min.js"></script>
27 {% if episode.url|is_youtube_video %}
28 <script type="text/javascript" src="/media/js/swfobject.js"></script>
29 <script type="text/javascript" src="/media/js/json2.js"></script>
30 <script type="text/javascript" src="/media/js/youtube-handler.js"></script>
31 {% endif %}
32 {{ episode|opengraph_episode }}
33 {% endblock head %}
35 {% block title %}{{ episode.title|default:"Unnamed Episode"|striptags }} - {{ episode.podcast.title|default:"Unnamed Podcast"|striptags}}{% endblock %}
37 {% block content %}
38 {% if episode.podcast.logo_url %}
39 <div id="podcastlogo"><a href="{% podcast_link_target episode.podcast %}">{{ episode.podcast|podcast_logo_big }}</a></div>
40 {% endif %}
41 <h1>{{ episode.title|default:"Unnamed Episode"|striptags }}</h1>
42 <small class="description">
43 {% trans "from" %} {% podcast_group_link episode.podcast %}{% if episode.timestamp %}, {% trans "released" %} {{episode.timestamp}}{% endif %},
44 {% trans "links" %}:
45 <a href="{{episode.url}}">{% trans "download" %}</a>{% if episode.link and episode.link != episode.url %}, <a href="{{episode.link}}">{% trans "website" %}</a>
46 {% endif %},
47 {% trans "stats:" %} {% blocktrans with episode.listener_count as listener_count %}{{listener_count}} listeners{% endblocktrans %}
48 </small>
49 <hr style="clear: none;"/>
51 {% if episode.url|is_youtube_video %}
52 <div id="ytapiplayer">
53 You need Flash player 8+ and JavaScript enabled to view this video.
54 </div>
55 {% endif %}
57 {% if episode.description %}
58 <p>{{ episode.description|remove_html_tags|linebreaksbr }}</p>
59 {% endif %}
61 {{ episode|fb_like_episode }}
63 {% if episode.url|is_flickr_photo %}
64 {{ episode|embed_flickr_photo }}
65 {% endif %}
67 {% if episode|is_image %}
68 <img src="{{ episode.url }}" />
69 {% endif %}
71 {% if user.is_authenticated %}
73 {% if is_favorite %}
74 <div>
75 <a href="{% url episode-fav episode.id %}">
76 <img src="/media/fav.png" style="vertical-align: middle;" /> {% trans "Favorite" %}
77 </a>
78 </div>
79 {% else %}
80 <div>
81 <a href="{% url episode-fav episode.id %}">
82 <img src="/media/fav-add.png" style="vertical-align: middle;" /> {% trans "Add as Favorite" %}
83 </a>
84 </div>
85 {% endif %}
87 {% if played_parts %}
88 <h3>Already played</h3>
89 {{ played_parts|episode_heatmap_visualization }}
90 {% endif %}
93 <div class="navigation">
94 <div class="prev">
95 {% if prev %}
96 {% trans "Previous Episode: " %}<a href="{% url episode prev.id %}">{{ prev.title|striptags }}</a>
97 {% endif %}
98 </div>
99 <div class="list">
100 <a href="{% podcast_link_target episode.podcast %}#episodes">{% trans "Episode-List" %}</a>
101 </div>
102 <div class="next">
103 {% if next %}
104 {% trans "Next Episode: " %}<a href="{% url episode next.id %}">{{ next.title|striptags }}</a>
105 {% endif %}
106 </div>
107 </div>
109 <hr/>
110 <h2>{% trans "Chapters" %}</h2>
112 <div class="info">
113 {% blocktrans %}Your chapters are shown in bold.{% endblocktrans %}
114 </div>
116 <table class="list">
117 <tr>
118 <th></th>
119 <th>{% trans "Ad?" %}</th>
120 <th>{% trans "Label" %}</th>
121 <th></td>
122 </tr>
124 {% for chapter in chapters %}
125 <tr {% if chapter.is_own %}class="own-chapter"{% endif %} >
126 <td>{{ chapter.start|sec_to_time|time:"H:i:s" }}{% if chapter.start != chapter.end %} - {{ chapter.end|sec_to_time|time:"H:i:s" }}{% endif %}</td>
127 <td>{% if chapter.advertisement %}Yes{% endif %}</td>
128 <td>{{ chapter.label }}</strong>
129 <td>
130 {% if chapter.is_own %}
131 <a href="{% url remove-chapter episode.id chapter.start chapter.end %}">
132 <img src="/media/unsubscribe.png" alt="{% trans "Remove" %}" />
133 </a>
134 {% endif %}
135 </td>
136 </tr>
137 {% endfor %}
138 <tr>
139 <form action="{% url add-chapter episode.id %}" method="POST">
140 {% csrf_token %}
141 <td>
142 <input type="text" name="start" id="start" class="time" /> -
143 <input type="text" name="end" id="end" class="time" />
144 </td>
145 <td>
146 <input type="checkbox" name="advertisement" />
147 </td>
148 <td>
149 <input type="text" name="label" />
150 </td>
151 <td>
152 <input type="submit" value="{% trans "Add" %}" />
153 </td>
154 </form>
155 </tr>
156 </table>
157 {% endif %}
159 {% if history %}
160 <h2>{% trans "History" %}</h2>
161 <table class="list">
162 <tr>
163 <th>{% trans "Time" %}</th>
164 <th>{% trans "Action" %}</th>
165 <th>{% trans "Device" %}</th>
166 <th></th>
167 </tr>
169 {% for s in history %}
170 <tr>
171 <td><abbr title="{{ s.timestamp }}">{{ s.timestamp|naturalday }}</abbr></td>
172 <td style="text-align: center;">{{ s|episode_status_icon }}</td>
173 <td>
174 {% if s.device %}
175 <a href="{% url device s.device.oldid %}">{{ s.device|device_icon }} {{ s.device.name|striptags }}</a>
176 {% endif %}
177 </td>
178 <td>{% if s.started %}{{s.started_time|date:"H:m:s" }} - {% endif %}
179 {% if s.playmark %}{{ s.playmark_time|date:"H:m:s" }}{% endif %}
180 </td>
181 </tr>
182 {% endfor %}
183 </table>
184 {% endif %}
186 {% if not episode.title %}
187 <div class="info"><strong>{% trans "Why Unnamed Episode?" %}</strong> {% trans "Because we display names after we have fetched the information form the feed -- and this may take some time. Until this is completed, the podcast will simply be called this way." %}</div>
188 {% endif %}
190 {% endblock %}
193 {% block javascript %}
194 <script type="text/javascript">
195 $("#start").watermark("h:mm:ss", {className: 'watermark'});
196 $("#end").watermark("h:mm:ss", {className: 'watermark'});
198 {% if episode.url|is_youtube_video %}
199 {{ episode|embed_youtube_video:user }}
200 {% endif %}
202 </script>
203 {% endblock javascript %}