This commit is contained in:
Jesse Bannon 2023-09-27 21:23:00 -07:00
parent 2d8a4f99b3
commit 3823e276ed
3 changed files with 15 additions and 14 deletions

View file

@ -2,7 +2,7 @@ Config
======
ytdl-sub is configured using a ``config.yaml`` file.
.. _config_yaml:
.. _config:
config.yaml
-----------
@ -318,8 +318,10 @@ by using the file-wide ``__preset__``:
This ``subscription.yaml`` is equivalent to the one above it because all
subscriptions automatically set ``__preset__`` as a `parent preset`_.
File Subscription Value
^^^^^^^^^^^^^^^^^^^^^^^
.. _subscription value:
Subscription Value
^^^^^^^^^^^^^^^^^^^
With a clever config and use of ``__preset__``, your subscriptions can typically boil
down to a name and url. You can set ``__value__`` to the name of an override variable,
and use the override variable ``subscription_name`` to achieve one-liner subscriptions.
@ -329,20 +331,19 @@ Using the example above, we can do:
:caption: subscription.yaml
__preset__:
preset: "playlist_preset_ex"
preset:
- "tv_show"
overrides:
playlist_name: "{subscription_name}"
tv_show_name: "{subscription_name}"
__value__: "url"
# single-line subscription
"diy-playlist": "https://youtube.com/playlist?list=UCsvn_Po0SmunchJYtttWpOxMg"
``"diy-playlist"`` gets assigned to the ``playlist_name`` override variable by setting
it with ``subscription_name`` , and the url gets assigned to ``url`` by setting ``__value__``
to write values to it.
# single-line subscription, sets "Brandon Acker" and the subscription value
# to the override variables tv_show_name and url
"Brandon Acker": "https://www.youtube.com/@brandonacker"
Traditional subscriptions that can override presets will still work when using ``__value__``.
``__value__`` can also be set within a :ref:`config`.
-------------------------------------------------------------------------------

View file

@ -13,7 +13,7 @@ ytdl-sub configs, check out the
For navigating config docs, use the left-side bar on the
:ref:`config_yaml` page to find every available ytdl-sub field.
:ref:`config` page to find every available ytdl-sub field.
Contents
========

View file

@ -237,8 +237,8 @@ class ConfigOptions(StrictDictValidator):
@property
def subscription_value(self) -> Optional[str]:
"""
Optional. Sets the (TODO: LINK)
subscription value key for subscription files that use this config.
Optional. Sets the :ref:`subscription value` for subscription
files that use this config.
"""
return self._subscription_value.value if self._subscription_value else None