From 3bf93cace0d91b8e603657904f43554cb21c6e23 Mon Sep 17 00:00:00 2001 From: meeb Date: Thu, 26 Nov 2020 16:04:57 +1100 Subject: [PATCH] tweak sync models --- app/sync/admin.py | 4 +- .../migrations/0002_auto_20201126_0504.py | 37 +++++++++++++++++++ app/sync/models.py | 7 +--- 3 files changed, 40 insertions(+), 8 deletions(-) create mode 100644 app/sync/migrations/0002_auto_20201126_0504.py diff --git a/app/sync/admin.py b/app/sync/admin.py index 4b028ea..dc94d0f 100644 --- a/app/sync/admin.py +++ b/app/sync/admin.py @@ -15,6 +15,6 @@ class SourceAdmin(admin.ModelAdmin): class MediaAdmin(admin.ModelAdmin): ordering = ('-created',) - list_display = ('url',) + list_display = ('key', 'source') readonly_fields = ('uuid', 'created') - search_fields = ('uuid', 'key', 'url') + search_fields = ('uuid', 'source__key', 'key') diff --git a/app/sync/migrations/0002_auto_20201126_0504.py b/app/sync/migrations/0002_auto_20201126_0504.py new file mode 100644 index 0000000..5f15712 --- /dev/null +++ b/app/sync/migrations/0002_auto_20201126_0504.py @@ -0,0 +1,37 @@ +# Generated by Django 3.1.3 on 2020-11-26 05:04 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('sync', '0001_initial'), + ] + + operations = [ + migrations.RemoveField( + model_name='media', + name='url', + ), + migrations.AlterField( + model_name='source', + name='fallback', + field=models.CharField(choices=[('f', 'Fail, do not download any media'), ('s', 'Get next best SD media instead'), ('h', 'Get next best HD media instead')], db_index=True, default='f', help_text='What do do when media in your source profile is not available', max_length=1, verbose_name='fallback'), + ), + migrations.AlterField( + model_name='source', + name='name', + field=models.CharField(db_index=True, help_text='Friendly name for the source, used locally in TubeSync only', max_length=100, verbose_name='name'), + ), + migrations.AlterField( + model_name='source', + name='output_format', + field=models.CharField(choices=[('mp4', '.mp4 container'), ('mkv', '.mkv container'), ('mkv', '.webm container'), ('m4a', '.m4a container (audio only)'), ('ogg', '.ogg container (audio only)')], db_index=True, default='mkv', help_text='Output format, the file format container in which to save media', max_length=8, verbose_name='output format'), + ), + migrations.AlterField( + model_name='source', + name='source_type', + field=models.CharField(choices=[('c', 'YouTube channel'), ('p', 'YouTube playlist')], db_index=True, default='c', help_text='Source type', max_length=1, verbose_name='source type'), + ), + ] diff --git a/app/sync/models.py b/app/sync/models.py index 51b9185..09c155b 100644 --- a/app/sync/models.py +++ b/app/sync/models.py @@ -80,7 +80,7 @@ class Source(models.Model): help_text=_('Date and time the source was last crawled') ) source_type = models.CharField( - _('type'), + _('source type'), max_length=1, db_index=True, choices=SOURCE_TYPE_CHOICES, @@ -208,11 +208,6 @@ class Media(models.Model): db_index=True, help_text=_('Media key, such as exact YouTube video ID') ) - url = models.URLField( - _('url'), - db_index=True, - help_text=_('URL of the media') - ) thumb = models.ImageField( _('thumb'), upload_to=get_media_thumb_path,