diff options
author | pukkandan <pukkandan.ytdlp@gmail.com> | 2021-08-13 20:44:50 +0530 |
---|---|---|
committer | pukkandan <pukkandan.ytdlp@gmail.com> | 2021-08-15 00:26:32 +0530 |
commit | 6c7274ecd2c91a30166cfcd003e7d5de409f9fc7 (patch) | |
tree | e1eb467ab34d0d5406881d88b08e67aa31e0767d | |
parent | 5c333d74969d7277a20e665b597fae20fc4d83a0 (diff) | |
download | hypervideo-pre-6c7274ecd2c91a30166cfcd003e7d5de409f9fc7.tar.lz hypervideo-pre-6c7274ecd2c91a30166cfcd003e7d5de409f9fc7.tar.xz hypervideo-pre-6c7274ecd2c91a30166cfcd003e7d5de409f9fc7.zip |
Fix resuming of single formats when using --no-part
Closes #576
-rw-r--r-- | yt_dlp/YoutubeDL.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/yt_dlp/YoutubeDL.py b/yt_dlp/YoutubeDL.py index 5937e85bd..9057824be 100644 --- a/yt_dlp/YoutubeDL.py +++ b/yt_dlp/YoutubeDL.py @@ -2663,7 +2663,6 @@ class YoutubeDL(object): os.remove(encodeFilename(file)) return None - self.report_file_already_downloaded(existing_files[0]) info_dict['ext'] = os.path.splitext(existing_files[0])[1][1:] return existing_files[0] @@ -2718,7 +2717,7 @@ class YoutubeDL(object): info_dict['protocol'] = _protocols.pop() directly_mergable = FFmpegFD.can_merge_formats(info_dict) if dl_filename is not None: - pass + self.report_file_already_downloaded(dl_filename) elif (directly_mergable and get_suitable_downloader( info_dict, self.params, to_stdout=(temp_filename == '-')) == FFmpegFD): info_dict['url'] = '\n'.join(f['url'] for f in requested_formats) @@ -2770,9 +2769,13 @@ class YoutubeDL(object): else: # Just a single file dl_filename = existing_file(full_filename, temp_filename) - if dl_filename is None: + if dl_filename is None or dl_filename == temp_filename: + # dl_filename == temp_filename could mean that the file was partially downloaded with --no-part. + # So we should try to resume the download success, real_download = self.dl(temp_filename, info_dict) info_dict['__real_download'] = real_download + else: + self.report_file_already_downloaded(dl_filename) dl_filename = dl_filename or temp_filename info_dict['__finaldir'] = os.path.dirname(os.path.abspath(encodeFilename(full_filename))) |