🛠️ Duplicates check now detects all files correct.
This commit is contained in:
@@ -227,11 +227,11 @@ class Download:
|
|||||||
# Compute if and how downloads need to be skipped.
|
# Compute if and how downloads need to be skipped.
|
||||||
if self.skip_existing.value in (SkipExisting.ExtensionIgnore.value, SkipExisting.Filename.value):
|
if self.skip_existing.value in (SkipExisting.ExtensionIgnore.value, SkipExisting.Filename.value):
|
||||||
extension_ignore: bool = self.skip_existing == SkipExisting.ExtensionIgnore
|
extension_ignore: bool = self.skip_existing == SkipExisting.ExtensionIgnore
|
||||||
download_skip: bool = check_file_exists(path_file, extension_ignore=extension_ignore)
|
file_exists: bool = check_file_exists(path_file, extension_ignore=extension_ignore)
|
||||||
else:
|
else:
|
||||||
download_skip: bool = False
|
file_exists: bool = False
|
||||||
|
|
||||||
if not download_skip:
|
if not file_exists:
|
||||||
# Create a temp directory and file.
|
# Create a temp directory and file.
|
||||||
with tempfile.TemporaryDirectory(ignore_cleanup_errors=True) as tmp_path_dir:
|
with tempfile.TemporaryDirectory(ignore_cleanup_errors=True) as tmp_path_dir:
|
||||||
tmp_path_file = os.path.join(tmp_path_dir, str(uuid4()) + stream_manifest.file_extension)
|
tmp_path_file = os.path.join(tmp_path_dir, str(uuid4()) + stream_manifest.file_extension)
|
||||||
@@ -253,7 +253,7 @@ class Download:
|
|||||||
else:
|
else:
|
||||||
self.fn_logger.debug(f"Download skipped, since file exists: '{path_file}'")
|
self.fn_logger.debug(f"Download skipped, since file exists: '{path_file}'")
|
||||||
|
|
||||||
status_download: bool = not download_skip
|
status_download: bool = not file_exists
|
||||||
|
|
||||||
# If a file was downloaded and the download delay is enabled, wait until the next download.
|
# If a file was downloaded and the download delay is enabled, wait until the next download.
|
||||||
# Only use this, if you have a list of several Track items. Do not use this for list items.
|
# Only use this, if you have a list of several Track items. Do not use this for list items.
|
||||||
@@ -263,7 +263,7 @@ class Download:
|
|||||||
self.fn_logger.debug(f"Next download will start in {time_sleep} seconds.")
|
self.fn_logger.debug(f"Next download will start in {time_sleep} seconds.")
|
||||||
time.sleep(time_sleep)
|
time.sleep(time_sleep)
|
||||||
|
|
||||||
return not download_skip, path_file
|
return not file_exists, path_file
|
||||||
|
|
||||||
def _move_lyrics(self, file_media_dst: str, file_media_src: str):
|
def _move_lyrics(self, file_media_dst: str, file_media_src: str):
|
||||||
# Build tmp lyrics filename
|
# Build tmp lyrics filename
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import glob
|
|
||||||
import math
|
import math
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
@@ -241,7 +240,7 @@ def check_file_exists(path_file: str, extension_ignore: bool = False) -> bool:
|
|||||||
else:
|
else:
|
||||||
path_files: [str] = [path_file]
|
path_files: [str] = [path_file]
|
||||||
|
|
||||||
result = bool(sum([glob.glob(_file) for _file in path_files], []))
|
result = bool(sum([[True] if os.path.isfile(_file) else [] for _file in path_files], []))
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user