diff --git a/docs/source/config_reference/scripting/index.rst b/docs/source/config_reference/scripting/index.rst index bee9a4e8..9b05ad68 100644 --- a/docs/source/config_reference/scripting/index.rst +++ b/docs/source/config_reference/scripting/index.rst @@ -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 `_. +See for yourself `here `_. Any whitespace within curly-braces is okay since it will be parsed out. This is needed to make scripting function usage readable. diff --git a/docs/source/config_reference/scripting/scripting_types.rst b/docs/source/config_reference/scripting/scripting_types.rst index d389c2a9..7fb1af6d 100644 --- a/docs/source/config_reference/scripting/scripting_types.rst +++ b/docs/source/config_reference/scripting/scripting_types.rst @@ -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