From a3406c03250fd0c22e1225f9d88c26262059cb0b Mon Sep 17 00:00:00 2001 From: ClosedPort22 <44864697+ClosedPort22@users.noreply.github.com> Date: Mon, 11 Sep 2023 16:30:26 +0900 Subject: [PATCH] [downloader/fragment] Partially revert 4823ec9f461512daa1b8ab362893bb86a6320b26 Currently, when `--no-continue` is used, yt-dlp will attempt to download from the first fragment and **append** decrypted fragments to the temp file (or the actual video file), causing data duplication when resuming a partially downloaded video. This fixes the issue by partially reverting the behavior of the fragment downloader to match its description in the README file. --- yt_dlp/downloader/fragment.py | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/yt_dlp/downloader/fragment.py b/yt_dlp/downloader/fragment.py index b4b680dae1..e782e652ea 100644 --- a/yt_dlp/downloader/fragment.py +++ b/yt_dlp/downloader/fragment.py @@ -187,9 +187,7 @@ def _prepare_frag_download(self, ctx): }) if self.__do_ytdl_file(ctx): - ytdl_file_exists = os.path.isfile(encodeFilename(self.ytdl_filename(ctx['filename']))) - continuedl = self.params.get('continuedl', True) - if continuedl and ytdl_file_exists: + if os.path.isfile(encodeFilename(self.ytdl_filename(ctx['filename']))): self._read_ytdl_file(ctx) is_corrupt = ctx.get('ytdl_corrupt') is True is_inconsistent = ctx['fragment_index'] > 0 and resume_len == 0 @@ -203,12 +201,7 @@ def _prepare_frag_download(self, ctx): if 'ytdl_corrupt' in ctx: del ctx['ytdl_corrupt'] self._write_ytdl_file(ctx) - else: - if not continuedl: - if ytdl_file_exists: - self._read_ytdl_file(ctx) - ctx['fragment_index'] = resume_len = 0 self._write_ytdl_file(ctx) assert ctx['fragment_index'] == 0