tweak sync models

This commit is contained in:
meeb 2020-11-26 16:04:57 +11:00
parent b094f037e3
commit 3bf93cace0
3 changed files with 40 additions and 8 deletions

View File

@ -15,6 +15,6 @@ class SourceAdmin(admin.ModelAdmin):
class MediaAdmin(admin.ModelAdmin): class MediaAdmin(admin.ModelAdmin):
ordering = ('-created',) ordering = ('-created',)
list_display = ('url',) list_display = ('key', 'source')
readonly_fields = ('uuid', 'created') readonly_fields = ('uuid', 'created')
search_fields = ('uuid', 'key', 'url') search_fields = ('uuid', 'source__key', 'key')

View File

@ -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'),
),
]

View File

@ -80,7 +80,7 @@ class Source(models.Model):
help_text=_('Date and time the source was last crawled') help_text=_('Date and time the source was last crawled')
) )
source_type = models.CharField( source_type = models.CharField(
_('type'), _('source type'),
max_length=1, max_length=1,
db_index=True, db_index=True,
choices=SOURCE_TYPE_CHOICES, choices=SOURCE_TYPE_CHOICES,
@ -208,11 +208,6 @@ class Media(models.Model):
db_index=True, db_index=True,
help_text=_('Media key, such as exact YouTube video ID') 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 = models.ImageField(
_('thumb'), _('thumb'),
upload_to=get_media_thumb_path, upload_to=get_media_thumb_path,