fix property names

This commit is contained in:
Jesse Bannon 2026-02-16 23:27:46 -08:00
parent 99663bc6f3
commit 3a11b53b1f
4 changed files with 23 additions and 112 deletions

View file

@ -45,12 +45,6 @@ Enables modifying subscription files using info.json files using the argument
``--update-with-info-json``. This feature is still being tested and has the ability to
destroy files. Ensure you have a full backup before usage. You have been warned!
``leaf_name``
Returns
-------
"name" from the first.element.of.the.name
ffmpeg_path
-----------
Path to ffmpeg executable. (default ``/usr/bin/ffmpeg`` for Linux,
@ -65,12 +59,6 @@ file_name_max_bytes
-------------------
Max file name size in bytes. Most OS's typically default to 255 bytes.
leaf_name
---------
Returns
-------
"name" from the first.element.of.the.name
lock_directory
--------------
The directory to temporarily store file locks, which prevents multiple instances
@ -89,12 +77,6 @@ writes log files for the subscription both for successful downloads and when it
encounters an error while downloading. When this key is ``False``, only write
log files for errors. (default ``True``)
``leaf_name``
Returns
-------
"name" from the first.element.of.the.name
``logs_directory``
Write log files to this directory with names like

View file

@ -36,12 +36,6 @@ Extracts audio from a video file.
this field can be set using an override variable to easily toggle whether this plugin
is enabled or not via Boolean.
``leaf_name``
Returns
-------
"name" from the first.element.of.the.name
``quality``
:expected type: Float
@ -108,12 +102,6 @@ chapters and remove specific ones. Can also remove chapters using regex.
Defaults to False. Force keyframes at cuts when removing sections. This is slow due to
needing a re-encode, but the resulting video may have fewer artifacts around the cuts.
``leaf_name``
Returns
-------
"name" from the first.element.of.the.name
``remove_chapters_regex``
:expected type: Optional[List[RegexString]
@ -192,12 +180,6 @@ intended download files.
this field can be set using an override variable to easily toggle whether this plugin
is enabled or not via Boolean.
``leaf_name``
Returns
-------
"name" from the first.element.of.the.name
``type``
:expected type: Optional[OverridesFormatter]
@ -336,12 +318,6 @@ Also supports custom ffmpeg conversions:
The output file will use the extension specified in ``convert_to``. Post-processing args
can still be set with ``convert_with`` set to ``yt-dlp``.
``leaf_name``
Returns
-------
"name" from the first.element.of.the.name
----------------------------------------------------------------------------------------------------
filter_exclude
@ -485,12 +461,6 @@ with a ``.nfo`` extension. You can add any values into the NFO.
emojis and some foreign language characters. Setting this to True will replace those
characters with '□'.
``leaf_name``
Returns
-------
"name" from the first.element.of.the.name
``nfo_name``
:expected type: EntryFormatter
@ -584,12 +554,6 @@ Usage:
emojis and some foreign language characters. Setting this to True will replace those
characters with '□'.
``leaf_name``
Returns
-------
"name" from the first.element.of.the.name
``nfo_name``
:expected type: EntryFormatter
@ -731,12 +695,6 @@ Defines where to output files and thumbnails after all post-processing has compl
Only keeps N most recently uploaded videos. If set to <= 0, ``keep_max_files`` will not be
applied. Can be used in conjunction with ``keep_files_before`` and ``keep_files_after``.
``leaf_name``
Returns
-------
"name" from the first.element.of.the.name
``maintain_download_archive``
:expected type: Optional[Boolean]
@ -811,16 +769,6 @@ In addition, any override variable defined will automatically create a ``sanitiz
for use. In the example above, ``output_directory_sanitized`` will exist and perform
sanitization on the value when used.
``dict_with_parsed_format_strings``
Returns dict with the parsed format strings.
``leaf_name``
Returns
-------
"name" from the first.element.of.the.name
----------------------------------------------------------------------------------------------------
split_by_chapters
@ -843,12 +791,6 @@ used with no modifications.
split_by_chapters:
when_no_chapters: "pass"
``leaf_name``
Returns
-------
"name" from the first.element.of.the.name
``when_no_chapters``
:expected type: String
@ -916,12 +858,6 @@ Usage:
emojis and some foreign language characters. Setting this to True will replace those
characters with '□'.
``leaf_name``
Returns
-------
"name" from the first.element.of.the.name
``nfo_name``
:expected type: EntryFormatter
@ -1009,12 +945,6 @@ It will set the respective language to the correct subtitle file.
Language code(s) that are required to be present for downloads to continue. If missing,
ytdl-sub will throw an error. NOTE: currently this only checks file-based subtitles.
``leaf_name``
Returns
-------
"name" from the first.element.of.the.name
``subtitles_name``
:expected type: Optional[EntryFormatter]
@ -1070,12 +1000,6 @@ Range min and max values support static override variables within their definiti
this field can be set using an override variable to easily toggle whether this plugin
is enabled or not via Boolean.
``leaf_name``
Returns
-------
"name" from the first.element.of.the.name
``max_downloads_per_subscription``
:expected type: Optional[Range]
@ -1160,13 +1084,3 @@ for more details.
where each key is a ytdl argument. Include in the example are some popular ytdl_options.
``dict_with_parsed_format_strings``
Returns dict with the parsed format strings.
``leaf_name``
Returns
-------
"name" from the first.element.of.the.name

View file

@ -9,7 +9,7 @@ class ConfigurationDocGen(DocGen):
LOCATION = Path("docs/source/config_reference/config_yaml.rst")
DOCSTRING_LOCATION = (
"The respective function docstrings within ytdl_sub/config/config_validator.py"
"The respective function docstrings within ytdl_sub/config/config_validator.py"
)
@classmethod
@ -20,7 +20,7 @@ class ConfigurationDocGen(DocGen):
offset=0,
skip_properties=False,
recurse_property_options=True,
property_sections=True
property_sections=True,
)
return docs

View file

@ -6,7 +6,8 @@ from typing import List
from typing import Optional
from typing import Type
from ytdl_sub.script.utils.type_checking import is_optional, get_optional_type
from ytdl_sub.script.utils.type_checking import get_optional_type
from ytdl_sub.script.utils.type_checking import is_optional
from ytdl_sub.validators.validators import Validator
LEVEL_CHARS: Dict[int, str] = {0: "=", 1: "-", 2: "~", 3: "^"}
@ -23,10 +24,17 @@ def _should_filter_property(property_name: str) -> bool:
"list",
"script",
"unresolvable",
"dict_with_parsed_format_strings",
"leaf_name",
)
def _is_validator_property(options: Type[Validator], property_name: str) -> Optional[Type[Validator]]:
property_return_type = inspect.getfullargspec(getattr(options, property_name).fget).annotations['return']
def _is_validator_property(
options: Type[Validator], property_name: str
) -> Optional[Type[Validator]]:
property_return_type = inspect.getfullargspec(getattr(options, property_name).fget).annotations[
"return"
]
if is_optional(property_return_type):
property_return_type = get_optional_type(property_return_type)
@ -98,7 +106,12 @@ def get_function_docs(
def generate_options_validator_docs(
name: str, options: Type[Validator], offset: int, skip_properties: bool, recurse_property_options: bool = False, property_sections: bool = False
name: str,
options: Type[Validator],
offset: int,
skip_properties: bool,
recurse_property_options: bool = False,
property_sections: bool = False,
) -> str:
docs = ""
docs += section(name, level=offset + 0)
@ -111,14 +124,16 @@ def generate_options_validator_docs(
property_names = [prop for prop in properties(options) if not _should_filter_property(prop)]
for property_name in sorted(property_names):
maybe_validator_property = _is_validator_property(options, property_name) if recurse_property_options else None
maybe_validator_property = (
_is_validator_property(options, property_name) if recurse_property_options else None
)
if maybe_validator_property:
docs += generate_options_validator_docs(
name=property_name,
options=maybe_validator_property,
offset=offset + 1,
skip_properties=False,
recurse_property_options=False
recurse_property_options=False,
)
else:
docs += get_function_docs(