From 69a824e33403143f1289608dc37717c1dd62fded Mon Sep 17 00:00:00 2001 From: meeb Date: Thu, 18 Jul 2024 01:37:27 +1000 Subject: [PATCH] increase cached title length to 200 chars, ensure title is never set over 200 chars, resolves #518 (related to #515) --- .../migrations/0024_auto_20240717_1535.py | 28 +++++++++++++++++++ tubesync/sync/models.py | 2 +- tubesync/sync/tasks.py | 2 +- 3 files changed, 30 insertions(+), 2 deletions(-) create mode 100644 tubesync/sync/migrations/0024_auto_20240717_1535.py diff --git a/tubesync/sync/migrations/0024_auto_20240717_1535.py b/tubesync/sync/migrations/0024_auto_20240717_1535.py new file mode 100644 index 00000000..c2d20d35 --- /dev/null +++ b/tubesync/sync/migrations/0024_auto_20240717_1535.py @@ -0,0 +1,28 @@ +# Generated by Django 3.2.25 on 2024-07-17 15:35 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('sync', '0023_media_duration_filter'), + ] + + operations = [ + migrations.AlterField( + model_name='media', + name='manual_skip', + field=models.BooleanField(db_index=True, default=False, help_text='Media marked as "skipped", won\'t be downloaded', verbose_name='manual_skip'), + ), + migrations.AlterField( + model_name='media', + name='title', + field=models.CharField(blank=True, default='', help_text='Video title', max_length=200, verbose_name='title'), + ), + migrations.AlterField( + model_name='source', + name='filter_text', + field=models.CharField(blank=True, default='', help_text='Regex compatible filter string for video titles', max_length=200, verbose_name='filter string'), + ), + ] diff --git a/tubesync/sync/models.py b/tubesync/sync/models.py index 5e1afba7..95d23cf1 100644 --- a/tubesync/sync/models.py +++ b/tubesync/sync/models.py @@ -889,7 +889,7 @@ class Media(models.Model): ) title = models.CharField( _('title'), - max_length=100, + max_length=200, blank=True, null=False, default='', diff --git a/tubesync/sync/tasks.py b/tubesync/sync/tasks.py index c5f64f31..37983932 100644 --- a/tubesync/sync/tasks.py +++ b/tubesync/sync/tasks.py @@ -297,7 +297,7 @@ def download_media_metadata(media_id): # Store title in DB so it's fast to access if media.metadata_title: - media.title = media.metadata_title + media.title = media.metadata_title[:200] # Store duration in DB so it's fast to access if media.metadata_duration: