[BUGFIX] keep_max_files=0 downloading 2 (#893)

Fixes https://github.com/jmbannon/ytdl-sub/issues/892

Does not set max_downloads if keep_max_files = 0
This commit is contained in:
Jesse Bannon 2024-01-10 09:31:37 -08:00 committed by GitHub
parent 305d084a6d
commit b9d05c5b8f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -95,10 +95,12 @@ class SubscriptionYTDLOptions:
if self._preset.output_options.maintain_download_archive:
ytdl_options["download_archive"] = self._enhanced_download_archive.working_file_path
if self._preset.output_options.keep_max_files:
# yt-dlp has a weird bug with max_downloads=1, set to 2 for safe measure
ytdl_options["max_downloads"] = max(
int(self._overrides.apply_formatter(self._preset.output_options.keep_max_files)), 2
keep_max_files = int(
self._overrides.apply_formatter(self._preset.output_options.keep_max_files)
)
if keep_max_files > 0:
# yt-dlp has a weird bug with max_downloads=1, set to 2 for safe measure
ytdl_options["max_downloads"] = max(keep_max_files, 2)
return ytdl_options