✨ On symlink downloads will be skipped, if item in track folder already exist. It will be still symlinked.

This commit is contained in:
Robert Honz
2024-12-16 10:55:09 +01:00
parent 88c5892cb9
commit 785724a3e0
+14
View File
@@ -310,8 +310,21 @@ class Download:
path_media_dst = pathlib.Path(path_file_sanitize(str(path_media_dst), adapt=True))
# Compute if and how downloads need to be skipped.
skip_download: bool = False
if self.skip_existing:
skip_file: bool = check_file_exists(path_media_dst, extension_ignore=True)
if self.settings.data.symlink_to_track and not isinstance(media, Video):
# Compute symlink tracks path, sanitize and check if file exists
file_name_symlink_relative: str = format_path_media(self.settings.data.format_track, media)
path_media_symlink_dst: pathlib.Path = (
(pathlib.Path(self.path_base).expanduser() / (file_name_symlink_relative + file_extension_dummy))
.resolve()
.absolute()
)
path_media_symlink_dst = pathlib.Path(path_file_sanitize(str(path_media_symlink_dst), adapt=True))
skip_download = check_file_exists(path_media_symlink_dst, extension_ignore=True)
else:
skip_file: bool = False
@@ -358,6 +371,7 @@ class Download:
path_media_dst = pathlib.Path(path_file_sanitize(str(path_media_dst), adapt=True))
os.makedirs(path_media_dst.parent, exist_ok=True)
if not skip_download:
# Create a temp directory and file.
with tempfile.TemporaryDirectory(ignore_cleanup_errors=True) as tmp_path_dir:
tmp_path_file: pathlib.Path = pathlib.Path(tmp_path_dir) / str(uuid4())