integrate youtube-videos on website (+ send play-events)
[mygpo.git] / mygpo / web / templates / episode.html
blob47f3fbb3ae5173eda61afe2875b9f9644da4827d
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 %}
11 {% load menu %}
12 {% block mainmenu %}{{ "/podcast/"|main_menu }}{% endblock %}
13 {% block sectionmenu %}
14 {% if episode.podcast.title %}
15 {{ "/podcast/"|section_menu:episode.podcast.title }}
16 {% else %}
17 {{ "/podcast/"|section_menu:"Unnamed Podcast" }}
18 {% endif %}
19 {% endblock %}
21 {% block head %}
22 <script type="text/javascript" src="/media/js/jquery-1.4.2.min.js"></script>
23 <script type="text/javascript" src="/media/js/jquery.watermark.min.js"></script>
24 {% if episode.link|is_youtube_video %}
25 <script type="text/javascript" src="/media/js/swfobject.js"></script>
26 <script type="text/javascript" src="/media/js/json2.js"></script>
27 <script type="text/javascript" src="/media/js/youtube-handler.js"></script>
28 {% endif %}
29 {% endblock head %}
31 {% block title %}{{ episode.title|default:"Unnamed Episode"|striptags }} - {{ episode.podcast.title|default:"Unnamed Podcast"|striptags}}{% endblock %}
33 {% block content %}
34 {% if episode.podcast.logo_url %}
35 <div id="podcastlogo"><a href="/podcast/{{ episode.podcast.id }}">{{ episode.podcast|podcast_logo_big }}</a></div>
36 {% endif %}
37 <h1>{{ episode.title|default:"Unnamed Episode"|striptags }}</h1>
38 <small class="description">
39 {% trans "from" %} <a href="/podcast/{{ episode.podcast.id }}">{{ episode.podcast }}</a>{% if episode.timestamp %}, {% trans "released" %} {{episode.timestamp}}{% endif %},
40 {% trans "links" %}:
41 <a href="{{episode.url}}">{% trans "download" %}</a>{% if episode.link and episode.link != episode.url %}, <a href="{{episode.link}}">{% trans "website" %}</a>
42 {% endif %},
43 {% trans "stats:" %} {% blocktrans with episode.listener_count as listener_count %}{{listener_count}} listeners{% endblocktrans %}
44 </small>
45 <hr style="clear: none;"/>
47 {% if episode.link|is_youtube_video %}
48 <div id="ytapiplayer">
49 You need Flash player 8+ and JavaScript enabled to view this video.
50 </div>
51 {% endif %}
53 {% if episode.description %}
54 <p>{{ episode.description|remove_html_tags|linebreaksbr }}</p>
55 {% endif %}
57 {% if user.is_authenticated %}
59 {% if is_favorite %}
60 <div>
61 <a href="/episode/{{ episode.id }}/toggle-favorite">
62 <img src="/media/fav.png" style="vertical-align: middle;" /> {% trans "Favorite" %}
63 </a>
64 </div>
65 {% else %}
66 <div>
67 <a href="/episode/{{ episode.id }}/toggle-favorite">
68 <img src="/media/fav-add.png" style="vertical-align: middle;" /> {% trans "Add as Favorite" %}
69 </a>
70 </div>
71 {% endif %}
73 {% if played_parts %}
74 <h3>Already played</h3>
75 {{ played_parts|played_visualization:duration }}
76 {% endif %}
79 <hr/>
80 <h2>{% trans "Chapters" %}</h2>
82 <div class="info">
83 {% if not subscription_meta %}
84 {% 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 %}
85 {% else %}
86 {% if subscription_meta.public %}
87 {%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 %}
88 {% else %}
89 {% 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 %}
90 {% endif %}
91 {% endif %}
92 </div>
94 <table class="list">
95 <tr>
96 <th></th>
97 <th>{% trans "Ad?" %}</th>
98 <th>{% trans "Label" %}</th>
99 <th></td>
100 </tr>
102 {% for chapter in chapters %}
103 <tr {% if chapter.user == user %}class="own-chapter"{% endif %} >
104 <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>
105 <td>{% if chapter.advertisement %}Yes{% endif %}</td>
106 <td>{{ chapter.label }}</strong>
107 <td>
108 {% if chapter.user == user %}
109 <a href="/episode/{{ episode.id }}/remove-chapter/{{ chapter.id}}">
110 <img src="/media/unsubscribe.png" alt="{% trans "Remove" %}" />
111 </a>
112 {% endif %}
113 </td>
114 </tr>
115 {% endfor %}
116 <tr>
117 <form action="/episode/{{ episode.id }}/add-chapter" method="POST">
118 {% csrf_token %}
119 <td>
120 <input type="text" name="start" id="start" class="time" /> -
121 <input type="text" name="end" id="end" class="time" />
122 </td>
123 <td>
124 <input type="checkbox" name="advertisement" />
125 </td>
126 <td>
127 <input type="text" name="label" />
128 </td>
129 <td>
130 <input type="submit" value="{% trans "Add" %}" />
131 </td>
132 </form>
133 </tr>
134 </table>
135 {% endif %}
137 {% if history %}
138 <h2>{% trans "History" %}</h2>
139 <table class="list">
140 <tr>
141 <th>{% trans "Time" %}</th>
142 <th>{% trans "Action" %}</th>
143 <th>{% trans "Device" %}</th>
144 <th></th>
145 </tr>
147 {% for s in history %}
148 <tr>
149 <td><abbr title="{{ s.timestamp }}">{{ s.timestamp|naturalday }}</abbr></td>
150 <td style="text-align: center;">{{ s|episode_status_icon }}</td>
151 <td>
152 {% if s.device %}
153 <a href="/device/{{ s.device.id }}">{{ s.device|device_icon }} {{ s.device.name|striptags }}</a>
154 {% endif %}
155 </td>
156 <td>{% if s.playmark %}{{ s.playmark_time|date:"H:m:s" }}{% endif %}
157 </tr>
158 {% endfor %}
159 </table>
160 {% endif %}
162 {% if not episode.title %}
163 <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>
164 {% endif %}
166 {% endblock %}
169 {% block javascript %}
170 <script type="text/javascript">
171 $("#start").watermark("h:mm:ss", {className: 'watermark'});
172 $("#end").watermark("h:mm:ss", {className: 'watermark'});
174 {% if episode.link|is_youtube_video %}
175 {{ episode|embed_youtube_video:user }}
176 {% endif %}
178 </script>
179 {% endblock javascript %}