From 6b4fa15ec62c78e5abef2ee28dac681b23bb5eaf Mon Sep 17 00:00:00 2001 From: tcely Date: Mon, 16 Jun 2025 17:36:56 -0400 Subject: [PATCH] Run the initial image downloads using `huey` --- tubesync/sync/tasks.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/tubesync/sync/tasks.py b/tubesync/sync/tasks.py index 6f93c39c..c893c4eb 100644 --- a/tubesync/sync/tasks.py +++ b/tubesync/sync/tasks.py @@ -497,17 +497,15 @@ def index_source_task(source_id): log.info(f'Indexed new media: {source} / {media}') log.info(f'Scheduling tasks to download thumbnail for: {media.key}') thumbnail_fmt = 'https://i.ytimg.com/vi/{}/{}default.jpg' - vn_fmt = _('Downloading {} thumbnail for: "{}": {}') - for num, prefix in enumerate(('hq', 'sd', 'maxres',)): + for num, prefix in enumerate(reversed(('hq', 'sd', 'maxres',))): thumbnail_url = thumbnail_fmt.format( media.key, prefix, ) - download_media_thumbnail( - str(media.pk), - thumbnail_url, - schedule=dict(run_at=10+(300*num)), - verbose_name=vn_fmt.format(prefix, media.key, media.name), + download_media_image.schedule( + (str(media.pk), thumbnail_url,), + priority=10+(5*num), + delay=65-(30*num), ) log.info(f'Scheduling task to download metadata for: {media.url}') verbose_name = _('Downloading metadata for: "{}": {}')