From: Radek Czajka Date: Fri, 25 Jun 2021 14:20:08 +0000 (+0200) Subject: Add project info flac. X-Git-Url: https://git.mdrn.pl/audio.git/commitdiff_plain/362ff0da66230b4577b9ee17024b84989f2c3266?ds=sidebyside Add project info flac. --- diff --git a/src/archive/migrations/0023_project_info_flac.py b/src/archive/migrations/0023_project_info_flac.py new file mode 100644 index 0000000..99897c4 --- /dev/null +++ b/src/archive/migrations/0023_project_info_flac.py @@ -0,0 +1,18 @@ +# Generated by Django 3.1.2 on 2021-06-25 16:19 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('archive', '0022_auto_20210316_1406'), + ] + + operations = [ + migrations.AddField( + model_name='project', + name='info_flac', + field=models.FileField(blank=True, upload_to='archive/info_flac'), + ), + ] diff --git a/src/archive/models.py b/src/archive/models.py index 1fc033b..fe6cc5c 100644 --- a/src/archive/models.py +++ b/src/archive/models.py @@ -32,6 +32,7 @@ class Project(models.Model): description = models.TextField(blank=True, verbose_name="Opis") youtube = models.ForeignKey('youtube.YouTube', models.PROTECT) icon = models.FileField(upload_to='archive/project', blank=True, null=True) + info_flac = models.FileField(upload_to='archive/info_flac', blank=True) class Meta: verbose_name = _("project") diff --git a/src/youtube/tasks.py b/src/youtube/tasks.py index cad3d11..d7ca67e 100644 --- a/src/youtube/tasks.py +++ b/src/youtube/tasks.py @@ -23,12 +23,16 @@ class YouTubeTask(AudioFormatTask): def get_source_file_paths(self, audiobook): if not audiobook.youtube_volume: - return [audiobook.source_file.path] - return [ - a.source_file.path - for a in type(audiobook) - .objects.filter( - slug=audiobook.slug, youtube_volume=audiobook.youtube_volume - ) - .order_by("index") - ] + paths = [audiobook.source_file.path] + else: + paths = [ + a.source_file.path + for a in type(audiobook) + .objects.filter( + slug=audiobook.slug, youtube_volume=audiobook.youtube_volume + ) + .order_by("index") + ] + if audiobook.project.info_flac: + paths.append(audiobook.project.info_flac.path) + return paths