From: Radek Czajka Date: Mon, 4 May 2020 10:05:07 +0000 (+0200) Subject: Add intros/outros. X-Git-Url: https://git.mdrn.pl/audio.git/commitdiff_plain/1df20e49415f48203b097a6efe616bb289988227?ds=inline Add intros/outros. --- diff --git a/src/archive/admin.py b/src/archive/admin.py index d0804be..397f973 100644 --- a/src/archive/admin.py +++ b/src/archive/admin.py @@ -1,5 +1,6 @@ -from archive.models import Project, Audiobook +from archive.models import Project, Audiobook, Piece from django.contrib import admin admin.site.register(Project) admin.site.register(Audiobook) +admin.site.register(Piece) diff --git a/src/archive/migrations/0006_piece.py b/src/archive/migrations/0006_piece.py new file mode 100644 index 0000000..096c3be --- /dev/null +++ b/src/archive/migrations/0006_piece.py @@ -0,0 +1,23 @@ +# Generated by Django 3.0.4 on 2020-05-04 11:48 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('archive', '0005_audiobook_youtube_id'), + ] + + operations = [ + migrations.CreateModel( + name='Piece', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('name', models.CharField(max_length=255)), + ('source_file', models.FileField(upload_to='piece')), + ('is_outro', models.BooleanField(default=False)), + ('min_audiobook_duration', models.IntegerField(default=0)), + ], + ), + ] diff --git a/src/archive/models.py b/src/archive/models.py index 746f46b..51fc66c 100644 --- a/src/archive/models.py +++ b/src/archive/models.py @@ -25,6 +25,16 @@ class Project(models.Model): return self.name +class Piece(models.Model): + name = models.CharField(max_length=255) + source_file = models.FileField(upload_to='piece') + is_outro = models.BooleanField(default=False) + min_audiobook_duration = models.IntegerField(default=0) + + def __str__(self): + return self.name + + def source_upload_to(intance, filename): return os.path.join(FILES_SAVE_PATH, filename) # FIXME: what about really long file names? diff --git a/src/youtube/migrations/0004_auto_20200504_1148.py b/src/youtube/migrations/0004_auto_20200504_1148.py new file mode 100644 index 0000000..cfb0ce1 --- /dev/null +++ b/src/youtube/migrations/0004_auto_20200504_1148.py @@ -0,0 +1,51 @@ +# Generated by Django 3.0.4 on 2020-05-04 11:48 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('youtube', '0003_auto_20200331_1404'), + ] + + operations = [ + migrations.RemoveField( + model_name='youtube', + name='client_secrets', + ), + migrations.RemoveField( + model_name='youtube', + name='oauth2_storage', + ), + migrations.AddField( + model_name='youtube', + name='genres', + field=models.CharField(blank=True, max_length=2048), + ), + migrations.AddField( + model_name='youtube', + name='thumbnail_template', + field=models.FileField(blank=True, upload_to='youtube/thumbnail'), + ), + migrations.AlterField( + model_name='youtube', + name='card', + field=models.FileField(blank=True, upload_to='youtube/card'), + ), + migrations.AlterField( + model_name='youtube', + name='intro_card', + field=models.FileField(blank=True, upload_to='youtube/intro_card'), + ), + migrations.AlterField( + model_name='youtube', + name='loop_video', + field=models.FileField(blank=True, upload_to='youtube/loop_video'), + ), + migrations.AlterField( + model_name='youtube', + name='outro_card', + field=models.FileField(blank=True, upload_to='youtube/outro_card'), + ), + ] diff --git a/src/youtube/models.py b/src/youtube/models.py index 423f338..9857233 100644 --- a/src/youtube/models.py +++ b/src/youtube/models.py @@ -18,12 +18,14 @@ class YouTube(models.Model): title_template = models.CharField(max_length=1024, blank=True) description_template = models.TextField(blank=True) category = models.IntegerField(null=True, blank=True) # get categories - intro_card = models.FileField(blank=True) + intro_card = models.FileField(upload_to='youtube/intro_card', blank=True) intro_card_duration = models.FloatField(null=True, blank=True) - card = models.FileField(blank=True) - loop_video = models.FileField(blank=True) - outro_card = models.FileField(blank=True) + card = models.FileField(upload_to='youtube/card', blank=True) + loop_video = models.FileField(upload_to='youtube/loop_video', blank=True) + outro_card = models.FileField(upload_to='youtube/outro_card', blank=True) outro_card_duration = models.FloatField(null=True, blank=True) + thumbnail_template = models.FileField(upload_to='youtube/thumbnail', blank=True) + genres = models.CharField(max_length=2048, blank=True) class Meta: verbose_name = _("YouTube configuration")