From a1c3d480c75782ecaae1fdb3640f841b52284bac Mon Sep 17 00:00:00 2001 From: Jesse Bannon Date: Tue, 17 Oct 2023 14:46:37 -0700 Subject: [PATCH] updated tests and docs --- docs/config.rst | 22 +++++++++++++--------- examples/tv_show_config.yaml | 4 ++-- examples/tv_show_subscriptions.yaml | 11 ++++------- tests/e2e/plugins/test_date_range.py | 2 +- tests/e2e/youtube/test_channel.py | 2 +- 5 files changed, 21 insertions(+), 20 deletions(-) diff --git a/docs/config.rst b/docs/config.rst index 60a9fe74..da379040 100644 --- a/docs/config.rst +++ b/docs/config.rst @@ -309,12 +309,12 @@ For example: .. code-block:: yaml :caption: subscription.yaml - tv_show: - only_recent: - [News]: + TV Show Full Archive: + = News: "Breaking News": "https://www.youtube.com/@SomeBreakingNews" - [Tech]: + TV Show Only Recent: + = Tech | TV-Y: "Two Minute Papers": "https://www.youtube.com/@TwoMinutePapers" Will create two subscriptions named "Breaking News" and "Two Minute Papers", equivalent to: @@ -323,8 +323,7 @@ Will create two subscriptions named "Breaking News" and "Two Minute Papers", equ "Breaking News": preset: - - "tv_show" - - "only_recent" + - "TV Show Full Archive" overrides: subscription_indent_1: "News" @@ -333,25 +332,30 @@ Will create two subscriptions named "Breaking News" and "Two Minute Papers", equ "Two Minute Papers": preset: - - "tv_show" + - "TV Show Only Recent" overrides: subscription_indent_1: "Tech" + subscription_indent_2: "TV-Y" subscription_name: "Two Minute Papers" subscription_value: "https://www.youtube.com/@TwoMinutePapers" -You can provide as many parent presets in the form of keys, and subscription indents as ``[keys]``. +You can provide as many parent presets in the form of keys, and subscription indents as ``=keys``. This can drastically simplify subscription definitions by setting things like so in your parent preset: .. code-block:: yaml presets: - tv_show_name: + "TV Show Preset": overrides: + subscription_indent_1: "default-genre" + subscription_indent_2: "default-content-rating" + tv_show_name: "{subscription_name}" url: "{subscription_value}" genre: "{subscription_indent_1}" + content_rating: "{subscription_indent_2}" .. _subscription value: diff --git a/examples/tv_show_config.yaml b/examples/tv_show_config.yaml index c74712f6..3843f2c8 100644 --- a/examples/tv_show_config.yaml +++ b/examples/tv_show_config.yaml @@ -43,7 +43,6 @@ presets: # it applied to every TV show. Or, use them on the individual subscriptions. # - "add_subtitles" # - "sponsorblock" - # - "include_info_json" # To download age-restricted videos, you will need to uncomment and set your cookie # file here as a ytdl parameter. For more info, see @@ -92,7 +91,8 @@ presets: # subtitles_name: "{episode_file_path}.{lang}.{subtitles_ext}" # subtitles_type: "srt" - languages: "en" # supports list of multiple languages + languages: + - "en" allow_auto_generated_subtitles: True # allow auto subtitles #################################################################################################### diff --git a/examples/tv_show_subscriptions.yaml b/examples/tv_show_subscriptions.yaml index c3a2be4c..dcae3470 100644 --- a/examples/tv_show_subscriptions.yaml +++ b/examples/tv_show_subscriptions.yaml @@ -1,20 +1,18 @@ # 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" + tv_show_directory: "/tv_shows" # Root folder of ytdl-sub TV Shows + download_range: "2months" # Range to keep for only recent # All subscriptions under this will use the `TV Show Full Archive` preset TV Show Full Archive: - # Sets "Music" as the TV show genre + # Sets "Music" for genre = Music: "Rick A": "https://www.youtube.com/channel/UCuAXFkgsw1L7xaCfnd5JJOw" "Opeth": "https://www.youtube.com/channel/UCmQSJTFZaXN85gYk6W3XbdQ" - # Sets "Kids" as the TV show genre, and "TV-Y" as the content rating + # Sets "Kids" for genre, "TV-Y" for content rating = Kids | TV-Y: "Jake Trains": "https://www.youtube.com/@JakeTrains" "Kids Toys Play": "https://www.youtube.com/@KidsToysPlayChannel" @@ -27,7 +25,6 @@ TV Show Only Recent: # ADVANCED USAGE: -# If a key is not a preset, it is treated as a subscription. # Subscriptions can use the same format as a preset found within a config. "Equivalent to BBC": preset: diff --git a/tests/e2e/plugins/test_date_range.py b/tests/e2e/plugins/test_date_range.py index f1f8bccc..6d0dd483 100644 --- a/tests/e2e/plugins/test_date_range.py +++ b/tests/e2e/plugins/test_date_range.py @@ -13,7 +13,7 @@ from ytdl_sub.subscriptions.subscription import Subscription @pytest.fixture def recent_preset_dict(output_directory): return { - "preset": "tv_show", + "preset": "TV Show Full Archive", "date_range": {"after": "20150101"}, "format": "worst[ext=mp4]", # download the worst format so it is fast "ytdl_options": { diff --git a/tests/e2e/youtube/test_channel.py b/tests/e2e/youtube/test_channel.py index b9481521..8910ea65 100644 --- a/tests/e2e/youtube/test_channel.py +++ b/tests/e2e/youtube/test_channel.py @@ -8,7 +8,7 @@ from ytdl_sub.subscriptions.subscription import Subscription @pytest.fixture def channel_preset_dict(output_directory): return { - "preset": "tv_show", + "preset": "TV Show Full Archive", "format": "worst[ext=mp4]", # download the worst format so it is fast "ytdl_options": { "max_views": 100000, # do not download the popular PJ concert