fix override docs
This commit is contained in:
parent
d68dd89d88
commit
2ebfb2abfd
7 changed files with 148 additions and 74 deletions
27
README.md
27
README.md
|
|
@ -67,8 +67,10 @@ __preset__:
|
|||
ytdl_options:
|
||||
cookiefile: "/config/cookie.txt"
|
||||
|
||||
###############################################################################
|
||||
# Subscriptions nested under this will use the `Plex TV Show by Date` preset.
|
||||
###################################################################
|
||||
# Subscriptions nested under this will use the
|
||||
# `Plex TV Show by Date` preset.
|
||||
#
|
||||
# Can choose between:
|
||||
# - Plex TV Show by Date:
|
||||
# - Jellyfin TV Show by Date:
|
||||
|
|
@ -96,9 +98,9 @@ Plex TV Show by Date:
|
|||
= News | Only Recent:
|
||||
"BBC News": "https://www.youtube.com/@BBCNews"
|
||||
|
||||
###############################################################################
|
||||
# Subscriptions nested under these will use the various prebuilt music presets
|
||||
|
||||
###################################################################
|
||||
# Subscriptions nested under these will use the various prebuilt
|
||||
# music presets
|
||||
YouTube Releases:
|
||||
= Jazz: # Sets genre tag to "Jazz"
|
||||
"Thelonious Monk": "https://www.youtube.com/@theloniousmonk3870/releases"
|
||||
|
|
@ -118,7 +120,7 @@ Bandcamp:
|
|||
= Lofi:
|
||||
"Emily Hopkins": "https://emilyharpist.bandcamp.com/"
|
||||
|
||||
###############################################################################
|
||||
###################################################################
|
||||
# Can choose between:
|
||||
# - Plex Music Videos:
|
||||
# - Jellyfin Music Videos:
|
||||
|
|
@ -188,8 +190,6 @@ for detailed information on all config fields.
|
|||
`ytdl-sub` can be installed on the following platforms.
|
||||
|
||||
- [Docker Compose](https://ytdl-sub.readthedocs.io/en/latest/install.html#docker-compose_)
|
||||
- [with CPU passthrough](https://ytdl-sub.readthedocs.io/en/latest/install.html#cpu-passthrough)
|
||||
- [with GPU passthrough](https://ytdl-sub.readthedocs.io/en/latest/install.html#nvidia-gpu-passthrough)
|
||||
- [Docker CLI](https://ytdl-sub.readthedocs.io/en/latest/install.html#docker)
|
||||
- [Windows](https://ytdl-sub.readthedocs.io/en/latest/install.html#windows)
|
||||
- [Unraid](https://ytdl-sub.readthedocs.io/en/latest/install.html#unraid)
|
||||
|
|
@ -199,12 +199,11 @@ for detailed information on all config fields.
|
|||
- [Local Install](https://ytdl-sub.readthedocs.io/en/latest/install.html#local-install)
|
||||
- [Local Docker Build](https://ytdl-sub.readthedocs.io/en/latest/install.html#local-docker-build)
|
||||
|
||||
### Docker Installs
|
||||
Docker installs can be either headless or use the GUI image, which is the
|
||||
[LSIO](https://www.linuxserver.io/)
|
||||
[code-server image](https://hub.docker.com/r/linuxserver/code-server)
|
||||
with `ytdl-sub` preinstalled. It is highly recommended to use this to manage
|
||||
`ytdl-sub` from browser.
|
||||
### Docker Installation
|
||||
Docker installs can be either headless or use the GUI image, which comprises
|
||||
[LSIO's](https://www.linuxserver.io/)
|
||||
[code-server](https://hub.docker.com/r/linuxserver/code-server)
|
||||
Docker image with `ytdl-sub` preinstalled. This is the recommended way to use ``ytdl-sub``.
|
||||
|
||||

|
||||
|
||||
|
|
|
|||
|
|
@ -423,8 +423,9 @@ Source Variables
|
|||
Override Variables
|
||||
------------------
|
||||
|
||||
.. autoclass:: ytdl_sub.config.preset_options.OverridesVariables()
|
||||
.. autoclass:: ytdl_sub.entries.variables.override_variables.OverrideVariables()
|
||||
:members:
|
||||
:member-order: bysource
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
|
|
|
|||
|
|
@ -3,22 +3,62 @@ Install
|
|||
``ytdl-sub`` can be installed on the following platforms.
|
||||
|
||||
.. contents::
|
||||
:depth: 2
|
||||
:depth: 3
|
||||
|
||||
All installations require a 64-bit CPU. 32-bit is not supported.
|
||||
|
||||
Docker Compose
|
||||
--------------
|
||||
The ytdl-sub docker image uses
|
||||
`Linux Server's <https://www.linuxserver.io/>`_
|
||||
`base alpine image <https://github.com/linuxserver/docker-baseimage-alpine/>`_
|
||||
It looks, feels, and operates like other LinuxServer images. This is the
|
||||
recommended way to use ytdl-sub.
|
||||
The ytdl-sub Docker images use
|
||||
`LSIO-based images <https://www.linuxserver.io/>`_
|
||||
and installs ytdl-sub on top. There are a few flavors to choose from.
|
||||
|
||||
The docker image is intended to be used as a console. For automating
|
||||
``subscriptions.yaml`` downloads to pull new media, see
|
||||
For automating ``subscriptions.yaml`` downloads to pull new media, see
|
||||
`this guide <https://github.com/jmbannon/ytdl-sub/wiki/7.-Automate-Downloading-New-Content-Using-Your-Configs/>`_
|
||||
on how set up a cron job in the docker container.
|
||||
on how set up a cron job in any of the docker containers.
|
||||
|
||||
GUI
|
||||
^^^^
|
||||
|
||||
The GUI image uses LSIO's
|
||||
`code-server <https://hub.docker.com/r/linuxserver/code-server>`_
|
||||
for its base image. More info on other code-server environment variables
|
||||
can be found within its documentation. This is the recommended way to use ``ytdl-sub``.
|
||||
|
||||
After starting, code-server will be running at http://localhost:8443/
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
services:
|
||||
ytdl-sub:
|
||||
image: ghcr.io/jmbannon/ytdl-sub-gui:latest
|
||||
container_name: ytdl-sub
|
||||
environment:
|
||||
- PUID=1000
|
||||
- PGID=1000
|
||||
- TZ=America/Los_Angeles
|
||||
volumes:
|
||||
- <path/to/ytdl-sub/config>:/config
|
||||
- <path/to/tv_shows>:/tv_shows # optional
|
||||
- <path/to/movies>:/movies # optional
|
||||
- <path/to/music_videos>:/music_videos # optional
|
||||
- <path/to/music>:/music # optional
|
||||
ports:
|
||||
- 8443:8443
|
||||
restart: unless-stopped
|
||||
|
||||
Headless
|
||||
^^^^^^^^^^
|
||||
|
||||
The headless image uses LSIO's
|
||||
`baseimage-alpine <https://github.com/linuxserver/docker-baseimage-alpine>`_
|
||||
for its base image. With this image, ``ytdl-sub`` is meant to be ran from console
|
||||
via exec'ing into the image using the command:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
docker exec -u abc -it ytdl-sub /bin/bash
|
||||
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
|
|
@ -39,46 +79,51 @@ on how set up a cron job in the docker container.
|
|||
- <path/to/music>:/music # optional
|
||||
restart: unless-stopped
|
||||
|
||||
CPU Passthrough
|
||||
^^^^^^^^^^^^^^^^^^^^^^
|
||||
For CPU passthrough, you must use the ``ytdl-sub`` Ubuntu version with the following additions:
|
||||
Passthrough
|
||||
^^^^^^^^^^^
|
||||
For CPU or GPU passthrough, you must use either the GUI image or the headless Ubuntu image
|
||||
``ghcr.io/jmbannon/ytdl-sub:ubuntu-latest``.
|
||||
|
||||
The docker-compose examples use the GUI image.
|
||||
|
||||
CPU
|
||||
____
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
services:
|
||||
ytdl-sub:
|
||||
image: ghcr.io/jmbannon/ytdl-sub:ubuntu-latest
|
||||
image: ghcr.io/jmbannon/ytdl-sub-gui:latest
|
||||
container_name: ytdl-sub
|
||||
environment:
|
||||
- PUID=1000
|
||||
- PGID=1000
|
||||
- TZ=America/Los_Angeles
|
||||
- DOCKER_MODS=linuxserver/mods:universal-cron
|
||||
volumes:
|
||||
- <path/to/ytdl-sub/config>:/config
|
||||
- <path/to/tv_shows>:/tv_shows # optional
|
||||
- <path/to/movies>:/movies # optional
|
||||
- <path/to/music_videos>:/music_videos # optional
|
||||
- <path/to/music>:/music # optional
|
||||
ports:
|
||||
- 8443:8443
|
||||
devices:
|
||||
- /dev/dri:/dev/dri # CPU passthrough
|
||||
restart: unless-stopped
|
||||
|
||||
Nvidia GPU Passthrough
|
||||
^^^^^^^^^^^^^^^^^^^^^^
|
||||
For GPU passthrough, you must use the ``ytdl-sub`` Ubuntu version with the following additions:
|
||||
GPU
|
||||
____
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
services:
|
||||
ytdl-sub:
|
||||
image: ghcr.io/jmbannon/ytdl-sub:ubuntu-latest
|
||||
image: ghcr.io/jmbannon/ytdl-sub-gui:latest
|
||||
container_name: ytdl-sub
|
||||
environment:
|
||||
- PUID=1000
|
||||
- PGID=1000
|
||||
- TZ=America/Los_Angeles
|
||||
- DOCKER_MODS=linuxserver/mods:universal-cron
|
||||
- NVIDIA_DRIVER_CAPABILITIES=all # Nvidia ENV args
|
||||
- NVIDIA_VISIBLE_DEVICES=all
|
||||
volumes:
|
||||
|
|
@ -87,6 +132,8 @@ For GPU passthrough, you must use the ``ytdl-sub`` Ubuntu version with the follo
|
|||
- <path/to/movies>:/movies # optional
|
||||
- <path/to/music_videos>:/music_videos # optional
|
||||
- <path/to/music>:/music # optional
|
||||
ports:
|
||||
- 8443:8443
|
||||
deploy:
|
||||
resources:
|
||||
reservations:
|
||||
|
|
@ -103,14 +150,14 @@ Docker
|
|||
-e PUID=1000 \
|
||||
-e PGID=1000 \
|
||||
-e TZ=America/Los_Angeles \
|
||||
-e DOCKER_MODS=linuxserver/mods:universal-cron \
|
||||
-p 8443:8443 \
|
||||
-v <path/to/ytdl-sub/config>:/config \
|
||||
-v <OPTIONAL/path/to/tv_shows>:/tv_shows \
|
||||
-v <OPTIONAL/path/to/movies>:/movies \
|
||||
-v <OPTIONAL/path/to/music_videos>:/music_videos \
|
||||
-v <OPTIONAL/path/to/music>:/music \
|
||||
--restart unless-stopped \
|
||||
ghcr.io/jmbannon/ytdl-sub:latest
|
||||
ghcr.io/jmbannon/ytdl-sub-gui:latest
|
||||
|
||||
Windows
|
||||
--------------
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ from yt_dlp.utils import sanitize_filename
|
|||
|
||||
from ytdl_sub.config.defaults import DEFAULT_DOWNLOAD_ARCHIVE_NAME
|
||||
from ytdl_sub.entries.entry import Entry
|
||||
from ytdl_sub.subscriptions.utils import SUBSCRIPTION_NAME
|
||||
from ytdl_sub.entries.variables.override_variables import SUBSCRIPTION_NAME
|
||||
from ytdl_sub.utils.exceptions import ValidationException
|
||||
from ytdl_sub.validators.file_path_validators import OverridesStringFormatterFilePathValidator
|
||||
from ytdl_sub.validators.file_path_validators import StringFormatterFileNameValidator
|
||||
|
|
|
|||
57
src/ytdl_sub/entries/variables/override_variables.py
Normal file
57
src/ytdl_sub/entries/variables/override_variables.py
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
SUBSCRIPTION_NAME = "subscription_name"
|
||||
SUBSCRIPTION_VALUE = "subscription_value"
|
||||
|
||||
|
||||
class OverrideVariables:
|
||||
@classmethod
|
||||
def subscription_name(cls) -> str:
|
||||
"""
|
||||
Name of the subscription
|
||||
"""
|
||||
return SUBSCRIPTION_NAME
|
||||
|
||||
@classmethod
|
||||
def subscription_value(cls) -> str:
|
||||
"""
|
||||
For subscriptions in the form of
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
"Subscription Name": "https://..."
|
||||
|
||||
``subscription_value`` gets set to ``https://...``.
|
||||
"""
|
||||
return SUBSCRIPTION_VALUE
|
||||
|
||||
@classmethod
|
||||
def subscription_indent_i(cls, index: int) -> str:
|
||||
"""
|
||||
For subscriptions in the form of
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
Preset | = Indent Value 1:
|
||||
= Indent Value 2:
|
||||
"Subscription Name": "https://..."
|
||||
|
||||
``subscription_indent_1`` and ``subscription_indent_2`` get set to
|
||||
``Indent Value 1`` and ``Indent Value 2``.
|
||||
"""
|
||||
return f"subscription_indent_{index + 1}"
|
||||
|
||||
@classmethod
|
||||
def subscription_value_i(cls, index: int) -> str:
|
||||
"""
|
||||
For subscriptions in the form of
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
"Subscription Name":
|
||||
- "https://url1.com/..."
|
||||
- "https://url2.com/..."
|
||||
|
||||
``subscription_value_1`` and ``subscription_value_2`` get set to ``https://url1.com/...``
|
||||
and ``https://url2.com/...``. Note that ``subscription_value_1`` also gets set to
|
||||
``subscription_value``.
|
||||
"""
|
||||
return f"subscription_value_{index + 1}"
|
||||
|
|
@ -9,10 +9,9 @@ from typing import final
|
|||
|
||||
from ytdl_sub.config.config_file import ConfigFile
|
||||
from ytdl_sub.config.preset_options import Overrides
|
||||
from ytdl_sub.subscriptions.utils import SUBSCRIPTION_NAME
|
||||
from ytdl_sub.subscriptions.utils import SUBSCRIPTION_VALUE
|
||||
from ytdl_sub.subscriptions.utils import subscription_indent_variable_name
|
||||
from ytdl_sub.subscriptions.utils import subscription_list_variable_name
|
||||
from ytdl_sub.entries.variables.override_variables import SUBSCRIPTION_NAME
|
||||
from ytdl_sub.entries.variables.override_variables import SUBSCRIPTION_VALUE
|
||||
from ytdl_sub.entries.variables.override_variables import OverrideVariables
|
||||
from ytdl_sub.validators.string_formatter_validators import DictFormatterValidator
|
||||
from ytdl_sub.validators.validators import DictValidator
|
||||
from ytdl_sub.validators.validators import StringListValidator
|
||||
|
|
@ -33,7 +32,7 @@ class SubscriptionOutput(Validator, ABC):
|
|||
indent overrides to merge with the preset dict's overrides
|
||||
"""
|
||||
return {
|
||||
subscription_indent_variable_name(i): self._indent_overrides[i]
|
||||
OverrideVariables.subscription_indent_i(i): self._indent_overrides[i]
|
||||
for i in range(len(self._indent_overrides))
|
||||
}
|
||||
|
||||
|
|
@ -159,7 +158,9 @@ class SubscriptionListValuesValidator(SubscriptionLeafValidator, StringListValid
|
|||
if idx == 0:
|
||||
self._overrides_to_add[SUBSCRIPTION_VALUE] = list_value.value
|
||||
|
||||
self._overrides_to_add[subscription_list_variable_name(index=idx)] = list_value.value
|
||||
self._overrides_to_add[
|
||||
OverrideVariables.subscription_value_i(index=idx)
|
||||
] = list_value.value
|
||||
|
||||
|
||||
class SubscriptionWithOverridesValidator(SubscriptionLeafValidator, DictFormatterValidator):
|
||||
|
|
|
|||
|
|
@ -1,33 +1,2 @@
|
|||
SUBSCRIPTION_NAME = "subscription_name"
|
||||
SUBSCRIPTION_VALUE = "subscription_value"
|
||||
|
||||
# Key used in configs, should delete at some point
|
||||
SUBSCRIPTION_VALUE_CONFIG_KEY = "subscription_value"
|
||||
|
||||
|
||||
def subscription_indent_variable_name(index: int) -> str:
|
||||
"""
|
||||
Parameters
|
||||
----------
|
||||
index
|
||||
0th-based index
|
||||
|
||||
Returns
|
||||
-------
|
||||
subscription_index_i, where i is 1-based index
|
||||
"""
|
||||
return f"subscription_indent_{index + 1}"
|
||||
|
||||
|
||||
def subscription_list_variable_name(index: int) -> str:
|
||||
"""
|
||||
Parameters
|
||||
----------
|
||||
index
|
||||
0th-based index
|
||||
|
||||
Returns
|
||||
-------
|
||||
subscription_value_i, where i is 1-based index
|
||||
"""
|
||||
return f"subscription_value_{index + 1}"
|
||||
|
|
|
|||
Loading…
Reference in a new issue