maor docs

This commit is contained in:
jbannon 2022-05-10 19:58:01 +00:00
parent 87dfe3dbfe
commit f9979521ac

View file

@ -11,7 +11,20 @@ from ytdl_sub.validators.string_formatter_validators import OverridesStringForma
class OutputDirectoryNfoTagsOptions(PluginOptions):
"""
Validates config values for the output directory nfo tags plugin.
Adds a single NFO file in the output directory. An NFO file is simply an XML file with a
``.nfo`` extension. You can add any values into the NFO.
Usage:
.. code-block:: yaml
presets:
my_example_preset:
output_directory_nfo_tags:
nfo_name: "tvshow.nfo"
nfo_root: "tvshow"
tags:
title: "Sweet youtube TV show"
"""
_required_keys = {"nfo_name", "nfo_root", "tags"}
@ -20,13 +33,47 @@ class OutputDirectoryNfoTagsOptions(PluginOptions):
super().__init__(name, value)
# Since this does not create NFOs for entries, we must use the overrides formatter classes
# to ensure we are only using values defined as string literals or in overrides
self.nfo_name = self._validate_key(
self._nfo_name = self._validate_key(
key="nfo_name", validator=OverridesStringFormatterValidator
)
self.nfo_root = self._validate_key(
self._nfo_root = self._validate_key(
key="nfo_root", validator=OverridesStringFormatterValidator
)
self.tags = self._validate_key(key="tags", validator=OverridesDictFormatterValidator)
self._tags = self._validate_key(key="tags", validator=OverridesDictFormatterValidator)
@property
def nfo_name(self) -> OverridesStringFormatterValidator:
"""
The NFO file name.
"""
return self._nfo_name
@property
def nfo_root(self) -> OverridesStringFormatterValidator:
"""
The root tag of the NFO's XML. In the usage above, it would look like
.. code-block:: xml
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<tvshow>
</tvshow>
"""
return self._nfo_root
@property
def tags(self) -> OverridesDictFormatterValidator:
"""
Tags within the nfo_root tag. In the usage above, it would look like
.. code-block:: xml
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<tvshow>
<title>Sweet youtube TV show</title>
</tvshow>
"""
return self._tags
class OutputDirectoryNfoTagsPlugin(Plugin[OutputDirectoryNfoTagsOptions]):