mirror of
https://github.com/meeb/tubesync.git
synced 2025-06-23 13:36:35 +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(
|
||||
str(instance.pk),
|
||||
queue=str(instance.source.pk),
|
||||
priority=15,
|
||||
priority=10,
|
||||
verbose_name=verbose_name.format(instance.name),
|
||||
remove_existing_tasks=True
|
||||
)
|
||||
|
@ -442,10 +442,18 @@ 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:
|
||||
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} '
|
||||
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}')
|
||||
|
Loading…
Reference in New Issue
Block a user