simplify API device list
[mygpo.git] / mygpo / web / templates / episode.html
blobfa878c91038385c6710648c67a00fac867e3eaab
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="{% url 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="{% url 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="{% url episode-fav episode.id %}">
71 <img src="/media/fav.png" style="vertical-align: middle;" /> {% trans "Favorite" %}
72 </a>
73 </div>
74 {% else %}
75 <div>
76 <a href="{% url episode-fav episode.id %}">
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 {% url subscribe podcast_id as subscribe-url %}
94 {% 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="{{ subscribe-url }}">subscribe to the podcast</a> and mark your subscription as private.{% endblocktrans %}
95 {% else %}
96 {% if subscription_meta.public %}
97 {% url podcast podast_id as podcast-url %}
98 {%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-url }}">podcast page</a> and mark your subscription as private.{% endblocktrans %}
99 {% else %}
100 {% 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-url }}">podcast page</a>. You can change that there, if you want.{% endblocktrans %}
101 {% endif %}
102 {% endif %}
103 </div>
105 <table class="list">
106 <tr>
107 <th></th>
108 <th>{% trans "Ad?" %}</th>
109 <th>{% trans "Label" %}</th>
110 <th></td>
111 </tr>
113 {% for chapter in chapters %}
114 <tr {% if chapter.user == user %}class="own-chapter"{% endif %} >
115 <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>
116 <td>{% if chapter.advertisement %}Yes{% endif %}</td>
117 <td>{{ chapter.label }}</strong>
118 <td>
119 {% if chapter.user == user %}
120 <a href="{% url remove-chapter episode.id chapter.id %}">
121 <img src="/media/unsubscribe.png" alt="{% trans "Remove" %}" />
122 </a>
123 {% endif %}
124 </td>
125 </tr>
126 {% endfor %}
127 <tr>
128 <form action="{% url add-chapter episode.id %}" method="POST">
129 {% csrf_token %}
130 <td>
131 <input type="text" name="start" id="start" class="time" /> -
132 <input type="text" name="end" id="end" class="time" />
133 </td>
134 <td>
135 <input type="checkbox" name="advertisement" />
136 </td>
137 <td>
138 <input type="text" name="label" />
139 </td>
140 <td>
141 <input type="submit" value="{% trans "Add" %}" />
142 </td>
143 </form>
144 </tr>
145 </table>
146 {% endif %}
148 {% if history %}
149 <h2>{% trans "History" %}</h2>
150 <table class="list">
151 <tr>
152 <th>{% trans "Time" %}</th>
153 <th>{% trans "Action" %}</th>
154 <th>{% trans "Device" %}</th>
155 <th></th>
156 </tr>
158 {% for s in history %}
159 <tr>
160 <td><abbr title="{{ s.timestamp }}">{{ s.timestamp|naturalday }}</abbr></td>
161 <td style="text-align: center;">{{ s|episode_status_icon }}</td>
162 <td>
163 {% if s.device %}
164 <a href="{% url device s.device.id %}">{{ s.device|device_icon }} {{ s.device.name|striptags }}</a>
165 {% endif %}
166 </td>
167 <td>{% if s.started %}{{s.started_time|date:"H:m:s" }} - {% endif %}
168 {% if s.playmark %}{{ s.playmark_time|date:"H:m:s" }}{% endif %}
169 </td>
170 </tr>
171 {% endfor %}
172 </table>
173 {% endif %}
175 {% if not episode.title %}
176 <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>
177 {% endif %}
179 {% endblock %}
182 {% block javascript %}
183 <script type="text/javascript">
184 $("#start").watermark("h:mm:ss", {className: 'watermark'});
185 $("#end").watermark("h:mm:ss", {className: 'watermark'});
187 {% if episode.url|is_youtube_video %}
188 {{ episode|embed_youtube_video:user }}
189 {% endif %}
191 </script>
192 {% endblock javascript %}