embed episodes with image mimetype
[mygpo.git] / mygpo / web / templates / episode.html
blob796a1f58967c58b22a612afccd9de1a5b59c3470
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 %}
12 {% load menu %}
13 {% block mainmenu %}{{ "/podcast/"|main_menu }}{% endblock %}
14 {% block sectionmenu %}
15 {% if episode.podcast.title %}
16 {{ "/podcast/"|section_menu:episode.podcast.title }}
17 {% else %}
18 {{ "/podcast/"|section_menu:"Unnamed Podcast" }}
19 {% endif %}
20 {% endblock %}
22 {% block head %}
23 <script type="text/javascript" src="/media/js/jquery-1.4.2.min.js"></script>
24 <script type="text/javascript" src="/media/js/jquery.watermark.min.js"></script>
25 {% if episode.url|is_youtube_video %}
26 <script type="text/javascript" src="/media/js/swfobject.js"></script>
27 <script type="text/javascript" src="/media/js/json2.js"></script>
28 <script type="text/javascript" src="/media/js/youtube-handler.js"></script>
29 {% endif %}
30 {% endblock head %}
32 {% block title %}{{ episode.title|default:"Unnamed Episode"|striptags }} - {{ episode.podcast.title|default:"Unnamed Podcast"|striptags}}{% endblock %}
34 {% block content %}
35 {% if episode.podcast.logo_url %}
36 <div id="podcastlogo"><a href="/podcast/{{ episode.podcast.id }}">{{ episode.podcast|podcast_logo_big }}</a></div>
37 {% endif %}
38 <h1>{{ episode.title|default:"Unnamed Episode"|striptags }}</h1>
39 <small class="description">
40 {% trans "from" %} <a href="/podcast/{{ episode.podcast.id }}">{{ episode.podcast }}</a>{% if episode.timestamp %}, {% trans "released" %} {{episode.timestamp}}{% endif %},
41 {% trans "links" %}:
42 <a href="{{episode.url}}">{% trans "download" %}</a>{% if episode.link and episode.link != episode.url %}, <a href="{{episode.link}}">{% trans "website" %}</a>
43 {% endif %},
44 {% trans "stats:" %} {% blocktrans with episode.listener_count as listener_count %}{{listener_count}} listeners{% endblocktrans %}
45 </small>
46 <hr style="clear: none;"/>
48 {% if episode.url|is_youtube_video %}
49 <div id="ytapiplayer">
50 You need Flash player 8+ and JavaScript enabled to view this video.
51 </div>
52 {% endif %}
54 {% if episode.description %}
55 <p>{{ episode.description|remove_html_tags|linebreaksbr }}</p>
56 {% endif %}
58 {% if episode.url|is_flickr_photo %}
59 {{ episode|embed_flickr_photo }}
60 {% endif %}
62 {% if episode|is_image %}
63 <img src="{{ episode.url }}" />
64 {% endif %}
66 {% if user.is_authenticated %}
68 {% if is_favorite %}
69 <div>
70 <a href="/episode/{{ episode.id }}/toggle-favorite">
71 <img src="/media/fav.png" style="vertical-align: middle;" /> {% trans "Favorite" %}
72 </a>
73 </div>
74 {% else %}
75 <div>
76 <a href="/episode/{{ episode.id }}/toggle-favorite">
77 <img src="/media/fav-add.png" style="vertical-align: middle;" /> {% trans "Add as Favorite" %}
78 </a>
79 </div>
80 {% endif %}
82 {% if played_parts %}
83 <h3>Already played</h3>
84 {{ played_parts|played_visualization:duration }}
85 {% endif %}
88 <hr/>
89 <h2>{% trans "Chapters" %}</h2>
91 <div class="info">
92 {% if not subscription_meta %}
93 {% blocktrans with episode.podcast.id as podcast_id %}You aren't subscribed to this podcast. Therefor your chapters are also visible to other users. If you do no want that, <a href="/podcast/{{ podcast_id }}/subscribe">subscribe to the podcast</a> and mark your subscription as private.{% endblocktrans %}
94 {% else %}
95 {% if subscription_meta.public %}
96 {%blocktrans with episode.podcast.id as podcast_id %}Your own chapters are shown in bold. If you don't want them to appear to other users, go to the <a href="/podcast/{{ podcast_id }}">podcast page</a> and mark your subscription as private.{% endblocktrans %}
97 {% else %}
98 {% blocktrans with episode.podcast.id as podcast_id %}The following list contains your chapters in bold and those of other users. However, yours are not shown to others, because you've marked your subscription as prive on the <a href="/podcast/{{ podcast_id }}">podcast page</a>. You can change that there, if you want.{% endblocktrans %}
99 {% endif %}
100 {% endif %}
101 </div>
103 <table class="list">
104 <tr>
105 <th></th>
106 <th>{% trans "Ad?" %}</th>
107 <th>{% trans "Label" %}</th>
108 <th></td>
109 </tr>
111 {% for chapter in chapters %}
112 <tr {% if chapter.user == user %}class="own-chapter"{% endif %} >
113 <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>
114 <td>{% if chapter.advertisement %}Yes{% endif %}</td>
115 <td>{{ chapter.label }}</strong>
116 <td>
117 {% if chapter.user == user %}
118 <a href="/episode/{{ episode.id }}/remove-chapter/{{ chapter.id}}">
119 <img src="/media/unsubscribe.png" alt="{% trans "Remove" %}" />
120 </a>
121 {% endif %}
122 </td>
123 </tr>
124 {% endfor %}
125 <tr>
126 <form action="/episode/{{ episode.id }}/add-chapter" method="POST">
127 {% csrf_token %}
128 <td>
129 <input type="text" name="start" id="start" class="time" /> -
130 <input type="text" name="end" id="end" class="time" />
131 </td>
132 <td>
133 <input type="checkbox" name="advertisement" />
134 </td>
135 <td>
136 <input type="text" name="label" />
137 </td>
138 <td>
139 <input type="submit" value="{% trans "Add" %}" />
140 </td>
141 </form>
142 </tr>
143 </table>
144 {% endif %}
146 {% if history %}
147 <h2>{% trans "History" %}</h2>
148 <table class="list">
149 <tr>
150 <th>{% trans "Time" %}</th>
151 <th>{% trans "Action" %}</th>
152 <th>{% trans "Device" %}</th>
153 <th></th>
154 </tr>
156 {% for s in history %}
157 <tr>
158 <td><abbr title="{{ s.timestamp }}">{{ s.timestamp|naturalday }}</abbr></td>
159 <td style="text-align: center;">{{ s|episode_status_icon }}</td>
160 <td>
161 {% if s.device %}
162 <a href="/device/{{ s.device.id }}">{{ s.device|device_icon }} {{ s.device.name|striptags }}</a>
163 {% endif %}
164 </td>
165 <td>{% if s.playmark %}{{ s.playmark_time|date:"H:m:s" }}{% endif %}
166 </tr>
167 {% endfor %}
168 </table>
169 {% endif %}
171 {% if not episode.title %}
172 <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>
173 {% endif %}
175 {% endblock %}
178 {% block javascript %}
179 <script type="text/javascript">
180 $("#start").watermark("h:mm:ss", {className: 'watermark'});
181 $("#end").watermark("h:mm:ss", {className: 'watermark'});
183 {% if episode.url|is_youtube_video %}
184 {{ episode|embed_youtube_video:user }}
185 {% endif %}
187 </script>
188 {% endblock javascript %}