[DOCS] Update scripting types (#863)

This commit is contained in:
Jesse Bannon 2023-12-30 10:57:59 -08:00 committed by GitHub
parent 12430ecf1e
commit d1acae1a60
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 69 additions and 21 deletions

View file

@ -30,7 +30,7 @@ considered *static* because it does not depend on anything from an entry.
.. code-block:: yaml
output_options:
output_directory: "Custom YTDL-SUB TV Show"
output_directory: "/path/to/tv_shows/Custom YTDL-SUB TV Show"
Static Variables
~~~~~~~~~~~~~~~~
@ -41,7 +41,7 @@ We can use this instead of hard-coding it above:
.. code-block:: yaml
output_options:
output_directory: "{subscription_name}"
output_directory: "/path/to/tv_shows/{subscription_name}"
The syntax for variable usage is curly-braces with the variable name within it. Assuming
our subscription is actually named "Custom YTDL-SUB TV Show", then ``ytdl-sub``
@ -64,7 +64,7 @@ title in its name. We can do that using entry variables:
.. code-block:: yaml
output_options:
output_directory: "{subscription_name}"
output_directory: "/path/to/tv_shows/{subscription_name}"
file_name: "{title}.{ext}"
thumbnail_name: "{title}.{thumbnail_ext}"
@ -83,7 +83,7 @@ a ``custom_file_name`` variable to use for the entry file and thumbnail fields:
.. code-block:: yaml
output_options:
output_directory: "{subscription_name}"
output_directory: "/path/to/tv_shows/{subscription_name}"
file_name: "{custom_file_name}.{ext}"
thumbnail_name: "{custom_file_name}.{thumbnail_ext}"
@ -104,7 +104,7 @@ are safe by using:
.. code-block:: yaml
output_options:
output_directory: "{subscription_name_sanitized}"
output_directory: "/path/to/tv_shows/{subscription_name_sanitized}"
file_name: "{custom_file_name}.{ext}"
thumbnail_name: "{custom_file_name}.{thumbnail_ext}"
@ -115,8 +115,9 @@ Simply add a ``_sanitized`` suffix to any variable name to make it sanitized.
.. note::
Make sure you do not sanitize custom variables that intentionally create directories, otherwise
they will... be sanitized and not resolve to directories!
Make sure you do not sanitize custom variables that intentionally create directories,
(i.e. sanitizing ``/path/to/tv_shows/``) otherwise they will... be sanitized and not resolve to
directories!
Using Scripting Functions
@ -130,7 +131,7 @@ Let's suppose you are an avid command-line user, and like all of your file names
.. code-block:: yaml
output_options:
output_directory: "{subscription_name_sanitized}"
output_directory: "/path/to/tv_shows/{subscription_name_sanitized}"
file_name: "{custom_file_name}.{ext}"
thumbnail_name: "{custom_file_name}.{thumbnail_ext}"
@ -147,7 +148,7 @@ saying:
- Allow a string to be multi-lined, and do not include newlines before or after it.
See for yourself `here <https://yaml-online-parser.appspot.com/?yaml=output_options%3A%0A%20%20output_directory%3A%20%22%7Bsubscription_name_sanitized%7D%22%0A%20%20file_name%3A%20%22%7Bcustom_file_name%7D.%7Bext%7D%22%0A%20%20thumbnail_name%3A%20%22%7Bcustom_file_name%7D.%7Bthumbnail_ext%7D%22%0A%0Aoverrides%3A%0A%20%20snake_cased_title%3A%20%3E-%0A%20%20%20%20%7B%0A%20%20%20%20%20%20%25replace%28%20title%2C%20%27%20%27%2C%20%27_%27%20%29%0A%20%20%20%20%7D%0A%20%20custom_file_name%3A%20%22%7Bupload_date_standardized%7D%20%7Bsnake_cased_title_sanitized%7D%22&type=canonical_yaml>`_.
See for yourself `here <https://yaml-online-parser.appspot.com/?yaml=output_options%3A%0A%20%20output_directory%3A%20%22%7Bsubscription_name_sanitized%7D%22%0A%20%20file_name%3A%20%22%7Bcustom_file_name%7D.%7Bext%7D%22%0A%20%20thumbnail_name%3A%20%22%7Bcustom_file_name%7D.%7Bthumbnail_ext%7D%22%0A%0Aoverrides%3A%0A%20%20snake_cased_title%3A%20%3E-%0A%20%20%20%20%7B%0A%20%20%20%20%20%20%25replace%28%20title%2C%20%27%20%27%2C%20%27_%27%20%29%0A%20%20%20%20%7D%0A%20%20custom_file_name%3A%20%22%7Bupload_date_standardized%7D%20%7Bsnake_cased_title_sanitized%7D%22&type=json>`_.
Any whitespace within curly-braces is okay since it will be parsed out. This is needed to make
scripting function usage readable.

View file

@ -18,7 +18,7 @@ Strings are a series of characters surrounded by quotes and can be defined in a
string_variable: "This is a String variable"
.. tab-item:: In-Line
.. tab-item:: Same-Line
.. code-block:: yaml
@ -72,7 +72,7 @@ Integers are whole numbers with no decimal.
.. tab-set::
.. tab-item:: Literal
.. tab-item:: Multi-Line
.. code-block:: yaml
@ -81,7 +81,15 @@ Integers are whole numbers with no decimal.
%int(2022)
}
.. tab-item:: In-Line
.. tab-item:: New-Line
.. code-block:: yaml
int_variable: >-
{ %int(2022) }
.. tab-item:: Same-Line
.. code-block:: yaml
@ -94,7 +102,7 @@ Floats are floating-point decimals numbers.
.. tab-set::
.. tab-item:: Literal
.. tab-item:: Multi-Line
.. code-block:: yaml
@ -103,7 +111,14 @@ Floats are floating-point decimals numbers.
%float(3.14)
}
.. tab-item:: In-Line
.. tab-item:: New-Line
.. code-block:: yaml
float_variable: >-
{ %float(3.14) }
.. tab-item:: Same-Line
.. code-block:: yaml
@ -116,7 +131,7 @@ A type is considered boolean if it spells out ``True`` or ``False``, case-insens
.. tab-set::
.. tab-item:: Literal
.. tab-item:: Multi-Line
.. code-block:: yaml
@ -125,7 +140,14 @@ A type is considered boolean if it spells out ``True`` or ``False``, case-insens
%bool(True)
}
.. tab-item:: In-Line
.. tab-item:: New-Line
.. code-block:: yaml
bool_variable: >-
{ %bool(True) }
.. tab-item:: Same-Line
.. code-block:: yaml
@ -139,7 +161,7 @@ Arrays are defined using brackets (``[ ]``), and are accessed using zero-based i
.. tab-set::
.. tab-item:: Literal
.. tab-item:: Multi-Line
.. code-block:: yaml
@ -157,7 +179,16 @@ Arrays are defined using brackets (``[ ]``), and are accessed using zero-based i
%array_at(array_variable, 0)
}
.. tab-item:: In-Line
.. tab-item:: New-Line
.. code-block:: yaml
array_variable: >-
{ ["element with index 0", 1, 2.0, ["Nested Array 3"]] }
element_0: >-
{ %array_at(array_variable, 0) }
.. tab-item:: Same-Line
.. code-block:: yaml
@ -172,7 +203,7 @@ Maps are defined using curley-braces (``{ }``), and are accessed using their key
.. tab-set::
.. tab-item:: Literal
.. tab-item:: Multi-Line
.. code-block:: yaml
@ -189,7 +220,16 @@ Maps are defined using curley-braces (``{ }``), and are accessed using their key
%map_get(map_variable, "string_key")
}
.. tab-item:: In-Line
.. tab-item:: New-Line
.. code-block:: yaml
map_variable: >-
{ {"string_key": "string_value", 1: "int_key", "list_value": ["elem0", 1, 2.0]} }
string_value: >-
{ %map_get(map_variable, "string_key") }
.. tab-item:: Same-Line
.. code-block:: yaml
@ -209,7 +249,14 @@ case-insensitive.
null_variable: ""
.. tab-item:: In-Line
.. tab-item:: New-Line
.. code-block:: yaml
null_variable: >-
{ %string(null) }
.. tab-item:: Same-Line
.. code-block:: yaml