Skip to content

Commit

Permalink
min 2
Browse files Browse the repository at this point in the history
  • Loading branch information
jmbannon committed Jan 4, 2024
1 parent 2dbe426 commit 87aa5e7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/ytdl_sub/subscriptions/subscription_download.py
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,7 @@ def download(self, dry_run: bool = False) -> FileHandlerTransactionLog:
preset=self._preset_options,
plugins=plugins,
enhanced_download_archive=self._enhanced_download_archive,
overrides=self.overrides,
working_directory=self.working_directory,
dry_run=dry_run,
)
Expand Down Expand Up @@ -395,6 +396,7 @@ def update_with_info_json(self, dry_run: bool = False) -> FileHandlerTransaction
preset=self._preset_options,
plugins=plugins,
enhanced_download_archive=self._enhanced_download_archive,
overrides=self.overrides,
working_directory=self.working_directory,
dry_run=dry_run,
)
Expand Down
8 changes: 8 additions & 0 deletions src/ytdl_sub/subscriptions/subscription_ytdl_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

from yt_dlp import match_filter_func

from ytdl_sub.config.overrides import Overrides
from ytdl_sub.config.plugin.plugin import Plugin
from ytdl_sub.config.preset import Preset
from ytdl_sub.downloaders.ytdl_options_builder import YTDLOptionsBuilder
Expand All @@ -33,12 +34,14 @@ def __init__(
preset: Preset,
plugins: List[Plugin],
enhanced_download_archive: EnhancedDownloadArchive,
overrides: Overrides,
working_directory: str,
dry_run: bool,
):
self._preset = preset
self._plugins = plugins
self._enhanced_download_archive = enhanced_download_archive
self._overrides = overrides
self._working_directory = working_directory
self._dry_run = dry_run

Expand Down Expand Up @@ -90,6 +93,11 @@ def _output_options(self) -> Dict:

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
)

return ytdl_options

Expand Down

0 comments on commit 87aa5e7

Please sign in to comment.