From: Radek Czajka Date: Wed, 11 Jul 2012 13:53:46 +0000 (+0200) Subject: fixes #2136: allow converting without publication X-Git-Url: https://git.mdrn.pl/audio.git/commitdiff_plain/c175a7540d20336179dfd453183bfe69e6f5827e?ds=sidebyside fixes #2136: allow converting without publication --- diff --git a/apps/archive/constants.py b/apps/archive/constants.py old mode 100755 new mode 100644 diff --git a/apps/archive/forms.py b/apps/archive/forms.py old mode 100755 new mode 100644 diff --git a/apps/archive/locale/pl/LC_MESSAGES/django.mo b/apps/archive/locale/pl/LC_MESSAGES/django.mo index b2b15bd..319973a 100644 Binary files a/apps/archive/locale/pl/LC_MESSAGES/django.mo and b/apps/archive/locale/pl/LC_MESSAGES/django.mo differ diff --git a/apps/archive/locale/pl/LC_MESSAGES/django.po b/apps/archive/locale/pl/LC_MESSAGES/django.po index 1d56bfe..526b07d 100644 --- a/apps/archive/locale/pl/LC_MESSAGES/django.po +++ b/apps/archive/locale/pl/LC_MESSAGES/django.po @@ -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 \n" "Language-Team: LANGUAGE \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" diff --git a/apps/archive/settings.py b/apps/archive/settings.py old mode 100755 new mode 100644 diff --git a/apps/archive/tasks.py b/apps/archive/tasks.py old mode 100755 new mode 100644 index bbabe6c..ae73930 --- a/apps/archive/tasks.py +++ b/apps/archive/tasks.py @@ -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] diff --git a/apps/archive/templates/archive/file_managed.html b/apps/archive/templates/archive/file_managed.html index db8e4f6..5a54adb 100755 --- a/apps/archive/templates/archive/file_managed.html +++ b/apps/archive/templates/archive/file_managed.html @@ -42,30 +42,52 @@ {% else %} -
{% tags_table audiobook.new_publish_tags 0 %} + + + {% csrf_token %} + + + + {% if not audiobook.mp3_published or not audiobook.ogg_published %} + + {% csrf_token %} + + + {% endif %} + +
- {% csrf_token %} -
- {% endif %}
-{% if audiobook.mp3_published %} -

Published MP3

- {{ audiobook.mp3_published }} - {% tags_table audiobook.mp3_published_tags.tags %} -{% else %}

MP3 file hasn't been published yet.

+{% if audiobook.mp3_file %} +

{% trans "MP3 file" %}

+

{% trans "Download MP3 file." %}

+ {% if audiobook.mp3_published %} +

{% trans "Published:" %} {{ audiobook.mp3_published }}

+ {% tags_table audiobook.mp3_published_tags.tags %} + {% else %} +

{% trans "Not published yet." %}

+ {% endif %} +{% else %} +

{% trans "MP3 file hasn't been generated yet." %}

{% endif %}
-{% if audiobook.ogg_published %} -

Published Ogg Vorbis

- {{ audiobook.ogg_published }} - {% tags_table audiobook.ogg_published_tags.tags %} -{% else %}Ogg Vorbis file hasn't been published yet. +{% if audiobook.ogg_file %} +

{% trans "Ogg Vorbis file" %}

+

{% trans "Download Ogg Vorbis file." %}

+ {% if audiobook.ogg_published %} +

{% trans "Published:" %} {{ audiobook.ogg_published }}

+ {% tags_table audiobook.ogg_published_tags.tags %} + {% else %} +

{% trans "Not published yet." %}

+ {% endif %} +{% else %} +

{% trans "Ogg Vorbis file hasn't been generated yet." %}

{% endif %} diff --git a/apps/archive/urls.py b/apps/archive/urls.py index 3889949..3f7839a 100644 --- a/apps/archive/urls.py +++ b/apps/archive/urls.py @@ -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"), diff --git a/apps/archive/utils.py b/apps/archive/utils.py old mode 100755 new mode 100644 diff --git a/apps/archive/views.py b/apps/archive/views.py index 59239d2..369e7e4 100644 --- a/apps/archive/views.py +++ b/apps/archive/views.py @@ -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) diff --git a/requirements.txt b/requirements.txt index 034bd1a..66a8fd8 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -django>=1.3 +django>=1.3,<1.4 django-jsonfield South>=0.7 django-cas