mirror of
https://github.com/meeb/tubesync.git
synced 2025-06-25 22:46:34 +00:00
Fixes for ruff check
in signals.py
This commit is contained in:
parent
d956a99110
commit
34dfb52bf0
@ -10,11 +10,11 @@ from django.utils.translation import gettext_lazy as _
|
|||||||
from background_task.signals import task_failed
|
from background_task.signals import task_failed
|
||||||
from background_task.models import Task
|
from background_task.models import Task
|
||||||
from common.logger import log
|
from common.logger import log
|
||||||
from .models import Source, Media, MediaServer, Metadata
|
from .models import Source, Media, Metadata
|
||||||
from .tasks import (delete_task_by_source, delete_task_by_media, index_source_task,
|
from .tasks import (delete_task_by_source, delete_task_by_media, index_source_task,
|
||||||
download_media_thumbnail, download_media_metadata,
|
download_media_thumbnail, download_media_metadata,
|
||||||
map_task_to_instance, check_source_directory_exists,
|
map_task_to_instance, check_source_directory_exists,
|
||||||
download_media, rescan_media_server, download_source_images,
|
download_media, download_source_images,
|
||||||
delete_all_media_for_source, save_all_media_for_source,
|
delete_all_media_for_source, save_all_media_for_source,
|
||||||
rename_media, get_media_metadata_task, get_media_download_task)
|
rename_media, get_media_metadata_task, get_media_download_task)
|
||||||
from .utils import delete_file, glob_quote, mkdir_p
|
from .utils import delete_file, glob_quote, mkdir_p
|
||||||
@ -270,7 +270,7 @@ def media_post_save(sender, instance, created, **kwargs):
|
|||||||
if not (media_file_exists or existing_media_download_task):
|
if not (media_file_exists or existing_media_download_task):
|
||||||
# The file was deleted after it was downloaded, skip this media.
|
# The file was deleted after it was downloaded, skip this media.
|
||||||
if instance.can_download and instance.downloaded:
|
if instance.can_download and instance.downloaded:
|
||||||
skip_changed = True != instance.skip
|
skip_changed = True if not instance.skip else False
|
||||||
instance.skip = True
|
instance.skip = True
|
||||||
downloaded = False
|
downloaded = False
|
||||||
if (instance.source.download_media and instance.can_download) and not (
|
if (instance.source.download_media and instance.can_download) and not (
|
||||||
@ -374,13 +374,13 @@ def media_post_delete(sender, instance, **kwargs):
|
|||||||
try:
|
try:
|
||||||
p.rmdir()
|
p.rmdir()
|
||||||
log.info(f'Deleted directory for: {instance} path: {p!s}')
|
log.info(f'Deleted directory for: {instance} path: {p!s}')
|
||||||
except OSError as e:
|
except OSError:
|
||||||
pass
|
pass
|
||||||
# Delete the directory itself
|
# Delete the directory itself
|
||||||
try:
|
try:
|
||||||
other_path.rmdir()
|
other_path.rmdir()
|
||||||
log.info(f'Deleted directory for: {instance} path: {other_path!s}')
|
log.info(f'Deleted directory for: {instance} path: {other_path!s}')
|
||||||
except OSError as e:
|
except OSError:
|
||||||
pass
|
pass
|
||||||
# Get all files that start with the bare file path
|
# Get all files that start with the bare file path
|
||||||
all_related_files = video_path.parent.glob(f'{glob_quote(video_path.with_suffix("").name)}*')
|
all_related_files = video_path.parent.glob(f'{glob_quote(video_path.with_suffix("").name)}*')
|
||||||
|
Loading…
Reference in New Issue
Block a user