From 6b9d2a8ea0a58826f0f30f135a3f7d065b3bb435 Mon Sep 17 00:00:00 2001 From: Jan Szejko Date: Fri, 2 Mar 2018 09:42:42 +0100 Subject: [PATCH 1/1] new fields: part name, index, parts count --- apps/archive/locale/pl/LC_MESSAGES/django.mo | Bin 3268 -> 3478 bytes apps/archive/locale/pl/LC_MESSAGES/django.po | 84 ++++++++++-------- ...name__add_field_audiobook_index__add_fi.py | 77 ++++++++++++++++ apps/archive/models.py | 4 + apps/archive/tasks.py | 7 +- requirements.txt | 2 +- 6 files changed, 136 insertions(+), 38 deletions(-) create mode 100644 apps/archive/migrations/0005_auto__add_field_audiobook_part_name__add_field_audiobook_index__add_fi.py diff --git a/apps/archive/locale/pl/LC_MESSAGES/django.mo b/apps/archive/locale/pl/LC_MESSAGES/django.mo index 319973adffc38969c8ba1073c19a61900b2e158a..e1135bf37dc7b8bef03745b30affa6f0daff4129 100644 GIT binary patch delta 1424 zcmYk+T}YEr9LMpa&CIvb^Ht<}(*P_ziW#403~+!zEbHmkJO-t!*!AVf#@5j-c*~ViWeE=DCMj z_#-UA5!Aw;VJY#=>wLqQNz_DNP%E871+3<2P0;8XK#g}`8Ft|cJnHrx|e!1gCbaa0e>iKGX z&T%$i1^tgqLeqT5?Kq1$?KHsM7IvXB5JOFnJMQ6@1rIfM+JP3<@gn=@ds*Wl?)Qw)M5Um zLSnjEcq*HyxvgBZBb7p`7Qv?S>21VT>Yt*N=_lDt)w$|-uNPKDY2HTN zpbkY@P*GO5Q1zeje`%QSoG>jk>Zv+6i>kD!w9R8Sx&~42#2TtH!aCY=Y{+3uYobCSCAG}f?{0$2lmc9T0 delta 1207 zcmY+@Ur1A77{~D^J?7>%TeGZbf0q4q=F+Vo2qGf!CIg8gqL7-ab+bYwT2LoQD2gbW zc~RI+cX?@0P!|b7cX-i#xgeIZQP3wa23vC8_wfO{EN#m(y-K?zy$SfOyU6y;Yr+V z=3AZ{es+tC9=wO@FphMvNnC+5s04GUxqU%R>>Db0^b9rL3)lV{Iidf`R%&&G zCKA{A?33))3!@*4@2ETKi| zUGnuQ>ATk(+)3yK3ElzRMyP1ZwVgdg7x8b&QPGa6=uGv(brb6el?_V-yQ142gpO9b zx5;e!gZHT}T*_Y@E)1v6mMgy-Z&aRyqF!%TPj>odXxxik8o63NpGl1t^2Ji7l8@yU E0bA!??f?J) diff --git a/apps/archive/locale/pl/LC_MESSAGES/django.po b/apps/archive/locale/pl/LC_MESSAGES/django.po index 526b07d..317ab76 100644 --- a/apps/archive/locale/pl/LC_MESSAGES/django.po +++ b/apps/archive/locale/pl/LC_MESSAGES/django.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2012-07-11 15:51+0200\n" +"POT-Creation-Date: 2018-03-02 09:36+0100\n" "PO-Revision-Date: 2012-07-11 15:52+0100\n" "Last-Translator: Radek Czajka \n" "Language-Team: LANGUAGE \n" @@ -15,7 +15,8 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2)\n" +"Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 " +"|| n%100>=20) ? 1 : 2)\n" #: constants.py:10 msgid "Waiting" @@ -33,52 +34,67 @@ msgstr "Opisywanie" msgid "Sending" msgstr "Wysyłanie" -#: models.py:21 -#: models.py:43 +#: models.py:23 models.py:49 msgid "project" msgstr "projekt" -#: models.py:22 +#: models.py:24 msgid "projects" msgstr "projekty" -#: models.py:35 +#: models.py:37 msgid "source file" msgstr "plik źródłowy" -#: models.py:38 +#: models.py:40 msgid "title" msgstr "tytuł" -#: models.py:39 +#: models.py:41 +msgid "part name" +msgstr "nazwa części" + +#: models.py:41 +msgid "eg. chapter in a novel" +msgstr "np. rozdział w powieści" + +#: models.py:43 +msgid "index" +msgstr "numer" + +#: models.py:44 +msgid "parts count" +msgstr "liczba części" + +#: models.py:45 msgid "artist" msgstr "lektor" -#: models.py:40 +#: models.py:46 msgid "conductor" msgstr "reżyser" -#: models.py:41 +#: models.py:47 msgid "encoded by" msgstr "przyg. techn." -#: models.py:42 +#: models.py:48 msgid "date" msgstr "data" -#: models.py:44 +#: models.py:50 msgid "book url" msgstr "URL książki" -#: models.py:45 +#: models.py:51 msgid "translator" msgstr "tłumacz" -#: models.py:65 +#: models.py:71 msgid "audiobook" msgstr "audiobook" -#: models.py:66 +#: models.py:72 msgid "audiobooks" msgstr "audiobooki" @@ -94,8 +110,7 @@ msgstr "Nowe" msgid "Unpublished" msgstr "Nie opublikowane" -#: templates/archive/base.html:7 -#: templates/archive/file_managed.html:11 +#: templates/archive/base.html:7 templates/archive/file_managed.html:11 msgid "Publishing" msgstr "Publikacja" @@ -111,11 +126,15 @@ msgstr "Archiwum" msgid "Projects" msgstr "Projekty" -#: templates/archive/base.html:13 +#: templates/archive/base.html:14 msgid "Logout" msgstr "Wyloguj" -#: templates/archive/base.html:15 +#: templates/archive/base.html:16 templates/registration/login.html:9 +msgid "Login" +msgstr "Zaloguj" + +#: templates/archive/base.html:19 msgid "Administration" msgstr "Administracja" @@ -144,45 +163,44 @@ msgid "Download MP3 file." msgstr "Pobierz plik MP3." #: templates/archive/file_managed.html:70 -#: templates/archive/file_managed.html:84 +#: templates/archive/file_managed.html:86 msgid "Published:" msgstr "Opublikowano:" -#: templates/archive/file_managed.html:73 -#: templates/archive/file_managed.html:87 +#: templates/archive/file_managed.html:75 +#: templates/archive/file_managed.html:91 msgid "Not published yet." msgstr "Nie opublikowane." -#: templates/archive/file_managed.html:76 +#: templates/archive/file_managed.html:78 msgid "MP3 file hasn't been generated yet." msgstr "Plik MP3 nie został jeszcze wygenerowany." -#: templates/archive/file_managed.html:81 +#: templates/archive/file_managed.html:83 msgid "Ogg Vorbis file" msgstr "Plik Ogg Vorbis" -#: templates/archive/file_managed.html:82 +#: templates/archive/file_managed.html:84 msgid "Download Ogg Vorbis file." msgstr "Pobierz plik Ogg Vorbis." -#: templates/archive/file_managed.html:90 +#: templates/archive/file_managed.html:94 msgid "Ogg Vorbis file hasn't been generated yet." msgstr "Plik Ogg Vorbis nie został jeszcze wygenerowany." -#: templates/archive/file_managed.html:101 +#: templates/archive/file_managed.html:105 msgid "Update tags" msgstr "Uaktualnij tagi" -#: templates/archive/file_managed.html:113 -#: templates/archive/file_new.html:19 +#: templates/archive/file_managed.html:117 templates/archive/file_new.html:19 msgid "Commit" msgstr "Zatwierdź" -#: templates/archive/file_managed.html:124 +#: templates/archive/file_managed.html:128 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:126 +#: templates/archive/file_managed.html:130 msgid "Remove to archive" msgstr "Usuń do archiwum" @@ -222,10 +240,6 @@ msgstr "Audiobooki archiwalne" msgid "Unpublished audiobooks" msgstr "Nie opublikowane audiobooki" -#: templates/registration/login.html:9 -msgid "Login" -msgstr "Zaloguj" - #~ msgid "arranger" #~ msgstr "aranżer" diff --git a/apps/archive/migrations/0005_auto__add_field_audiobook_part_name__add_field_audiobook_index__add_fi.py b/apps/archive/migrations/0005_auto__add_field_audiobook_part_name__add_field_audiobook_index__add_fi.py new file mode 100644 index 0000000..c163971 --- /dev/null +++ b/apps/archive/migrations/0005_auto__add_field_audiobook_part_name__add_field_audiobook_index__add_fi.py @@ -0,0 +1,77 @@ +# -*- coding: utf-8 -*- +from south.utils import datetime_utils as datetime +from south.db import db +from south.v2 import SchemaMigration +from django.db import models + + +class Migration(SchemaMigration): + + def forwards(self, orm): + # Adding field 'Audiobook.part_name' + db.add_column(u'archive_audiobook', 'part_name', + self.gf('django.db.models.fields.CharField')(default='', max_length=255, blank=True), + keep_default=False) + + # Adding field 'Audiobook.index' + db.add_column(u'archive_audiobook', 'index', + self.gf('django.db.models.fields.IntegerField')(default=0), + keep_default=False) + + # Adding field 'Audiobook.parts_count' + db.add_column(u'archive_audiobook', 'parts_count', + self.gf('django.db.models.fields.IntegerField')(default=1), + keep_default=False) + + + def backwards(self, orm): + # Deleting field 'Audiobook.part_name' + db.delete_column(u'archive_audiobook', 'part_name') + + # Deleting field 'Audiobook.index' + db.delete_column(u'archive_audiobook', 'index') + + # Deleting field 'Audiobook.parts_count' + db.delete_column(u'archive_audiobook', 'parts_count') + + + models = { + u'archive.audiobook': { + 'Meta': {'ordering': "('title',)", 'object_name': 'Audiobook'}, + 'artist': ('django.db.models.fields.CharField', [], {'max_length': '255'}), + 'conductor': ('django.db.models.fields.CharField', [], {'max_length': '255'}), + 'date': ('django.db.models.fields.CharField', [], {'max_length': '255'}), + 'encoded_by': ('django.db.models.fields.CharField', [], {'max_length': '255'}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'index': ('django.db.models.fields.IntegerField', [], {'default': '0'}), + 'modified': ('django.db.models.fields.DateTimeField', [], {'null': 'True'}), + 'mp3_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'null': 'True'}), + 'mp3_published': ('django.db.models.fields.DateTimeField', [], {'null': 'True'}), + 'mp3_published_tags': ('jsonfield.fields.JSONField', [], {'null': 'True'}), + 'mp3_status': ('django.db.models.fields.SmallIntegerField', [], {'null': 'True'}), + 'mp3_tags': ('jsonfield.fields.JSONField', [], {'null': 'True'}), + 'mp3_task': ('django.db.models.fields.CharField', [], {'max_length': '64', 'null': 'True'}), + 'ogg_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'null': 'True'}), + 'ogg_published': ('django.db.models.fields.DateTimeField', [], {'null': 'True'}), + 'ogg_published_tags': ('jsonfield.fields.JSONField', [], {'null': 'True'}), + 'ogg_status': ('django.db.models.fields.SmallIntegerField', [], {'null': 'True'}), + 'ogg_tags': ('jsonfield.fields.JSONField', [], {'null': 'True'}), + 'ogg_task': ('django.db.models.fields.CharField', [], {'max_length': '64', 'null': 'True'}), + 'part_name': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '255', 'blank': 'True'}), + 'parts_count': ('django.db.models.fields.IntegerField', [], {'default': '1'}), + 'project': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['archive.Project']"}), + 'source_file': ('django.db.models.fields.files.FileField', [], {'max_length': '255'}), + 'source_sha1': ('django.db.models.fields.CharField', [], {'max_length': '40'}), + 'title': ('django.db.models.fields.CharField', [], {'max_length': '255'}), + 'translator': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}), + 'url': ('django.db.models.fields.URLField', [], {'max_length': '255'}) + }, + u'archive.project': { + 'Meta': {'ordering': "('name',)", 'object_name': 'Project'}, + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '128', 'db_index': 'True'}), + 'sponsors': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}) + } + } + + complete_apps = ['archive'] \ No newline at end of file diff --git a/apps/archive/models.py b/apps/archive/models.py index a78eb52..c75a874 100644 --- a/apps/archive/models.py +++ b/apps/archive/models.py @@ -38,6 +38,10 @@ class Audiobook(models.Model): source_sha1 = models.CharField(max_length=40, editable=False) title = models.CharField(max_length=255, verbose_name=_('title')) + part_name = models.CharField(max_length=255, verbose_name=_('part name'), help_text=_('eg. chapter in a novel'), + default='', blank=True) + index = models.IntegerField(verbose_name=_('index'), default=0) + parts_count = models.IntegerField(verbose_name=_('parts count'), default=1) artist = models.CharField(max_length=255, verbose_name=_('artist')) conductor = models.CharField(max_length=255, verbose_name=_('conductor')) encoded_by = models.CharField(max_length=255, verbose_name=_('encoded by')) diff --git a/apps/archive/tasks.py b/apps/archive/tasks.py index d9c3f5e..a46b79c 100644 --- a/apps/archive/tasks.py +++ b/apps/archive/tasks.py @@ -81,10 +81,13 @@ class AudioFormatTask(Task): tags = getattr(audiobook, "%s_tags" % cls.ext) prefix, slug = tags['url'].rstrip('/').rsplit('/', 1) name = tags['name'] - command = UPLOAD_CMD + (u' %s %s %s > output.txt' % ( + command = UPLOAD_CMD + (u' %s %s %s %s %s %s > output.txt' % ( pipes.quote(os.path.join(UPLOAD_PATH, os.path.basename(path))), pipes.quote(slug), - pipes.quote(name) + pipes.quote(name), + pipes.quote(audiobook.part_name), + audiobook.index, + audiobook.parts_count, )).encode('utf-8') try: api.put(path, UPLOAD_PATH) diff --git a/requirements.txt b/requirements.txt index c6905f9..90ae1d3 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,7 +1,7 @@ -i https://py.mdrn.pl:8443/simple django>=1.5,<1.6 -django-jsonfield +django-jsonfield==0.9.10 South>=0.7 django-cas==2.1.1.1 -- 2.20.1