diff --git a/tidal_dl_ng/download.py b/tidal_dl_ng/download.py index 7db160e..3b9a3f4 100644 --- a/tidal_dl_ng/download.py +++ b/tidal_dl_ng/download.py @@ -227,11 +227,11 @@ class Download: # Compute if and how downloads need to be skipped. if self.skip_existing.value in (SkipExisting.ExtensionIgnore.value, SkipExisting.Filename.value): 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: - download_skip: bool = False + file_exists: bool = False - if not download_skip: + if not file_exists: # Create a temp directory and file. 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) @@ -253,7 +253,7 @@ class Download: else: 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. # 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.") 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): # Build tmp lyrics filename diff --git a/tidal_dl_ng/helper/path.py b/tidal_dl_ng/helper/path.py index 91fe5cf..53d3290 100644 --- a/tidal_dl_ng/helper/path.py +++ b/tidal_dl_ng/helper/path.py @@ -1,4 +1,3 @@ -import glob import math import os import re @@ -241,7 +240,7 @@ def check_file_exists(path_file: str, extension_ignore: bool = False) -> bool: else: 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