enable for all
This commit is contained in:
parent
13dcfb9c10
commit
ff12e42ed2
12 changed files with 117 additions and 30 deletions
|
|
@ -22,6 +22,15 @@ Extracts audio from a video file.
|
|||
opus, vorbis, wav, and best to grab the best possible format at runtime.
|
||||
|
||||
|
||||
``enable``
|
||||
|
||||
:expected type: Optional[OverridesFormatter]
|
||||
:description:
|
||||
Can typically be left undefined to always default to enable. For preset convenience,
|
||||
this field can be set using an override variable to easily toggle whether this plugin
|
||||
is enabled or not via Boolean.
|
||||
|
||||
|
||||
``quality``
|
||||
|
||||
:expected type: Float
|
||||
|
|
@ -76,6 +85,15 @@ chapters and remove specific ones. Can also remove chapters using regex.
|
|||
Defaults to True. Embed chapters into the file.
|
||||
|
||||
|
||||
``enable``
|
||||
|
||||
:expected type: Optional[OverridesFormatter]
|
||||
:description:
|
||||
Can typically be left undefined to always default to enable. For preset convenience,
|
||||
this field can be set using an override variable to easily toggle whether this plugin
|
||||
is enabled or not via Boolean.
|
||||
|
||||
|
||||
``force_key_frames``
|
||||
|
||||
:expected type: Optional[Boolean]
|
||||
|
|
@ -148,6 +166,15 @@ granularity possible.
|
|||
Only download videos before this datetime.
|
||||
|
||||
|
||||
``enable``
|
||||
|
||||
:expected type: Optional[OverridesFormatter]
|
||||
:description:
|
||||
Can typically be left undefined to always default to enable. For preset convenience,
|
||||
this field can be set using an override variable to easily toggle whether this plugin
|
||||
is enabled or not via Boolean.
|
||||
|
||||
|
||||
----------------------------------------------------------------------------------------------------
|
||||
|
||||
download
|
||||
|
|
@ -259,6 +286,15 @@ Also supports custom ffmpeg conversions:
|
|||
with ``ffmpeg_post_process_args``. Defaults to ``yt-dlp``.
|
||||
|
||||
|
||||
``enable``
|
||||
|
||||
:expected type: Optional[OverridesFormatter]
|
||||
:description:
|
||||
Can typically be left undefined to always default to enable. For preset convenience,
|
||||
this field can be set using an override variable to easily toggle whether this plugin
|
||||
is enabled or not via Boolean.
|
||||
|
||||
|
||||
``ffmpeg_post_process_args``
|
||||
|
||||
:expected type: Optional[OverridesFormatter]
|
||||
|
|
@ -395,6 +431,15 @@ with a ``.nfo`` extension. You can add any values into the NFO.
|
|||
episode: "{upload_month}{upload_day_padded}"
|
||||
kodi_safe: False
|
||||
|
||||
``enable``
|
||||
|
||||
:expected type: Optional[OverridesFormatter]
|
||||
:description:
|
||||
Can typically be left undefined to always default to enable. For preset convenience,
|
||||
this field can be set using an override variable to easily toggle whether this plugin
|
||||
is enabled or not via Boolean.
|
||||
|
||||
|
||||
``kodi_safe``
|
||||
|
||||
:expected type: Optional[Boolean]
|
||||
|
|
@ -484,6 +529,15 @@ Usage:
|
|||
# optional
|
||||
kodi_safe: False
|
||||
|
||||
``enable``
|
||||
|
||||
:expected type: Optional[OverridesFormatter]
|
||||
:description:
|
||||
Can typically be left undefined to always default to enable. For preset convenience,
|
||||
this field can be set using an override variable to easily toggle whether this plugin
|
||||
is enabled or not via Boolean.
|
||||
|
||||
|
||||
``kodi_safe``
|
||||
|
||||
:expected type: Optional[Boolean]
|
||||
|
|
@ -800,6 +854,15 @@ and using ``title_and_description`` can regex match/exclude from either ``title`
|
|||
- "{upload_month}"
|
||||
- "{upload_day}"
|
||||
|
||||
``enable``
|
||||
|
||||
:expected type: Optional[OverridesFormatter]
|
||||
:description:
|
||||
Can typically be left undefined to always default to enable. For preset convenience,
|
||||
this field can be set using an override variable to easily toggle whether this plugin
|
||||
is enabled or not via Boolean.
|
||||
|
||||
|
||||
``skip_if_match_fails``
|
||||
|
||||
:expected type: Optional[Boolean]
|
||||
|
|
@ -880,6 +943,15 @@ It will set the respective language to the correct subtitle file.
|
|||
webm files can only embed "vtt" subtitle types.
|
||||
|
||||
|
||||
``enable``
|
||||
|
||||
:expected type: Optional[OverridesFormatter]
|
||||
:description:
|
||||
Can typically be left undefined to always default to enable. For preset convenience,
|
||||
this field can be set using an override variable to easily toggle whether this plugin
|
||||
is enabled or not via Boolean.
|
||||
|
||||
|
||||
``languages``
|
||||
|
||||
:expected type: Optional[List[String]]
|
||||
|
|
@ -931,6 +1003,15 @@ scripted.
|
|||
max: 36
|
||||
subscription_download_probability: 1.0
|
||||
|
||||
``enable``
|
||||
|
||||
:expected type: Optional[OverridesFormatter]
|
||||
:description:
|
||||
Can typically be left undefined to always default to enable. For preset convenience,
|
||||
this field can be set using an override variable to easily toggle whether this plugin
|
||||
is enabled or not via Boolean.
|
||||
|
||||
|
||||
``max_downloads_per_subscription``
|
||||
|
||||
:expected type: Optional[Range]
|
||||
|
|
|
|||
|
|
@ -64,7 +64,9 @@ class ToggleableOptionsDictValidator(OptionsDictValidator):
|
|||
_optional_keys = {"enable"}
|
||||
|
||||
def __init__(self, name, value):
|
||||
assert "enable" in self._optional_keys, ""
|
||||
assert (
|
||||
"enable" in self._optional_keys
|
||||
), f"{self.__class__.__name__} does not have enable as an optional field"
|
||||
super().__init__(name, value)
|
||||
|
||||
self._enable = self._validate_key(
|
||||
|
|
@ -74,9 +76,10 @@ class ToggleableOptionsDictValidator(OptionsDictValidator):
|
|||
@property
|
||||
def enable(self) -> OverridesBooleanFormatterValidator:
|
||||
"""
|
||||
:expected type: Optional[Boolean]
|
||||
:expected type: Optional[OverridesFormatter]
|
||||
:description:
|
||||
Whether to enable or disable this plugin when it is defined in a config. Defaults
|
||||
to enabled (True).
|
||||
Can typically be left undefined to always default to enable. For preset convenience,
|
||||
this field can be set using an override variable to easily toggle whether this plugin
|
||||
is enabled or not via Boolean.
|
||||
"""
|
||||
return self._enable
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ from typing import Set
|
|||
|
||||
from ytdl_sub.config.plugin.plugin import Plugin
|
||||
from ytdl_sub.config.plugin.plugin_operation import PluginOperation
|
||||
from ytdl_sub.config.validators.options import OptionsDictValidator
|
||||
from ytdl_sub.config.validators.options import ToggleableOptionsDictValidator
|
||||
from ytdl_sub.downloaders.ytdl_options_builder import YTDLOptionsBuilder
|
||||
from ytdl_sub.entries.entry import Entry
|
||||
from ytdl_sub.entries.script.variable_definitions import VARIABLES
|
||||
|
|
@ -21,7 +21,7 @@ from ytdl_sub.validators.validators import FloatValidator
|
|||
v: VariableDefinitions = VARIABLES
|
||||
|
||||
|
||||
class AudioExtractOptions(OptionsDictValidator):
|
||||
class AudioExtractOptions(ToggleableOptionsDictValidator):
|
||||
"""
|
||||
Extracts audio from a video file.
|
||||
|
||||
|
|
@ -35,7 +35,7 @@ class AudioExtractOptions(OptionsDictValidator):
|
|||
"""
|
||||
|
||||
_required_keys = {"codec"}
|
||||
_optional_keys = {"quality"}
|
||||
_optional_keys = {"enable", "quality"}
|
||||
|
||||
@classmethod
|
||||
def partial_validate(cls, name: str, value: Any) -> None:
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ from typing import Set
|
|||
|
||||
from ytdl_sub.config.plugin.plugin import Plugin
|
||||
from ytdl_sub.config.plugin.plugin_operation import PluginOperation
|
||||
from ytdl_sub.config.validators.options import OptionsDictValidator
|
||||
from ytdl_sub.config.validators.options import ToggleableOptionsDictValidator
|
||||
from ytdl_sub.downloaders.ytdl_options_builder import YTDLOptionsBuilder
|
||||
from ytdl_sub.entries.entry import Entry
|
||||
from ytdl_sub.entries.entry import ytdl_sub_chapters_from_comments
|
||||
|
|
@ -59,7 +59,7 @@ class SponsorBlockCategoryListValidator(ListValidator[SponsorBlockCategoriesVali
|
|||
_inner_list_type = SponsorBlockCategoriesValidator
|
||||
|
||||
|
||||
class ChaptersOptions(OptionsDictValidator):
|
||||
class ChaptersOptions(ToggleableOptionsDictValidator):
|
||||
"""
|
||||
Embeds chapters to video files if they are present. Additional options to add SponsorBlock
|
||||
chapters and remove specific ones. Can also remove chapters using regex.
|
||||
|
|
@ -90,6 +90,7 @@ class ChaptersOptions(OptionsDictValidator):
|
|||
"""
|
||||
|
||||
_optional_keys = {
|
||||
"enable",
|
||||
"embed_chapters",
|
||||
"allow_chapters_from_comments",
|
||||
"sponsorblock_categories",
|
||||
|
|
|
|||
|
|
@ -3,12 +3,12 @@ from typing import Optional
|
|||
from typing import Tuple
|
||||
|
||||
from ytdl_sub.config.plugin.plugin import Plugin
|
||||
from ytdl_sub.config.validators.options import OptionsDictValidator
|
||||
from ytdl_sub.config.validators.options import ToggleableOptionsDictValidator
|
||||
from ytdl_sub.utils.datetime import to_date_str
|
||||
from ytdl_sub.validators.string_datetime import StringDatetimeValidator
|
||||
|
||||
|
||||
class DateRangeOptions(OptionsDictValidator):
|
||||
class DateRangeOptions(ToggleableOptionsDictValidator):
|
||||
"""
|
||||
Only download files uploaded within the specified date range.
|
||||
Dates must adhere to a yt-dlp datetime. From their docs:
|
||||
|
|
@ -31,7 +31,7 @@ class DateRangeOptions(OptionsDictValidator):
|
|||
after: "today-2weeks"
|
||||
"""
|
||||
|
||||
_optional_keys = {"before", "after"}
|
||||
_optional_keys = {"enable", "before", "after"}
|
||||
|
||||
def __init__(self, name, value):
|
||||
super().__init__(name, value)
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ from typing import Set
|
|||
from ytdl_sub.config.overrides import Overrides
|
||||
from ytdl_sub.config.plugin.plugin import Plugin
|
||||
from ytdl_sub.config.plugin.plugin_operation import PluginOperation
|
||||
from ytdl_sub.config.validators.options import OptionsDictValidator
|
||||
from ytdl_sub.config.validators.options import ToggleableOptionsDictValidator
|
||||
from ytdl_sub.entries.entry import Entry
|
||||
from ytdl_sub.entries.script.variable_definitions import VARIABLES
|
||||
from ytdl_sub.entries.script.variable_definitions import VariableDefinitions
|
||||
|
|
@ -28,7 +28,7 @@ class FileConvertWithValidator(StringSelectValidator):
|
|||
_select_values = {"yt-dlp", "ffmpeg"}
|
||||
|
||||
|
||||
class FileConvertOptions(OptionsDictValidator):
|
||||
class FileConvertOptions(ToggleableOptionsDictValidator):
|
||||
"""
|
||||
Converts video files from one extension to another.
|
||||
|
||||
|
|
@ -56,7 +56,7 @@ class FileConvertOptions(OptionsDictValidator):
|
|||
"""
|
||||
|
||||
_required_keys = {"convert_to"}
|
||||
_optional_keys = {"convert_with", "ffmpeg_post_process_args"}
|
||||
_optional_keys = {"enable", "convert_with", "ffmpeg_post_process_args"}
|
||||
|
||||
@classmethod
|
||||
def partial_validate(cls, name: str, value: Any) -> None:
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ from typing import List
|
|||
from typing import Tuple
|
||||
|
||||
from ytdl_sub.config.plugin.plugin import Plugin
|
||||
from ytdl_sub.config.validators.options import OptionsDictValidator
|
||||
from ytdl_sub.config.validators.options import ToggleableOptionsDictValidator
|
||||
from ytdl_sub.utils.logger import Logger
|
||||
from ytdl_sub.validators.validators import StringListValidator
|
||||
|
||||
|
|
@ -56,7 +56,7 @@ def combine_filters(filters: List[str], to_combine: List[str]) -> List[str]:
|
|||
return output_filters
|
||||
|
||||
|
||||
class MatchFiltersOptions(OptionsDictValidator):
|
||||
class MatchFiltersOptions(ToggleableOptionsDictValidator):
|
||||
"""
|
||||
Set ``--match-filters`` to pass into yt-dlp to filter entries from being downloaded.
|
||||
Uses the same syntax as yt-dlp. An entry will be downloaded if any one of the filters are met.
|
||||
|
|
@ -74,7 +74,7 @@ class MatchFiltersOptions(OptionsDictValidator):
|
|||
# - "availability=?public"
|
||||
"""
|
||||
|
||||
_optional_keys = {"filters"}
|
||||
_optional_keys = {"enable", "filters"}
|
||||
|
||||
@classmethod
|
||||
def partial_validate(cls, name: str, value: Any) -> None:
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ from typing import List
|
|||
from typing import Optional
|
||||
|
||||
from ytdl_sub.config.plugin.plugin import Plugin
|
||||
from ytdl_sub.config.validators.options import OptionsDictValidator
|
||||
from ytdl_sub.config.validators.options import ToggleableOptionsDictValidator
|
||||
from ytdl_sub.entries.entry import Entry
|
||||
from ytdl_sub.utils.file_handler import FileHandler
|
||||
from ytdl_sub.utils.file_handler import FileMetadata
|
||||
|
|
@ -23,13 +23,13 @@ from ytdl_sub.validators.string_formatter_validators import StringFormatterValid
|
|||
from ytdl_sub.validators.validators import BoolValidator
|
||||
|
||||
|
||||
class SharedNfoTagsOptions(OptionsDictValidator):
|
||||
class SharedNfoTagsOptions(ToggleableOptionsDictValidator):
|
||||
"""
|
||||
Shared code between NFO tags and Ouptut Directory NFO Tags
|
||||
"""
|
||||
|
||||
_required_keys = {"nfo_name", "nfo_root", "tags"}
|
||||
_optional_keys = {"kodi_safe"}
|
||||
_optional_keys = {"enable", "kodi_safe"}
|
||||
|
||||
@classmethod
|
||||
def partial_validate(cls, name: str, value: Any) -> None:
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ from typing import Set
|
|||
from ytdl_sub.config.overrides import Overrides
|
||||
from ytdl_sub.config.plugin.plugin import Plugin
|
||||
from ytdl_sub.config.plugin.plugin_operation import PluginOperation
|
||||
from ytdl_sub.config.validators.options import OptionsDictValidator
|
||||
from ytdl_sub.config.validators.options import ToggleableOptionsDictValidator
|
||||
from ytdl_sub.entries.entry import Entry
|
||||
from ytdl_sub.script.parser import parse
|
||||
from ytdl_sub.script.utils.exceptions import RuntimeException
|
||||
|
|
@ -120,7 +120,7 @@ class FromSourceVariablesRegex(DictValidator):
|
|||
}
|
||||
|
||||
|
||||
class RegexOptions(OptionsDictValidator):
|
||||
class RegexOptions(ToggleableOptionsDictValidator):
|
||||
r"""
|
||||
.. attention::
|
||||
|
||||
|
|
@ -218,7 +218,7 @@ class RegexOptions(OptionsDictValidator):
|
|||
"""
|
||||
|
||||
_required_keys = {"from"}
|
||||
_optional_keys = {"skip_if_match_fails"}
|
||||
_optional_keys = {"enable", "skip_if_match_fails"}
|
||||
|
||||
@classmethod
|
||||
def partial_validate(cls, name: str, value: Any) -> None:
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ from typing import Set
|
|||
|
||||
from ytdl_sub.config.plugin.plugin import Plugin
|
||||
from ytdl_sub.config.plugin.plugin_operation import PluginOperation
|
||||
from ytdl_sub.config.validators.options import OptionsDictValidator
|
||||
from ytdl_sub.config.validators.options import ToggleableOptionsDictValidator
|
||||
from ytdl_sub.downloaders.ytdl_options_builder import YTDLOptionsBuilder
|
||||
from ytdl_sub.entries.entry import Entry
|
||||
from ytdl_sub.entries.script.variable_definitions import VARIABLES
|
||||
|
|
@ -31,7 +31,7 @@ class SubtitlesTypeValidator(StringSelectValidator):
|
|||
_select_values = SUBTITLE_EXTENSIONS
|
||||
|
||||
|
||||
class SubtitleOptions(OptionsDictValidator):
|
||||
class SubtitleOptions(ToggleableOptionsDictValidator):
|
||||
"""
|
||||
Defines how to download and store subtitles. Using this plugin creates two new variables:
|
||||
``lang`` and ``subtitles_ext``. ``lang`` is dynamic since you can download multiple subtitles.
|
||||
|
|
@ -52,6 +52,7 @@ class SubtitleOptions(OptionsDictValidator):
|
|||
"""
|
||||
|
||||
_optional_keys = {
|
||||
"enable",
|
||||
"subtitles_name",
|
||||
"subtitles_type",
|
||||
"embed_subtitles",
|
||||
|
|
|
|||
|
|
@ -84,7 +84,8 @@ class ThrottleProtectionOptions(ToggleableOptionsDictValidator):
|
|||
subscription_download_probability: 1.0
|
||||
"""
|
||||
|
||||
_optional_keys = ToggleableOptionsDictValidator._optional_keys | {
|
||||
_optional_keys = {
|
||||
"enable",
|
||||
"sleep_per_download_s",
|
||||
"sleep_per_subscription_s",
|
||||
"max_downloads_per_subscription",
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ from typing import Any
|
|||
from typing import Dict
|
||||
|
||||
from ytdl_sub.config.plugin.plugin import Plugin
|
||||
from ytdl_sub.config.validators.options import OptionsDictValidator
|
||||
from ytdl_sub.config.validators.options import ToggleableOptionsDictValidator
|
||||
from ytdl_sub.entries.entry import Entry
|
||||
from ytdl_sub.utils.ffmpeg import add_ffmpeg_metadata_key_values
|
||||
from ytdl_sub.utils.file_handler import FileMetadata
|
||||
|
|
@ -13,7 +13,7 @@ from ytdl_sub.validators.string_formatter_validators import DictFormatterValidat
|
|||
logger = Logger.get("video-tags")
|
||||
|
||||
|
||||
class VideoTagsOptions(OptionsDictValidator):
|
||||
class VideoTagsOptions(ToggleableOptionsDictValidator):
|
||||
"""
|
||||
Adds tags to every downloaded video file using ffmpeg ``-metadata key=value`` args.
|
||||
|
||||
|
|
@ -27,7 +27,7 @@ class VideoTagsOptions(OptionsDictValidator):
|
|||
description: "{description}"
|
||||
"""
|
||||
|
||||
_optional_keys = {"tags"}
|
||||
_optional_keys = {"enable", "tags"}
|
||||
_allow_extra_keys = True
|
||||
|
||||
@classmethod
|
||||
|
|
|
|||
Loading…
Reference in a new issue