From 3823e276ed54c2c473fe222d6b20fa52d728457d Mon Sep 17 00:00:00 2001 From: Jesse Bannon Date: Wed, 27 Sep 2023 21:23:00 -0700 Subject: [PATCH] docs --- docs/config.rst | 23 ++++++++++++----------- docs/index.rst | 2 +- src/ytdl_sub/config/config_validator.py | 4 ++-- 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/docs/config.rst b/docs/config.rst index b8aae8e4..01e4ada9 100644 --- a/docs/config.rst +++ b/docs/config.rst @@ -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`. ------------------------------------------------------------------------------- diff --git a/docs/index.rst b/docs/index.rst index 1ef6df9f..246ff447 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -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 ======== diff --git a/src/ytdl_sub/config/config_validator.py b/src/ytdl_sub/config/config_validator.py index abb2f37c..20341088 100644 --- a/src/ytdl_sub/config/config_validator.py +++ b/src/ytdl_sub/config/config_validator.py @@ -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