Move to Redis broker by default, since support for ORM broker is sketchy now.
-i https://py.mdrn.pl:8443/simple
-django>=1.5,<1.6
-django-jsonfield==0.9.10
-South>=0.7
+django>=1.11,<2.0
+jsonfield==2.0.2
django-cas==2.1.1.1
-django-celery
-django-kombu
+celery[redis]==4.2
+kombu
+redis
+vine
paramiko>=1.7.7.1 # fabric dependency with http://code.fabfile.org/issues/show/214 fixed
-fabric>=1.0
+fabric>=1.0,<2
mutagen
class AudiobookForm(forms.ModelForm):
class Meta:
model = Audiobook
+ exclude = []
def save(self, commit=True, path=None):
""" Performs normal save, with given file as an source audiobook.
-# encoding: utf-8
-import datetime
-from south.db import db
-from south.v2 import SchemaMigration
-from django.db import models
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
-class Migration(SchemaMigration):
+from django.db import models, migrations
+import archive.utils
+import jsonfield.fields
+import archive.models
- def forwards(self, orm):
-
- # Adding model 'Project'
- db.create_table('archive_project', (
- ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
- ('name', self.gf('django.db.models.fields.CharField')(unique=True, max_length=128, db_index=True)),
- ('sponsors', self.gf('django.db.models.fields.TextField')(null=True, blank=True)),
- ))
- db.send_create_signal('archive', ['Project'])
- # Adding model 'Audiobook'
- db.create_table('archive_audiobook', (
- ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
- ('source_file', self.gf('django.db.models.fields.files.FileField')(max_length=100)),
- ('title', self.gf('django.db.models.fields.CharField')(max_length=255)),
- ('artist', self.gf('django.db.models.fields.CharField')(max_length=255)),
- ('conductor', self.gf('django.db.models.fields.CharField')(max_length=255)),
- ('encoded_by', self.gf('django.db.models.fields.CharField')(max_length=255)),
- ('date', self.gf('django.db.models.fields.CharField')(max_length=255)),
- ('project', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['archive.Project'])),
- ('url', self.gf('django.db.models.fields.URLField')(max_length=255)),
- ('modified', self.gf('django.db.models.fields.DateTimeField')(null=True)),
- ('published_tags', self.gf('jsonfield.fields.JSONField')(null=True)),
- ('mp3_file', self.gf('django.db.models.fields.files.FileField')(max_length=100, null=True)),
- ('ogg_file', self.gf('django.db.models.fields.files.FileField')(max_length=100, null=True)),
- ('publishing_tags', self.gf('jsonfield.fields.JSONField')(null=True)),
- ('publish_wait', self.gf('django.db.models.fields.DateTimeField')(null=True)),
- ('publishing', self.gf('django.db.models.fields.BooleanField')(default=False)),
- ('published', self.gf('django.db.models.fields.DateTimeField')(null=True)),
- ))
- db.send_create_signal('archive', ['Audiobook'])
+class Migration(migrations.Migration):
+ dependencies = [
+ ]
- def backwards(self, orm):
-
- # Deleting model 'Project'
- db.delete_table('archive_project')
-
- # Deleting model 'Audiobook'
- db.delete_table('archive_audiobook')
-
-
- models = {
- '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'}),
- 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
- 'modified': ('django.db.models.fields.DateTimeField', [], {'null': 'True'}),
- 'mp3_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'null': 'True'}),
- 'ogg_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'null': 'True'}),
- 'project': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['archive.Project']"}),
- 'publish_wait': ('django.db.models.fields.DateTimeField', [], {'null': 'True'}),
- 'published': ('django.db.models.fields.DateTimeField', [], {'null': 'True'}),
- 'published_tags': ('jsonfield.fields.JSONField', [], {'null': 'True'}),
- 'publishing': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
- 'publishing_tags': ('jsonfield.fields.JSONField', [], {'null': 'True'}),
- 'source_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100'}),
- 'title': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
- 'url': ('django.db.models.fields.URLField', [], {'max_length': '255'})
- },
- 'archive.project': {
- 'Meta': {'ordering': "('name',)", 'object_name': 'Project'},
- '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']
+ operations = [
+ migrations.CreateModel(
+ name='Audiobook',
+ fields=[
+ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
+ ('source_file', models.FileField(verbose_name='source file', max_length=255, editable=False, upload_to=archive.models.source_upload_to)),
+ ('source_sha1', models.CharField(max_length=40, editable=False)),
+ ('title', models.CharField(max_length=255, verbose_name='title')),
+ ('part_name', models.CharField(default=b'', help_text='eg. chapter in a novel', max_length=255, verbose_name='part name', blank=True)),
+ ('index', models.IntegerField(default=0, verbose_name='index')),
+ ('parts_count', models.IntegerField(default=1, verbose_name='parts count')),
+ ('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')),
+ ('date', models.CharField(max_length=255, verbose_name='date')),
+ ('url', models.URLField(max_length=255, verbose_name='book url')),
+ ('translator', models.CharField(max_length=255, null=True, verbose_name='translator', blank=True)),
+ ('modified', models.DateTimeField(null=True, editable=False)),
+ ('mp3_status', models.SmallIntegerField(null=True, editable=False, choices=[(1, 'Waiting'), (2, 'Encoding'), (3, 'Tagging'), (4, 'Sending')])),
+ ('mp3_task', models.CharField(max_length=64, null=True, editable=False)),
+ ('mp3_tags', jsonfield.fields.JSONField(null=True, editable=False)),
+ ('mp3_file', models.FileField(storage=archive.utils.OverwriteStorage(), upload_to=b'archive/final', null=True, editable=False)),
+ ('mp3_published_tags', jsonfield.fields.JSONField(null=True, editable=False)),
+ ('mp3_published', models.DateTimeField(null=True, editable=False)),
+ ('ogg_status', models.SmallIntegerField(null=True, editable=False, choices=[(1, 'Waiting'), (2, 'Encoding'), (3, 'Tagging'), (4, 'Sending')])),
+ ('ogg_task', models.CharField(max_length=64, null=True, editable=False)),
+ ('ogg_tags', jsonfield.fields.JSONField(null=True, editable=False)),
+ ('ogg_file', models.FileField(storage=archive.utils.OverwriteStorage(), upload_to=b'archive/final', null=True, editable=False)),
+ ('ogg_published_tags', jsonfield.fields.JSONField(null=True, editable=False)),
+ ('ogg_published', models.DateTimeField(null=True, editable=False)),
+ ],
+ options={
+ 'ordering': ('title',),
+ 'verbose_name': 'audiobook',
+ 'verbose_name_plural': 'audiobooks',
+ },
+ bases=(models.Model,),
+ ),
+ migrations.CreateModel(
+ name='Project',
+ fields=[
+ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
+ ('name', models.CharField(unique=True, max_length=128, verbose_name=b'Nazwa', db_index=True)),
+ ('sponsors', models.TextField(null=True, verbose_name=b'Sponsorzy', blank=True)),
+ ],
+ options={
+ 'ordering': ('name',),
+ 'verbose_name': 'project',
+ 'verbose_name_plural': 'projects',
+ },
+ bases=(models.Model,),
+ ),
+ migrations.AddField(
+ model_name='audiobook',
+ name='project',
+ field=models.ForeignKey(verbose_name='project', to='archive.Project'),
+ preserve_default=True,
+ ),
+ ]
+++ /dev/null
-# encoding: utf-8
-import datetime
-from south.db import db
-from south.v2 import SchemaMigration
-from django.db import models
-
-class Migration(SchemaMigration):
-
- def forwards(self, orm):
-
- # Deleting field 'Audiobook.publishing_tags'
- db.delete_column('archive_audiobook', 'publishing_tags')
-
- # Deleting field 'Audiobook.published_tags'
- db.delete_column('archive_audiobook', 'published_tags')
-
- # Deleting field 'Audiobook.publish_wait'
- db.delete_column('archive_audiobook', 'publish_wait')
-
- # Deleting field 'Audiobook.published'
- db.delete_column('archive_audiobook', 'published')
-
- # Deleting field 'Audiobook.publishing'
- db.delete_column('archive_audiobook', 'publishing')
-
- # Adding field 'Audiobook.mp3_status'
- db.add_column('archive_audiobook', 'mp3_status', self.gf('django.db.models.fields.SmallIntegerField')(null=True), keep_default=False)
-
- # Adding field 'Audiobook.mp3_task'
- db.add_column('archive_audiobook', 'mp3_task', self.gf('django.db.models.fields.CharField')(max_length=64, null=True), keep_default=False)
-
- # Adding field 'Audiobook.mp3_tags'
- db.add_column('archive_audiobook', 'mp3_tags', self.gf('jsonfield.fields.JSONField')(null=True), keep_default=False)
-
- # Adding field 'Audiobook.mp3_published_tags'
- db.add_column('archive_audiobook', 'mp3_published_tags', self.gf('jsonfield.fields.JSONField')(null=True), keep_default=False)
-
- # Adding field 'Audiobook.mp3_published'
- db.add_column('archive_audiobook', 'mp3_published', self.gf('django.db.models.fields.DateTimeField')(null=True), keep_default=False)
-
- # Adding field 'Audiobook.ogg_status'
- db.add_column('archive_audiobook', 'ogg_status', self.gf('django.db.models.fields.SmallIntegerField')(null=True), keep_default=False)
-
- # Adding field 'Audiobook.ogg_task'
- db.add_column('archive_audiobook', 'ogg_task', self.gf('django.db.models.fields.CharField')(max_length=64, null=True), keep_default=False)
-
- # Adding field 'Audiobook.ogg_tags'
- db.add_column('archive_audiobook', 'ogg_tags', self.gf('jsonfield.fields.JSONField')(null=True), keep_default=False)
-
- # Adding field 'Audiobook.ogg_published_tags'
- db.add_column('archive_audiobook', 'ogg_published_tags', self.gf('jsonfield.fields.JSONField')(null=True), keep_default=False)
-
- # Adding field 'Audiobook.ogg_published'
- db.add_column('archive_audiobook', 'ogg_published', self.gf('django.db.models.fields.DateTimeField')(null=True), keep_default=False)
-
-
- def backwards(self, orm):
-
- # Adding field 'Audiobook.publishing_tags'
- db.add_column('archive_audiobook', 'publishing_tags', self.gf('jsonfield.fields.JSONField')(null=True), keep_default=False)
-
- # Adding field 'Audiobook.published_tags'
- db.add_column('archive_audiobook', 'published_tags', self.gf('jsonfield.fields.JSONField')(null=True), keep_default=False)
-
- # Adding field 'Audiobook.publish_wait'
- db.add_column('archive_audiobook', 'publish_wait', self.gf('django.db.models.fields.DateTimeField')(null=True), keep_default=False)
-
- # Adding field 'Audiobook.published'
- db.add_column('archive_audiobook', 'published', self.gf('django.db.models.fields.DateTimeField')(null=True), keep_default=False)
-
- # Adding field 'Audiobook.publishing'
- db.add_column('archive_audiobook', 'publishing', self.gf('django.db.models.fields.BooleanField')(default=False), keep_default=False)
-
- # Deleting field 'Audiobook.mp3_status'
- db.delete_column('archive_audiobook', 'mp3_status')
-
- # Deleting field 'Audiobook.mp3_task'
- db.delete_column('archive_audiobook', 'mp3_task')
-
- # Deleting field 'Audiobook.mp3_tags'
- db.delete_column('archive_audiobook', 'mp3_tags')
-
- # Deleting field 'Audiobook.mp3_published_tags'
- db.delete_column('archive_audiobook', 'mp3_published_tags')
-
- # Deleting field 'Audiobook.mp3_published'
- db.delete_column('archive_audiobook', 'mp3_published')
-
- # Deleting field 'Audiobook.ogg_status'
- db.delete_column('archive_audiobook', 'ogg_status')
-
- # Deleting field 'Audiobook.ogg_task'
- db.delete_column('archive_audiobook', 'ogg_task')
-
- # Deleting field 'Audiobook.ogg_tags'
- db.delete_column('archive_audiobook', 'ogg_tags')
-
- # Deleting field 'Audiobook.ogg_published_tags'
- db.delete_column('archive_audiobook', 'ogg_published_tags')
-
- # Deleting field 'Audiobook.ogg_published'
- db.delete_column('archive_audiobook', 'ogg_published')
-
-
- models = {
- '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'}),
- 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
- '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'}),
- 'project': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['archive.Project']"}),
- 'source_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100'}),
- 'title': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
- 'url': ('django.db.models.fields.URLField', [], {'max_length': '255'})
- },
- 'archive.project': {
- 'Meta': {'ordering': "('name',)", 'object_name': 'Project'},
- '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']
+++ /dev/null
-# encoding: utf-8
-import datetime
-from hashlib import sha1
-from south.db import db
-from south.v2 import SchemaMigration
-from django.db import models
-
-
-def sha1_file(f):
- sha = sha1()
- for piece in iter(lambda: f.read(1024*1024), ''):
- sha.update(piece)
- return sha.hexdigest()
-
-
-class Migration(SchemaMigration):
-
- def forwards(self, orm):
-
- # Adding field 'Audiobook.source_sha1'
- db.add_column('archive_audiobook', 'source_sha1', self.gf('django.db.models.fields.CharField')(default='', max_length=40), keep_default=False)
-
- # Adding field 'Audiobook.translator'
- db.add_column('archive_audiobook', 'translator', self.gf('django.db.models.fields.CharField')(max_length=255, null=True, blank=True), keep_default=False)
-
- if not db.dry_run:
- for obj in orm.Audiobook.objects.all():
- try:
- f = open(obj.source_file.path)
- except ValueError, e:
- print "Audiobook has no source file"
- pass
- else:
- obj.source_sha1 = sha1_file(f)
- f.close()
- obj.save()
-
-
- def backwards(self, orm):
-
- # Deleting field 'Audiobook.source_sha1'
- db.delete_column('archive_audiobook', 'source_sha1')
-
- # Deleting field 'Audiobook.translator'
- db.delete_column('archive_audiobook', 'translator')
-
-
- models = {
- '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'}),
- 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
- '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'}),
- 'project': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['archive.Project']"}),
- 'source_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100'}),
- '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'})
- },
- 'archive.project': {
- 'Meta': {'ordering': "('name',)", 'object_name': 'Project'},
- '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']
+++ /dev/null
-# encoding: utf-8
-import datetime
-from south.db import db
-from south.v2 import SchemaMigration
-from django.db import models
-
-class Migration(SchemaMigration):
-
- def forwards(self, orm):
-
- # Changing field 'Audiobook.source_file'
- db.alter_column('archive_audiobook', 'source_file', self.gf('django.db.models.fields.files.FileField')(max_length=255))
-
-
- def backwards(self, orm):
-
- # Changing field 'Audiobook.source_file'
- db.alter_column('archive_audiobook', 'source_file', self.gf('django.db.models.fields.files.FileField')(max_length=100))
-
-
- models = {
- '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'}),
- 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
- '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'}),
- 'project': ('django.db.models.fields.related.ForeignKey', [], {'to': "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'})
- },
- 'archive.project': {
- 'Meta': {'ordering': "('name',)", 'object_name': 'Project'},
- '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']
+++ /dev/null
-# -*- 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
FILES_PATH = os.path.abspath(os.path.join(settings.MEDIA_ROOT,
"archive/files"))
-if FILES_PATH.startswith(settings.MEDIA_ROOT):
- FILES_SAVE_PATH = FILES_PATH[len(settings.MEDIA_ROOT):].lstrip('/')
+_media_root = os.path.abspath(settings.MEDIA_ROOT)
+if FILES_PATH.startswith(_media_root):
+ FILES_SAVE_PATH = FILES_PATH[len(_media_root):].lstrip('/')
# here the app keeps the unmanaged (archive) files
else:
api.run(command)
disconnect_all()
- except SystemExit, e:
+ except SystemExit as e:
raise cls.RemoteOperationError
def run(self, aid, publish=True):
{% load i18n %}
{% block repo-zones-nav %}
- <a {% if division = "new" %}class="active" {% endif %}href="{% url 'list_new' %}">{% trans "New" %}</a>
- <a {% if division = "unpublished" %}class="active" {% endif %}href="{% url 'list_unpublished' %}">{% trans "Unpublished" %}</a>
- <a {% if division = "publishing" %}class="active" {% endif %}href="{% url 'list_publishing' %}">{% trans "Publishing" %}</a>
- <a {% if division = "published" %}class="active" {% endif %}href="{% url 'list_published' %}">{% trans "Published" %}</a>
- <a {% if division = "unmanaged" %}class="active" {% endif %}href="{% url 'list_unmanaged' %}">{% trans "Archive" %}</a>
+ <a {% if division == "new" %}class="active" {% endif %}href="{% url 'list_new' %}">{% trans "New" %}</a>
+ <a {% if division == "unpublished" %}class="active" {% endif %}href="{% url 'list_unpublished' %}">{% trans "Unpublished" %}</a>
+ <a {% if division == "publishing" %}class="active" {% endif %}href="{% url 'list_publishing' %}">{% trans "Publishing" %}</a>
+ <a {% if division == "published" %}class="active" {% endif %}href="{% url 'list_published' %}">{% trans "Published" %}</a>
+ <a {% if division == "unmanaged" %}class="active" {% endif %}href="{% url 'list_unmanaged' %}">{% trans "Archive" %}</a>
{% if user.is_staff %}
<a href='{% url "admin:archive_project_changelist" %}'>{% trans "Projects" %}</a>
{% endif %}
{% block file-list %}
{% for file in objects %}
<li>
- <a href='{% url "file_new" file|urlencode %}'>{{ file }}</a>
+ <a href='{% url "file_new" file %}'>{{ file }}</a>
</li>
{% endfor %}
{% endblock %}
{% for file in objects %}
<li>
<a href='{% url "file" file.id %}'>{{ file }}</a>
- ({% if file.mp3_status = k.0 %}MP3{% if file.ogg_status = k.0 %}, {% endif %}{% endif %}{% if file.ogg_status = k.0 %}Ogg{% endif %})
+ ({% if file.mp3_status == k.0 %}MP3{% if file.ogg_status == k.0 %}, {% endif %}{% endif %}{% if file.ogg_status == k.0 %}Ogg{% endif %})
</li>
{% endfor %}
</ul>
{% block file-list %}
{% for file in objects %}
<li>
- <a href='{% url "file_unmanaged" file|urlencode %}'>{{ file }}</a>
+ <a href='{% url "file_unmanaged" file %}'>{{ file }}</a>
</li>
{% endfor %}
{% endblock %}
-{% load i18n %}
+{% load i18n static %}
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
- <link rel="stylesheet" type="text/css" href="{{ STATIC_URL }}style.css?20110808" />
+ <link rel="stylesheet" type="text/css" href="{% static 'style.css' %}" />
<title>{% trans "Audiobook repository" %}</title>
</head>
<body>
-from django.conf.urls import patterns, include, url
+from django.conf.urls import url
from django.views.generic import RedirectView
+from . import views
-urlpatterns = patterns('',
+urlpatterns = [
url(r'^$', RedirectView.as_view(url='new/')),
- url(r'^new/$', 'archive.views.list_new', name="list_new"),
- url(r'^new/(.+)/$', 'archive.views.file_new', name="file_new"),
- url(r'^move_to_archive/(.+)/$', 'archive.views.move_to_archive', name="move_to_archive"),
+ url(r'^new/$', views.list_new, name="list_new"),
+ url(r'^new/(.+)/$', views.file_new, name="file_new"),
+ url(r'^move_to_archive/(.+)/$', views.move_to_archive, name="move_to_archive"),
- url(r'^unpublished/$', 'archive.views.list_unpublished', name="list_unpublished"),
- url(r'^publishing/$', 'archive.views.list_publishing', name="list_publishing"),
- 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'^download/(\d+)/$', 'archive.views.download', name="download"),
- url(r'^download/(\d+)\.(mp3|ogg)$', 'archive.views.download', name="download"),
- 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"),
+ url(r'^unpublished/$', views.list_unpublished, name="list_unpublished"),
+ url(r'^publishing/$', views.list_publishing, name="list_publishing"),
+ url(r'^published/$', views.list_published, name="list_published"),
+ url(r'^file/(\d+)/$', views.file_managed, name="file"),
+ url(r'^publish/(\d+)/$', views.publish, name="publish"),
+ url(r'^convert/(\d+)/$', views.publish, {'publish': False}, name="convert"),
+ url(r'^download/(\d+)/$', views.download, name="download"),
+ url(r'^download/(\d+)\.(mp3|ogg)$', views.download, name="download"),
+ url(r'^cancel/(\d+)/$', views.cancel_publishing, name="cancel_publishing"),
+ url(r'^remove_to_archive/(\d+)/$', views.remove_to_archive, name="remove_to_archive"),
- url(r'^unmanaged/$', 'archive.views.list_unmanaged', name="list_unmanaged"),
- url(r'^unmanaged/(.+)/$', 'archive.views.file_unmanaged', name="file_unmanaged"),
- url(r'^move_to_new/(.+)/$', 'archive.views.move_to_new', name="move_to_new"),
-)
+ url(r'^unmanaged/$', views.list_unmanaged, name="list_unmanaged"),
+ url(r'^unmanaged/(.+)/$', views.file_unmanaged, name="file_unmanaged"),
+ url(r'^move_to_new/(.+)/$', views.move_to_new, name="move_to_new"),
+]
self.delete(name)
return super(OverwriteStorage, self)._save(name, content)
- def get_available_name(self, name):
+ def get_available_name(self, name, max_length):
return name
def all_files(root_path):
root_len = len(root_path)
for path, dirs, files in os.walk(root_path):
- for fname in files:
- yield os.path.join(path, fname)[root_len:].lstrip('/')
+ for fname in files:
+ yield os.path.join(path, fname)[root_len:].lstrip('/')
def file_new(request, filename):
division = 'new'
- filepath = filename.encode('utf-8')
- root_filepath = os.path.join(settings.NEW_PATH, filename.encode('utf-8'))
+ filepath = filename
+ root_filepath = os.path.join(settings.NEW_PATH, filename)
if request.POST:
form = AudiobookForm(request.POST)
if form.is_valid():
+from __future__ import absolute_import, unicode_literals
+
+from .celery import app as celery_app
+
+__all__ = ('celery_app',)
--- /dev/null
+from __future__ import absolute_import, unicode_literals
+import os
+from celery import Celery
+
+os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'audiobooks.settings')
+app = Celery('audiobooks')
+app.config_from_object('django.conf:settings', namespace='CELERY')
+
+app.autodiscover_tasks()
DEBUG = False
-TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', 'your_email@example.com'),
# Make this unique, and don't share it with anybody.
SECRET_KEY = '8ehk^-+pr(o)k6lh_gl9+ks6gkd9u#fka7fv%ikpk(c%llqa6%'
-# List of callables that know how to import templates from various sources.
-TEMPLATE_LOADERS = (
- 'django.template.loaders.filesystem.Loader',
- 'django.template.loaders.app_directories.Loader',
-# 'django.template.loaders.eggs.Loader',
-)
+TEMPLATES = [
+ {
+ 'BACKEND': 'django.template.backends.django.DjangoTemplates',
+ 'APP_DIRS': True,
+ 'OPTIONS': {
+ 'context_processors': [
+ 'django.template.context_processors.debug',
+ 'django.template.context_processors.request',
+ 'django.contrib.auth.context_processors.auth',
+ 'django.contrib.messages.context_processors.messages',
+ ],
+ },
+ },
+]
MIDDLEWARE_CLASSES = (
'django.middleware.common.CommonMiddleware',
ROOT_URLCONF = 'audiobooks.urls'
-TEMPLATE_DIRS = (
- # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
- # Always use forward slashes, even on Windows.
- # Don't forget to use absolute paths, not relative paths.
-)
-
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
- # Uncomment the next line to enable the admin:
'django.contrib.admin',
# Uncomment the next line to enable admin documentation:
# 'django.contrib.admindocs',
- 'djcelery',
- 'djkombu',
-
- 'south',
'archive',
)
}
}
-#http://logowanie.nowoczesnapolska.org.pl/cas/'
-CAS_SERVER_URL = "http://logowanie.nowoczesnapolska.org.pl/cas/"
+CAS_SERVER_URL = "https://logowanie.nowoczesnapolska.org.pl/cas/"
CAS_VERSION = "1"
-
EMAIL_SUBJECT_PREFIX = '[Audio] '
SERVER_EMAIL = 'no-reply@audio.wolnelektury.pl'
EMAIL_HOST = 'localhost'
EMAIL_PORT = 25
-import djcelery
-djcelery.setup_loader()
-
-CELERY_SEND_TASK_ERROR_EMAILS = True
-BROKER_BACKEND = "djkombu.transport.DatabaseTransport"
-BROKER_HOST = "localhost"
-BROKER_PORT = 5672
-BROKER_USER = "guest"
-BROKER_PASSWORD = "guest"
-BROKER_VHOST = "/"
-
+CELERY_BROKER_URL = 'redis://localhost:6379/0'
try:
- from localsettings import *
+ from .localsettings import *
except:
pass
from django.conf import settings
-from django.conf.urls import patterns, include, url
+from django.conf.urls import include, url
from django.views.generic import RedirectView
+import django_cas.views
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
-urlpatterns = patterns('',
- url(r'^$', RedirectView.as_view(url='archive/')),
+urlpatterns = [
+ url(r'^$', RedirectView.as_view(url='archive/', permanent=False)),
url(r'^archive/', include('archive.urls')),
url(r'^admin/', include(admin.site.urls)),
- url(r'^accounts/login/$', 'django_cas.views.login', name='login'),
- url(r'^accounts/logout/$', 'django_cas.views.logout', name='logout'),
-)
-
-if settings.DEBUG:
- urlpatterns += patterns('',
- (r'^media/(?P<path>.*)$', 'django.views.static.serve', {'document_root': settings.MEDIA_ROOT, 'show_indexes':True}),
-)
+ url(r'^accounts/login/$', django_cas.views.login, name='login'),
+ url(r'^accounts/logout/$', django_cas.views.logout, name='logout'),
+]
"""
-WSGI config for edumed project.
+WSGI config for audiobooks project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
#!/usr/bin/env python
-from django.core.management import execute_manager
-import imp
-try:
- imp.find_module('settings', ['audiobooks'])
-except ImportError:
- import sys
- sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll have to run django-admin.py, passing it your settings module.\n" % __file__)
- sys.exit(1)
-
-import audiobooks.settings
+import os
+import sys
if __name__ == "__main__":
- execute_manager(audiobooks.settings)
+ os.environ.setdefault("DJANGO_SETTINGS_MODULE", "audiobooks.settings")
+
+ from django.core.management import execute_from_command_line
+
+ execute_from_command_line(sys.argv)