From 3b20f07450f51fbb7caf6c3b3fab77b5abc3d265 Mon Sep 17 00:00:00 2001 From: tcely Date: Sat, 25 Jan 2025 19:12:36 -0500 Subject: [PATCH] Try to download thumbnail before copy --- tubesync/sync/tasks.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/tubesync/sync/tasks.py b/tubesync/sync/tasks.py index ab92e2c8..f0a8856d 100644 --- a/tubesync/sync/tasks.py +++ b/tubesync/sync/tasks.py @@ -442,10 +442,14 @@ def download_media(media_id): media.downloaded_format = 'audio' media.save() # If selected, copy the thumbnail over as well - if media.source.copy_thumbnails and media.thumb: - log.info(f'Copying media thumbnail from: {media.thumb.path} ' - f'to: {media.thumbpath}') - copyfile(media.thumb.path, media.thumbpath) + if media.source.copy_thumbnails: + if not media.thumb_file_exists: + if download_media_thumbnail.now(str(media.pk), media.thumbnail): + media.refresh_from_db() + if media.thumb_file_exists: + log.info(f'Copying media thumbnail from: {media.thumb.path} ' + f'to: {media.thumbpath}') + copyfile(media.thumb.path, media.thumbpath) # If selected, write an NFO file if media.source.write_nfo: log.info(f'Writing media NFO file to: {media.nfopath}')