Compare commits

...

2 Commits

Author SHA1 Message Date
ClosedPort22
2142783a22
Merge a3406c0325 into be3579aaf0 2024-11-09 21:35:41 +05:30
ClosedPort22
a3406c0325
[downloader/fragment] Partially revert 4823ec9f46
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.
2023-09-11 16:30:26 +09:00

View File

@ -188,9 +188,7 @@ class FragmentFD(FileDownloader):
}) })
if self.__do_ytdl_file(ctx): if self.__do_ytdl_file(ctx):
ytdl_file_exists = os.path.isfile(encodeFilename(self.ytdl_filename(ctx['filename']))) if os.path.isfile(encodeFilename(self.ytdl_filename(ctx['filename']))):
continuedl = self.params.get('continuedl', True)
if continuedl and ytdl_file_exists:
self._read_ytdl_file(ctx) self._read_ytdl_file(ctx)
is_corrupt = ctx.get('ytdl_corrupt') is True is_corrupt = ctx.get('ytdl_corrupt') is True
is_inconsistent = ctx['fragment_index'] > 0 and resume_len == 0 is_inconsistent = ctx['fragment_index'] > 0 and resume_len == 0
@ -204,12 +202,7 @@ class FragmentFD(FileDownloader):
if 'ytdl_corrupt' in ctx: if 'ytdl_corrupt' in ctx:
del ctx['ytdl_corrupt'] del ctx['ytdl_corrupt']
self._write_ytdl_file(ctx) self._write_ytdl_file(ctx)
else: else:
if not continuedl:
if ytdl_file_exists:
self._read_ytdl_file(ctx)
ctx['fragment_index'] = resume_len = 0
self._write_ytdl_file(ctx) self._write_ytdl_file(ctx)
assert ctx['fragment_index'] == 0 assert ctx['fragment_index'] == 0