mirror of
https://github.com/meeb/tubesync.git
synced 2025-06-23 21:46:44 +00:00
Merge pull request #650 from tcely/patch-5
Download thumbnail and media at the same priority
This commit is contained in:
commit
82418334d4
@ -174,7 +174,7 @@ def media_post_save(sender, instance, created, **kwargs):
|
|||||||
download_media(
|
download_media(
|
||||||
str(instance.pk),
|
str(instance.pk),
|
||||||
queue=str(instance.source.pk),
|
queue=str(instance.source.pk),
|
||||||
priority=15,
|
priority=10,
|
||||||
verbose_name=verbose_name.format(instance.name),
|
verbose_name=verbose_name.format(instance.name),
|
||||||
remove_existing_tasks=True
|
remove_existing_tasks=True
|
||||||
)
|
)
|
||||||
|
@ -442,7 +442,15 @@ def download_media(media_id):
|
|||||||
media.downloaded_format = 'audio'
|
media.downloaded_format = 'audio'
|
||||||
media.save()
|
media.save()
|
||||||
# If selected, copy the thumbnail over as well
|
# If selected, copy the thumbnail over as well
|
||||||
if media.source.copy_thumbnails and media.thumb:
|
if media.source.copy_thumbnails:
|
||||||
|
if not media.thumb_file_exists:
|
||||||
|
thumbnail_url = media.thumbnail
|
||||||
|
if thumbnail_url:
|
||||||
|
args = ( str(media.pk), thumbnail_url, )
|
||||||
|
delete_task_by_media('sync.tasks.download_media_thumbnail', args)
|
||||||
|
if download_media_thumbnail.now(*args):
|
||||||
|
media.refresh_from_db()
|
||||||
|
if media.thumb_file_exists:
|
||||||
log.info(f'Copying media thumbnail from: {media.thumb.path} '
|
log.info(f'Copying media thumbnail from: {media.thumb.path} '
|
||||||
f'to: {media.thumbpath}')
|
f'to: {media.thumbpath}')
|
||||||
copyfile(media.thumb.path, media.thumbpath)
|
copyfile(media.thumb.path, media.thumbpath)
|
||||||
|
Loading…
Reference in New Issue
Block a user