From 3b58d86cd327c460d4c156b1e85e2c851121bca3 Mon Sep 17 00:00:00 2001 From: tcely Date: Tue, 4 Feb 2025 11:05:18 -0500 Subject: [PATCH 1/3] Remove code that didn't work This method of changing `verbose_name` didn't result in any visible changes. --- tubesync/sync/tasks.py | 5 ----- 1 file changed, 5 deletions(-) diff --git a/tubesync/sync/tasks.py b/tubesync/sync/tasks.py index ac2f5ac1..8158f305 100644 --- a/tubesync/sync/tasks.py +++ b/tubesync/sync/tasks.py @@ -603,10 +603,5 @@ def wait_for_media_premiere(media_id): else: media.manual_skip = True media.title = _(f'Premieres in {hours(td(media.published))} hours') - task = get_media_premiere_task(str(media.pk)) - if task: - task.verbose_name = _(f'Waiting for premiere of "{media.key}" ' - f'in {hours(td(media.published))} hours') - task.save() media.save() From 0b233be517eeba78236e05b77c73d57c76e76730 Mon Sep 17 00:00:00 2001 From: tcely Date: Tue, 4 Feb 2025 11:16:17 -0500 Subject: [PATCH 2/3] Use a single `datetime` for `now` --- tubesync/sync/tasks.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tubesync/sync/tasks.py b/tubesync/sync/tasks.py index 8158f305..3868cc84 100644 --- a/tubesync/sync/tasks.py +++ b/tubesync/sync/tasks.py @@ -595,13 +595,14 @@ def wait_for_media_premiere(media_id): return if media.metadata: return - if media.published < timezone.now(): + now = timezone.now() + if media.published < now: media.manual_skip = False media.skip = False # start the download tasks media.save() else: media.manual_skip = True - media.title = _(f'Premieres in {hours(td(media.published))} hours') + media.title = _(f'Premieres in {hours(td(media.published, now))} hours') media.save() From 459cb4b891e869f0e4d79ad5d17f0bcdd54cc20f Mon Sep 17 00:00:00 2001 From: tcely Date: Tue, 4 Feb 2025 11:21:24 -0500 Subject: [PATCH 3/3] Remove the `td` function It is no longer being used for a default argument value. --- tubesync/sync/tasks.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tubesync/sync/tasks.py b/tubesync/sync/tasks.py index 3868cc84..273c5ba5 100644 --- a/tubesync/sync/tasks.py +++ b/tubesync/sync/tasks.py @@ -586,7 +586,6 @@ def rename_all_media_for_source(source_id): @background(schedule=0) def wait_for_media_premiere(media_id): - td = lambda p, now=timezone.now(): (p - now) hours = lambda td: 1+int((24*td.days)+(td.seconds/(60*60))) try: @@ -603,6 +602,6 @@ def wait_for_media_premiere(media_id): media.save() else: media.manual_skip = True - media.title = _(f'Premieres in {hours(td(media.published, now))} hours') + media.title = _(f'Premieres in {hours(media.published - now)} hours') media.save()