-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)
--- /dev/null
+# 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)),
+ ],
+ ),
+ ]
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?
--- /dev/null
+# 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'),
+ ),
+ ]
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")