fixes #2136: allow converting without publication
authorRadek Czajka <radoslaw.czajka@nowoczesnapolska.org.pl>
Wed, 11 Jul 2012 13:53:46 +0000 (15:53 +0200)
committerRadek Czajka <radoslaw.czajka@nowoczesnapolska.org.pl>
Wed, 11 Jul 2012 13:53:46 +0000 (15:53 +0200)
apps/archive/constants.py [changed mode: 0755->0644]
apps/archive/forms.py [changed mode: 0755->0644]
apps/archive/locale/pl/LC_MESSAGES/django.mo
apps/archive/locale/pl/LC_MESSAGES/django.po
apps/archive/settings.py [changed mode: 0755->0644]
apps/archive/tasks.py [changed mode: 0755->0644]
apps/archive/templates/archive/file_managed.html
apps/archive/urls.py
apps/archive/utils.py [changed mode: 0755->0644]
apps/archive/views.py
requirements.txt

old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
index b2b15bd..319973a 100644 (file)
Binary files a/apps/archive/locale/pl/LC_MESSAGES/django.mo and b/apps/archive/locale/pl/LC_MESSAGES/django.mo differ
index 1d56bfe..526b07d 100644 (file)
@@ -7,8 +7,8 @@ msgid ""
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2011-10-26 12:56+0200\n"
-"PO-Revision-Date: 2011-10-26 12:57+0100\n"
+"POT-Creation-Date: 2012-07-11 15:51+0200\n"
+"PO-Revision-Date: 2012-07-11 15:52+0100\n"
 "Last-Translator: Radek Czajka <radoslaw.czajka@nowoczesnapolska.org.pl>\n"
 "Language-Team: LANGUAGE <LL@li.org>\n"
 "Language: \n"
@@ -127,24 +127,62 @@ msgstr "Czeka na publikację"
 msgid "Cancel publishing"
 msgstr "Anuluj publikację"
 
-#: templates/archive/file_managed.html:50
+#: templates/archive/file_managed.html:51
 msgid "Publish"
 msgstr "Opublikuj"
 
-#: templates/archive/file_managed.html:79
+#: templates/archive/file_managed.html:57
+msgid "Convert without publishing"
+msgstr "Konwertuj bez publikacji"
+
+#: templates/archive/file_managed.html:67
+msgid "MP3 file"
+msgstr "Plik MP3"
+
+#: templates/archive/file_managed.html:68
+msgid "Download MP3 file."
+msgstr "Pobierz plik MP3."
+
+#: templates/archive/file_managed.html:70
+#: templates/archive/file_managed.html:84
+msgid "Published:"
+msgstr "Opublikowano:"
+
+#: templates/archive/file_managed.html:73
+#: templates/archive/file_managed.html:87
+msgid "Not published yet."
+msgstr "Nie opublikowane."
+
+#: templates/archive/file_managed.html:76
+msgid "MP3 file hasn't been generated yet."
+msgstr "Plik MP3 nie został jeszcze wygenerowany."
+
+#: templates/archive/file_managed.html:81
+msgid "Ogg Vorbis file"
+msgstr "Plik Ogg Vorbis"
+
+#: templates/archive/file_managed.html:82
+msgid "Download Ogg Vorbis file."
+msgstr "Pobierz plik Ogg Vorbis."
+
+#: templates/archive/file_managed.html:90
+msgid "Ogg Vorbis file hasn't been generated yet."
+msgstr "Plik Ogg Vorbis nie został jeszcze wygenerowany."
+
+#: templates/archive/file_managed.html:101
 msgid "Update tags"
 msgstr "Uaktualnij tagi"
 
-#: templates/archive/file_managed.html:91
+#: templates/archive/file_managed.html:113
 #: templates/archive/file_new.html:19
 msgid "Commit"
 msgstr "Zatwierdź"
 
-#: templates/archive/file_managed.html:102
+#: templates/archive/file_managed.html:124
 msgid "Are you sure you want to move this audiobook to archive?"
 msgstr "Czy na pewno chcesz przenieść ten plik to archiwum?"
 
-#: templates/archive/file_managed.html:104
+#: templates/archive/file_managed.html:126
 msgid "Remove to archive"
 msgstr "Usuń do archiwum"
 
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
index bbabe6c..ae73930
@@ -91,7 +91,7 @@ class AudioFormatTask(Task):
         except SystemExit, e:
             raise cls.RemoteOperationError
 
-    def run(self, aid):
+    def run(self, aid, publish=True):
         aid = int(aid)
         audiobook = Audiobook.objects.get(id=aid)
         self.set_status(aid, status.ENCODING)
@@ -110,11 +110,13 @@ class AudioFormatTask(Task):
         self.set_status(aid, status.TAGGING)
         self.set_tags(audiobook, out_file.name)
         self.set_status(aid, status.SENDING)
-
-        self.put(audiobook, out_file.name)
-
         self.save(audiobook, out_file.name)
-        self.published(aid)
+
+        if publish:
+            self.put(audiobook, out_file.name)
+            self.published(aid)
+        else:
+            self.set_status(aid, None)
 
     def on_failure(self, exc, task_id, args, kwargs, einfo):
         aid = (args[0], kwargs.get('aid'))[0]
index db8e4f6..5a54adb 100755 (executable)
 
 
 {% else %}
-    <form method="post" action="{% url publish audiobook.id %}">
     <table class='tags'>
         {% tags_table audiobook.new_publish_tags 0 %}
+        <tr><th></th><td>
 
-        {% csrf_token %}
-        <tr><th></th><td><input type="submit" value="{% trans "Publish" %}" /></td></tr>
+            <form method="post" action="{% url publish audiobook.id %}">
+                {% csrf_token %}
+                <input type="submit" value="{% trans "Publish" %}" />
+            </form>
+
+            {% if not audiobook.mp3_published or not audiobook.ogg_published %}
+            <form method="post" action="{% url convert audiobook.id %}">
+                {% csrf_token %}
+                <input type="submit" value="{% trans "Convert without publishing" %}" />
+            </form>
+            {% endif %}
+
+        </td></tr>
     </table>
-    </form>
 {% endif %}
 
 <hr/>
-{% if audiobook.mp3_published %}
-    <h2>Published MP3</h2>
-    <a href="{{ audiobook.mp3_file.url }}">{{ audiobook.mp3_published }}</a>
-    {% tags_table audiobook.mp3_published_tags.tags %}
-{% else %}<p>MP3 file hasn't been published yet.</p>
+{% if audiobook.mp3_file %}
+    <h2>{% trans "MP3 file" %}</h2>
+    <p><a href="{{ audiobook.mp3_file.url }}">{% trans "Download MP3 file." %}</a></p>
+    {% if audiobook.mp3_published %}
+        <p>{% trans "Published:" %} {{ audiobook.mp3_published }}</a></p>
+        {% tags_table audiobook.mp3_published_tags.tags %}
+    {% else %}
+        <p>{% trans "Not published yet." %}</p>
+    {% endif %}
+{% else %}
+    <p>{% trans "MP3 file hasn't been generated yet." %}</p>
 {% endif %}
 
 <hr/>
-{% if audiobook.ogg_published %}
-    <h2>Published Ogg Vorbis</h2>
-    <a href="{{ audiobook.ogg_file.url }}">{{ audiobook.ogg_published }}</a>
-    {% tags_table audiobook.ogg_published_tags.tags %}
-{% else %}Ogg Vorbis file hasn't been published yet.
+{% if audiobook.ogg_file %}
+    <h2>{% trans "Ogg Vorbis file" %}</h2>
+    <p><a href="{{ audiobook.ogg_file.url }}">{% trans "Download Ogg Vorbis file." %}</a></p>
+    {% if audiobook.ogg_published %}
+        <p>{% trans "Published:" %} {{ audiobook.ogg_published }}</a></p>
+        {% tags_table audiobook.ogg_published_tags.tags %}
+    {% else %}
+        <p>{% trans "Not published yet." %}</p>
+    {% endif %}
+{% else %}
+    <p>{% trans "Ogg Vorbis file hasn't been generated yet." %}</p>
 {% endif %}
 
 
index 3889949..3f7839a 100644 (file)
@@ -12,6 +12,7 @@ urlpatterns = patterns('',
     url(r'^published/$', 'archive.views.list_published', name="list_published"),
     url(r'^file/(\d+)/$', 'archive.views.file_managed', name="file"),
     url(r'^publish/(\d+)/$', 'archive.views.publish', name="publish"),
+    url(r'^convert/(\d+)/$', 'archive.views.publish', {'publish': False}, name="convert"),
     url(r'^cancel/(\d+)/$', 'archive.views.cancel_publishing', name="cancel_publishing"),
     url(r'^remove_to_archive/(\d+)/$', 'archive.views.remove_to_archive', name="remove_to_archive"),
 
old mode 100755 (executable)
new mode 100644 (file)
index 59239d2..369e7e4 100644 (file)
@@ -151,7 +151,7 @@ def move_to_new(request, filename):
 
 @require_POST
 @permission_required('archive.change_audiobook')
-def publish(request, aid):
+def publish(request, aid, publish=True):
     """ mark file for publishing """
     audiobook = get_object_or_404(models.Audiobook, id=aid)
     tags = {
@@ -164,8 +164,8 @@ def publish(request, aid):
     audiobook.mp3_status = audiobook.ogg_status = status.WAITING
     audiobook.save()
     # isn't there a race here?
-    audiobook.mp3_task = tasks.Mp3Task.delay(aid).task_id
-    audiobook.ogg_task = tasks.OggTask.delay(aid).task_id
+    audiobook.mp3_task = tasks.Mp3Task.delay(aid, publish).task_id
+    audiobook.ogg_task = tasks.OggTask.delay(aid, publish).task_id
     audiobook.save()
 
     return redirect(file_managed, aid)
index 034bd1a..66a8fd8 100644 (file)
@@ -1,4 +1,4 @@
-django>=1.3
+django>=1.3,<1.4
 django-jsonfield
 South>=0.7
 django-cas