diff options
| author | Robert Honz <exislow+github@gmail.com> | 2024-03-19 07:02:00 +0100 |
|---|---|---|
| committer | Robert Honz <exislow+github@gmail.com> | 2024-03-19 07:02:00 +0100 |
| commit | ce639659b44028a88ddf6bb48a26bcd6adfcb0b0 (patch) | |
| tree | 4f9acad9d8f670ee734de149779317126a11f3f8 /tidal_dl_ng/download.py | |
| parent | 5c5aac11f1903805c8dc95c8eaffa9b8d9ca4c8a (diff) | |
| download | tidal-dl-ng-ce639659b44028a88ddf6bb48a26bcd6adfcb0b0.tar.gz | |
✨ Added append as a new option for skip existing. 🛠️ Fixed skip existing ignore extension.
Diffstat (limited to 'tidal_dl_ng/download.py')
| -rw-r--r-- | tidal_dl_ng/download.py | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/tidal_dl_ng/download.py b/tidal_dl_ng/download.py index 824f3aa..7a8b51a 100644 --- a/tidal_dl_ng/download.py +++ b/tidal_dl_ng/download.py @@ -187,12 +187,6 @@ class Download: return False, "" - # Create file name and path - file_name_relative = format_path_media(file_template, media) - path_file = os.path.abspath( - os.path.normpath(os.path.join(os.path.expanduser(self.path_base), file_name_relative)) - ) - # Populate StreamManifest for further download. if isinstance(media, Track): stream = media.get_stream() @@ -204,15 +198,22 @@ class Download: stream_manifest = self.stream_manifest_parse(manifest, mime_type) + # Create file name and path + file_name_relative = format_path_media(file_template, media) + path_file = os.path.abspath( + os.path.normpath(os.path.join(os.path.expanduser(self.path_base), file_name_relative)) + ) + # Sanitize final path_file to fit into OS boundaries. - path_file = path_file_sanitize(path_file + stream_manifest.file_extension, adapt=True) + uniquify: bool = self.skip_existing == SkipExisting.Append + path_file = path_file_sanitize(path_file + stream_manifest.file_extension, adapt=True, uniquify=uniquify) # Compute if and how downloads need to be skipped. - if self.skip_existing.value: - extension_ignore = self.skip_existing == SkipExisting.ExtensionIgnore - download_skip = check_file_exists(path_file, extension_ignore=extension_ignore) + 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) else: - download_skip = False + download_skip: bool = False if not download_skip: # Create a temp directory and file. |
