diff --git a/tubesync/sync/migrations/0015_auto_20230213_0603.py b/tubesync/sync/migrations/0015_auto_20230213_0603.py new file mode 100644 index 0000000..54592f9 --- /dev/null +++ b/tubesync/sync/migrations/0015_auto_20230213_0603.py @@ -0,0 +1,23 @@ +# Generated by Django 3.2.17 on 2023-02-13 06:03 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('sync', '0014_alter_media_media_file'), + ] + + operations = [ + migrations.AddField( + model_name='media', + name='manual_skip', + field=models.BooleanField(db_index=True, default=False, help_text='Media marked as "skipped", won\' be downloaded', verbose_name='manual_skip'), + ), + migrations.AlterField( + model_name='media', + name='skip', + field=models.BooleanField(db_index=True, default=False, help_text='INTERNAL FLAG - Media will be skipped and not downloaded', verbose_name='skip'), + ), + ] diff --git a/tubesync/sync/models.py b/tubesync/sync/models.py index 16415c7..342a8a3 100644 --- a/tubesync/sync/models.py +++ b/tubesync/sync/models.py @@ -679,7 +679,13 @@ class Media(models.Model): _('skip'), db_index=True, default=False, - help_text=_('Media will be skipped and not downloaded') + help_text=_('INTERNAL FLAG - Media will be skipped and not downloaded') + ) + manual_skip = models.BooleanField( + _('manual_skip'), + db_index=True, + default=False, + help_text=_('Media marked as "skipped", won\' be downloaded') ) downloaded = models.BooleanField( _('downloaded'), diff --git a/tubesync/sync/signals.py b/tubesync/sync/signals.py index 9e417ff..6800a2f 100644 --- a/tubesync/sync/signals.py +++ b/tubesync/sync/signals.py @@ -93,6 +93,10 @@ def task_task_failed(sender, task_id, completed_task, **kwargs): @receiver(post_save, sender=Media) def media_post_save(sender, instance, created, **kwargs): + # If the media is skipped manually, bail. + if instance.manual_skip: + return + # Triggered after media is saved cap_changed = False can_download_changed = False diff --git a/tubesync/sync/tasks.py b/tubesync/sync/tasks.py index 678e46c..def7529 100644 --- a/tubesync/sync/tasks.py +++ b/tubesync/sync/tasks.py @@ -221,6 +221,11 @@ def download_media_metadata(media_id): log.error(f'Task download_media_metadata(pk={media_id}) called but no ' f'media exists with ID: {media_id}') return + + if media.manual_skip: + log.info(f'Task for ID: {media_id} skipped, due to task being manually skipped.') + return + source = media.source metadata = media.index_metadata() media.metadata = json.dumps(metadata, default=json_serial) diff --git a/tubesync/sync/templates/sync/media-item.html b/tubesync/sync/templates/sync/media-item.html index c2e83dd..4f0e524 100644 --- a/tubesync/sync/templates/sync/media-item.html +++ b/tubesync/sync/templates/sync/media-item.html @@ -22,8 +22,11 @@ {% endif %} -{% if not media.can_download %}{% include 'errorbox.html' with message='Media cannot be downloaded because it has no formats which match the source requirements.' %}{% endif %} -{% if media.skip %}{% include 'errorbox.html' with message='Media is marked to be skipped and will not be downloaded.' %}{% endif %} +{% if media.manual_skip %}{% include 'errorbox.html' with message='Media is marked to be skipped and will not be downloaded.' %} +{% else %} + {% if not media.can_download %}{% include 'errorbox.html' with message='Media cannot be downloaded because it has no formats which match the source requirements.' %}{% endif %} + {% if media.skip %}{% include 'errorbox.html' with message='This media may be skipped due to error(s).' %}{% endif %} +{% endif %} {% include 'infobox.html' with message=message %}