diff --git a/src/ytdl_sub/downloaders/url/downloader.py b/src/ytdl_sub/downloaders/url/downloader.py index 5cbadc4f..0032ca8f 100644 --- a/src/ytdl_sub/downloaders/url/downloader.py +++ b/src/ytdl_sub/downloaders/url/downloader.py @@ -9,8 +9,6 @@ from typing import Optional from typing import Set from typing import Tuple -from yt_dlp.utils import RejectedVideoReached - from ytdl_sub.config.plugin import PluginPriority from ytdl_sub.config.preset_options import Overrides from ytdl_sub.downloaders.source_plugin import SourcePlugin @@ -30,7 +28,6 @@ from ytdl_sub.entries.variables.kwargs import REQUESTED_SUBTITLES from ytdl_sub.entries.variables.kwargs import SOURCE_ENTRY from ytdl_sub.entries.variables.kwargs import SPONSORBLOCK_CHAPTERS from ytdl_sub.entries.variables.kwargs import UPLOAD_DATE_INDEX -from ytdl_sub.entries.variables.kwargs import YTDL_SUB_MATCH_FILTER_REJECT from ytdl_sub.utils.file_handler import FileHandler from ytdl_sub.utils.logger import Logger from ytdl_sub.utils.thumbnail import ThumbnailTypes @@ -485,16 +482,7 @@ class MultiUrlDownloader(SourcePlugin[MultiUrlValidator]): entry.title, ) - # Match-filters are applied at the download stage (not metadata stage). - # If the download is rejected, and match_filter is present in the ytdl options, - # then filter downstream in the match_filter plugin - try: - download_entry = self._extract_entry_info_with_retry(entry=entry) - except RejectedVideoReached: - if "match_filter" in self.download_ytdl_options: - entry.add_kwargs({YTDL_SUB_MATCH_FILTER_REJECT: True}) - return entry - raise + download_entry = self._extract_entry_info_with_retry(entry=entry) upload_date_idx = self._enhanced_download_archive.mapping.get_num_entries_with_upload_date( upload_date_standardized=entry.upload_date_standardized diff --git a/src/ytdl_sub/entries/variables/kwargs.py b/src/ytdl_sub/entries/variables/kwargs.py index 48cfa019..84f729f9 100644 --- a/src/ytdl_sub/entries/variables/kwargs.py +++ b/src/ytdl_sub/entries/variables/kwargs.py @@ -47,7 +47,6 @@ REQUESTED_SUBTITLES = _("requested_subtitles", backend=True) CHAPTERS = _("chapters", backend=True) YTDL_SUB_CUSTOM_CHAPTERS = _("ytdl_sub_custom_chapters", backend=True) YTDL_SUB_REGEX_SOURCE_VARS = _("ytdl_sub_regex_source_vars", backend=True) -YTDL_SUB_MATCH_FILTER_REJECT = _("ytdl_sub_match_filter_reject", backend=True) SPONSORBLOCK_CHAPTERS = _("sponsorblock_chapters", backend=True) SPLIT_BY_CHAPTERS_PARENT_ENTRY = _("split_by_chapters_parent_entry", backend=True) COMMENTS = _("comments", backend=True) diff --git a/src/ytdl_sub/plugins/match_filters.py b/src/ytdl_sub/plugins/match_filters.py index d8c24cc2..62a4bd46 100644 --- a/src/ytdl_sub/plugins/match_filters.py +++ b/src/ytdl_sub/plugins/match_filters.py @@ -1,13 +1,9 @@ from typing import Any from typing import List -from typing import Optional from typing import Tuple from ytdl_sub.config.plugin import Plugin -from ytdl_sub.config.plugin import PluginPriority from ytdl_sub.config.preset_options import OptionsDictValidator -from ytdl_sub.entries.entry import Entry -from ytdl_sub.entries.variables.kwargs import YTDL_SUB_MATCH_FILTER_REJECT from ytdl_sub.utils.logger import Logger from ytdl_sub.validators.validators import StringListValidator @@ -69,7 +65,6 @@ class MatchFiltersOptions(OptionsDictValidator): class MatchFiltersPlugin(Plugin[MatchFiltersOptions]): plugin_options_type = MatchFiltersOptions - priority = PluginPriority(modify_entry=PluginPriority.MODIFY_ENTRY_FIRST) def ytdl_options_match_filters(self) -> Tuple[List[str], List[str]]: """ @@ -82,14 +77,3 @@ class MatchFiltersPlugin(Plugin[MatchFiltersOptions]): match_filters.append(filter_str) return match_filters, [] - - def modify_entry(self, entry: Entry) -> Optional[Entry]: - """ - If an entry is marked as not being downloaded due to a match_filter reject, - do not propagate the entry further (especially since there is no entry file!) - """ - if entry.kwargs_get(YTDL_SUB_MATCH_FILTER_REJECT, False): - logger.info("Entry rejected by match-filter, skipping ..") - return None - - return entry