beautify tv_show_subscriptions

This commit is contained in:
Jesse Bannon 2023-10-17 10:59:09 -07:00
parent afdd11977a
commit 3df583f656
4 changed files with 41 additions and 38 deletions

View file

@ -22,7 +22,7 @@ configuration:
presets: presets:
# Your main TV show preset - all your tv show subscriptions will use this. # Your main TV show preset - all your tv show subscriptions will use this.
tv_show: "TV Show Full Archive":
preset: preset:
# Choose one of the following player types: # Choose one of the following player types:
# - "kodi_tv_show_by_date" # - "kodi_tv_show_by_date"
@ -41,7 +41,6 @@ presets:
# Include any of the presets listed below in your 'main preset' if you want # Include any of the presets listed below in your 'main preset' if you want
# it applied to every TV show. Or, use them on the individual subscriptions. # it applied to every TV show. Or, use them on the individual subscriptions.
# - "only_recent_videos"
# - "add_subtitles" # - "add_subtitles"
# - "sponsorblock" # - "sponsorblock"
# - "include_info_json" # - "include_info_json"
@ -62,8 +61,12 @@ presets:
#################################################################################################### ####################################################################################################
# Preset to only download and keep recent videos # A secondary TV Show preset that only keeps recent videos
only_recent_videos: "TV Show Only Recent":
# Inherit the `TV Show Full Archive` preset
preset:
- "TV Show Full Archive"
# Only download videos within the download_range # Only download videos within the download_range
date_range: date_range:
@ -113,11 +116,3 @@ presets:
- "music_offtopic" - "music_offtopic"
remove_sponsorblock_categories: "all" remove_sponsorblock_categories: "all"
force_key_frames: False force_key_frames: False
####################################################################################################
# Preset for the hoarders who want to also save the info.json file
include_info_json:
output_options:
info_json_name: "{episode_file_path}.{info_json_ext}"

View file

@ -1,32 +1,39 @@
# Global overrides for all subscriptions. Can either be set here or in your config.yaml
__preset__:
overrides:
tv_show_directory: "/tv_shows"
episode_title: "{upload_date_standardized} - {title}"
episode_plot: "{webpage_url}"
download_range: "2months"
# All subscriptions under this will use the `tv_show` preset
tv_show: # All subscriptions under this will use the `TV Show Full Archive` preset
# Sets override variable `subscription_indent_1` to "Music", which is used as genre TV Show Full Archive:
=[Music]: # Sets "Music" as the TV show genre
= Music:
"Rick A": "https://www.youtube.com/channel/UCuAXFkgsw1L7xaCfnd5JJOw" "Rick A": "https://www.youtube.com/channel/UCuAXFkgsw1L7xaCfnd5JJOw"
"Opeth": "https://www.youtube.com/channel/UCmQSJTFZaXN85gYk6W3XbdQ" "Opeth": "https://www.youtube.com/channel/UCmQSJTFZaXN85gYk6W3XbdQ"
# Sets override variables `subscription_indent_1` and `subscription_indent_2`. # Sets "Kids" as the TV show genre, and "TV-Y" as the content rating
# Second is used as MPAA rating = Kids | TV-Y:
=[Kids|TV-Y]:
"Jake Trains": "https://www.youtube.com/@JakeTrains" "Jake Trains": "https://www.youtube.com/@JakeTrains"
"Kids Toys Play": "https://www.youtube.com/@KidsToysPlayChannel" "Kids Toys Play": "https://www.youtube.com/@KidsToysPlayChannel"
# All subscriptions under this will use both `tv_show` and `only_recent_videos` preset
only_recent_videos: # All subscriptions under this will use the `TV Show Only Recent` preset
=[News]: TV Show Only Recent:
"BBC": "https://www.youtube.com/@BBCNews" = News | TV-14:
"BBC": "https://www.youtube.com/@BBCNews"
# If a key is not a preset, it is then treated as a subscription. # ADVANCED USAGE:
# Subscriptions can use the same format as a preset, or a single string # If a key is not a preset, it is treated as a subscription.
# like above which gets set to the override variable `subscription_value` # Subscriptions can use the same format as a preset found within a config.
"Equivalent to BBC": "Equivalent to BBC":
preset: preset:
- "tv_show" - "TV Show Only Recent"
- "only_recent_videos"
overrides: overrides:
tv_show_name: "BBC" tv_show_name: "BBC"
url: "https://www.youtube.com/@BBCNews" url: "https://www.youtube.com/@BBCNews"
tv_show_genre: "News" tv_show_genre: "News"
tv_show_content_rating: "TV-14"

View file

@ -42,8 +42,9 @@ def maybe_indent_override_values(value: str) -> List[str]:
------- -------
Value if it is an overide [Value]. None otherwise. Value if it is an overide [Value]. None otherwise.
""" """
if value.startswith("=[") and value.endswith("]"): if value.startswith("="):
return value[2:-1].split("|") # Drop the =, split on |, and strip each indent_value (both left + right)
return [indent_value.strip() for indent_value in value[1:].split("|")]
return [] return []

View file

@ -100,9 +100,9 @@ def preset_with_subscription_value_nested_presets_and_indent_variables(
preset_with_subscription_value, preset_with_subscription_value,
**{ **{
"parent_preset_2": { "parent_preset_2": {
"=[INDENT_1]": { "= INDENT_1 ": {
"parent_preset_1": {"test_2_1": "is_2_1_overwritten"}, "parent_preset_1": {"test_2_1": "is_2_1_overwritten"},
"=[INDENT_2]": { "=INDENT_2": {
"test_1": "is_1_overwritten", "test_1": "is_1_overwritten",
}, },
} }
@ -119,9 +119,9 @@ def preset_with_subscription_value_nested_presets_and_indent_variables_same_line
preset_with_subscription_value, preset_with_subscription_value,
**{ **{
"parent_preset_2": { "parent_preset_2": {
"=[INDENT_1]": { "=INDENT_1": {
"parent_preset_1": {"test_2_1": "is_2_1_overwritten"}, "parent_preset_1": {"test_2_1": "is_2_1_overwritten"},
"=[INDENT_2|INDENT_3]": { "= INDENT_2 | INDENT_3 ": {
"test_1": "is_1_overwritten", "test_1": "is_1_overwritten",
}, },
} }
@ -311,14 +311,14 @@ def test_subscription_file_bad_value(config_file: ConfigFile):
def test_subscription_file_using_conflicting_preset_name(config_file: ConfigFile): def test_subscription_file_using_conflicting_preset_name(config_file: ConfigFile):
with mock_load_yaml( with mock_load_yaml(
preset_dict={ preset_dict={
"=[INDENTS_IN_ERR_MSG]": { "= INDENTS_IN_ERR_MSG ": {
"=[ANOTHER]": {"jellyfin_tv_show_by_date": "single value, __value__ not defined"} "=ANOTHER": {"jellyfin_tv_show_by_date": "single value, __value__ not defined"}
} }
} }
), pytest.raises( ), pytest.raises(
ValidationException, ValidationException,
match=re.escape( match=re.escape(
"Validation error in =[INDENTS_IN_ERR_MSG].=[ANOTHER].jellyfin_tv_show_by_date: " "Validation error in = INDENTS_IN_ERR_MSG .=ANOTHER.jellyfin_tv_show_by_date: "
"jellyfin_tv_show_by_date conflicts with an existing preset name and cannot be used " "jellyfin_tv_show_by_date conflicts with an existing preset name and cannot be used "
"as a subscription name" "as a subscription name"
), ),