Off by one error.
[audio.git] / src / archive / templates / archive / file_managed.html
1 {% extends "archive/base.html" %}
2 {% load i18n %}
3 {% load tags %}
4 {% load bootstrap4 %}
5
6
7 {% block menu-active-audiobooks %}active{% endblock %}
8
9
10 {% block content %}
11
12
13 {% for alert in alerts %}
14   <div class="mt-4 alert alert-warning">{{ alert }}</div>
15 {% endfor %}
16
17
18
19 <div class="row mt-4">
20   <div class="col-xl-12">
21     <div class="card mt-4">
22       <div class="card-header">
23         <h2>{% if audiobook.slug %}<a href="{% url 'book' audiobook.slug %}" %}">{% endif %}{{ audiobook.title }}{% if audiobook.slug %}</a>{% endif %}</h2>
24       </div>
25       <div class="card-body">
26         <form method='post' action='.'>
27           {% csrf_token %}
28           {% bootstrap_form form layout="horizontal" %}
29           <input class="btn btn-primary" type="submit" value='{% trans "Commit" %}' />
30         </form>
31       </div>
32     </div>
33   </div>
34
35
36 </div>
37
38
39
40
41
42
43
44
45 <div class="row">
46
47
48   <div class="col-xl-8">
49
50
51     <div class="card mt-4">
52       <div class="card-header">
53         <h3>MP3, Ogg</h3>
54       </div>
55       <div class="card-body">
56         {% if audiobook.mp3_status or audiobook.ogg_status or audiobook.youtube_status %}
57           <h2>{% trans "Publishing pending" %}</h2>
58           <form method="post" action="{% url 'cancel_publishing' audiobook.id %}">
59             {% csrf_token %}
60             <input class='btn btn-danger' type="submit" value="{% trans "Cancel publishing" %}" />
61           </form>
62         {% endif %}
63
64
65         {% if audiobook.mp3_status %}
66           <hr/>
67           <h2>MP3</h2>
68
69           <p>Status: <b>{{ audiobook.get_mp3_status_display }}</b></p>
70         {% endif %}
71
72         {% if audiobook.ogg_status %}
73           <hr/>
74           <h2>Ogg Vorbis</h2>
75
76           <p>Status: <b>{{ audiobook.get_ogg_status_display }}</b></p>
77         {% endif %}
78
79
80         {% if audiobook.mp3_file %}
81           <p><a href="{% url 'download' audiobook.id 'mp3' %}">{% trans "Download MP3 file." %}</a></p>
82           {% if audiobook.mp3_published %}
83             <p>{% trans "Published:" %} {{ audiobook.mp3_published }}</a></p>
84           {% else %}
85             <p>{% trans "Not published yet." %}</p>
86           {% endif %}
87         {% else %}
88           <p>{% trans "MP3 file hasn't been generated yet." %}</p>
89         {% endif %}
90
91         {% if audiobook.ogg_file %}
92           <p><a href="{% url 'download' audiobook.id 'ogg' %}">{% trans "Download Ogg Vorbis file." %}</a></p>
93           {% if audiobook.ogg_published %}
94             <p>{% trans "Published:" %} {{ audiobook.ogg_published }}</a></p>
95           {% else %}
96             <p>{% trans "Not published yet." %}</p>
97           {% endif %}
98         {% else %}
99           <p>{% trans "Ogg Vorbis file hasn't been generated yet." %}</p>
100         {% endif %}
101
102         {% if user_can_publish %}
103           <form method="post" action="{% url 'publish' audiobook.id %}">
104             {% csrf_token %}
105             <input class="btn btn-primary" type="submit" value="{% trans "Publish" %}" />
106           </form>
107         {% else %}
108           <a class="btn btn-primary" href="{% url 'apiclient_oauth' %}">Podłącz się</a>
109         {% endif %}
110
111         {% if not audiobook.mp3_published or not audiobook.ogg_published %}
112           <form class="mt-3" method="post" action="{% url 'convert' audiobook.id %}">
113             {% csrf_token %}
114             <input class="btn btn-secondary" type="submit" value="{% trans "Convert without publishing" %}" />
115           </form>
116         {% endif %}
117
118
119       </div>
120     </div>
121
122
123
124     <div class="card mt-4">
125       <div class="card-header">
126         <h3>Metadane dla MP3, Ogg</h3>
127       </div>
128       <div class="card-body">
129         <table class='table'>
130           tagi, które zostałyby zapisane do pliku, gdyby go teraz opublikować
131           {% tags_table audiobook.new_publish_tags 0 %}
132         </table>
133       </div>
134     </div>
135
136   </div>
137
138
139   <div class="col-xl-4">
140     <div class="card mt-4">
141       <div class="card-header">
142         <h3>
143           YouTube
144           {% if audiobook.youtube_status %}
145             <span class="badge badge-pill badge-primary">{{ audiobook.get_youtube_status_display }}</span>
146           {% endif %}
147         </h3>
148       </div>
149       <div class="card-body">
150         <img src="{% url 'youtube_thumbnail' audiobook.id %}" style="width:100%">
151         <strong>{{ youtube_title }}</strong><br><br>
152         {{ youtube_description|linebreaksbr }}
153
154
155
156         {% if audiobook.is_youtube_publishable %}
157           <br>
158           <p>
159             <a href="{% url 'youtube_preview' audiobook.id %}">
160               {% trans "Preview YouTube metadata" %}
161             </a>
162           </p>
163
164         {% endif %}
165
166         {% if audiobook.youtube_id %}
167           <form method="post" action="{% url 'youtube_update_thumbnail' audiobook.id %}">
168             {% csrf_token %}
169             <input class="btn btn-secondary" type="submit" value="{% trans "Update YouTube thumbnail" %}">
170           </form>
171           <br>
172
173           <form method="post" action="{% url 'youtube_update' audiobook.id %}">
174             {% csrf_token %}
175             <input class="btn btn-secondary" type="submit" value="{% trans "Update YouTube metadata" %}">
176           </form>
177         {% endif %}
178         <form method="post" action="{% url 'youtube_publish' audiobook.id %}">
179           {% csrf_token %}
180           <input class="btn btn-primary" type="submit" value="{% trans "Publish on YouTube" %}" />
181         </form>
182
183       </div>
184       <div class="card-footer">
185         {% if audiobook.youtube_id %}
186           <p>
187             <a href="https://youtu.be/{{ audiobook.youtube_id }}" target="_blank" title="{% trans "See on YouTube" %}">
188               <img src="https://i.ytimg.com/vi/{{ audiobook.youtube_id }}/hq720.jpg" style="width: 100%">
189             </a>
190           </p>
191         {% endif %}
192         <p>{% trans "Published:" %} {{ audiobook.youtube_published }}</a></p>
193
194       </div>
195     </div>
196   </div>
197
198
199 </div>
200
201
202
203
204
205 <div class="card mt-4 mb-4">
206   <div class="card-header">
207     <h2>Plik źródłowy</h2>
208     (informacje fizycznie ze źródłowego pliku)
209   </div>
210   <div class="card-body">
211
212     <div class="row">
213       <div class="col-lg-8">
214
215         <p>Last modified: {{ audiobook.modified }}</p>
216         <p>Plik źródłowy: <a href='{{ audiobook.source_file.url }}'>{{ path }}</a>
217           (sha1: <tt>{{ audiobook.source_sha1 }}</tt>).
218         </p>
219         {% multiple_tags_table tags %}
220       </div>
221
222       <div class="col-xl-4">
223         <div class="card">
224           <div class="card-body">
225             <form method="post" action="{% url 'remove_to_archive' audiobook.id %}"
226                   onsubmit='return confirm("{% trans "Are you sure you want to move this audiobook to archive?" %}")'>
227               {% csrf_token %}
228
229               <p>
230                 Jeśli ten plik nie jest potrzebny, możesz usunąć informacje o nim z systemu,
231                 zachowując go tylko w postaci samego źródłowego pliku.
232               </p>
233
234               <input class="btn btn-danger" type="submit" value="{% trans "Remove to archive" %}" />
235             </form>
236           </div>
237         </div>
238       </div>
239     </div>
240   </div>
241 </div>
242
243
244 {% endblock %}