From 545f186c46f03a1a7cb5e609f1ff7093faeaacba Mon Sep 17 00:00:00 2001 From: Jesse Bannon Date: Tue, 17 Oct 2023 16:30:50 -0700 Subject: [PATCH] [FEATURE][BUGFIX] Beautiful subscriptions syntax update + fix (#758) A follow-up to the prior commit which fixes some bugs in the 'beautiful subscriptions' implementation. A proper migration guide will be written in the wiki once it's ready --- docs/config.rst | 22 +++-- examples/tv_show_config.yaml | 23 ++--- examples/tv_show_subscriptions.yaml | 50 +++++++--- .../prebuilt_presets/tv_show/episode.yaml | 7 +- .../prebuilt_presets/tv_show/tv_show.yaml | 1 + src/ytdl_sub/subscriptions/subscription.py | 5 +- .../subscriptions/subscription_validators.py | 32 +++--- tests/conftest.py | 5 + tests/e2e/plugins/test_date_range.py | 2 +- tests/e2e/youtube/test_channel.py | 2 +- .../plugins/split_by_chapters_video.json | 24 ++--- .../split_by_chapters_with_regex_video.json | 24 ++--- .../split_by_chapters_video-dry-run.txt | 44 ++++----- .../plugins/split_by_chapters_video.txt | 44 ++++----- ...t_by_chapters_with_regex_video-dry-run.txt | 44 ++++----- .../split_by_chapters_with_regex_video.txt | 44 ++++----- tests/unit/config/test_subscription.py | 98 +++++++++++++++---- 17 files changed, 280 insertions(+), 191 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 f81ef60e..3843f2c8 100644 --- a/examples/tv_show_config.yaml +++ b/examples/tv_show_config.yaml @@ -22,7 +22,7 @@ configuration: presets: # Your main TV show preset - all your tv show subscriptions will use this. - tv_show: + "TV Show Full Archive": preset: # Choose one of the following player types: # - "kodi_tv_show_by_date" @@ -41,10 +41,8 @@ presets: # 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. - # - "only_recent_videos" # - "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 @@ -62,8 +60,12 @@ presets: #################################################################################################### - # Preset to only download and keep recent videos - only_recent_videos: + # A secondary TV Show preset that only keeps 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 date_range: @@ -89,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 #################################################################################################### @@ -113,11 +116,3 @@ presets: - "music_offtopic" remove_sponsorblock_categories: "all" 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}" - diff --git a/examples/tv_show_subscriptions.yaml b/examples/tv_show_subscriptions.yaml index 5bc09f7f..dcae3470 100644 --- a/examples/tv_show_subscriptions.yaml +++ b/examples/tv_show_subscriptions.yaml @@ -1,16 +1,36 @@ -# Define any number subscriptions in a single file, or use multiple -# files to organize (i.e by genre) - -rick_a: - # Mix and match any number of presets to use. You can either lump all settings into - # a single preset to save some lines, or modularize them and use many. - preset: - - "tv_show" - - "only_recent_videos" - +# Global overrides for all subscriptions. Can either be set here or in your config.yaml +__preset__: overrides: - # Required to specify for every subscription - tv_show_name: "Rick A" - url: "https://www.youtube.com/channel/UCuAXFkgsw1L7xaCfnd5JJOw" - # Optional - tv_show_genre: "Music" + 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" for genre + = Music: + "Rick A": "https://www.youtube.com/channel/UCuAXFkgsw1L7xaCfnd5JJOw" + "Opeth": "https://www.youtube.com/channel/UCmQSJTFZaXN85gYk6W3XbdQ" + + # 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" + + +# All subscriptions under this will use the `TV Show Only Recent` preset +TV Show Only Recent: + = News | TV-14: + "BBC": "https://www.youtube.com/@BBCNews" + + +# ADVANCED USAGE: +# Subscriptions can use the same format as a preset found within a config. +"Equivalent to BBC": + preset: + - "TV Show Only Recent" + overrides: + tv_show_name: "BBC" + url: "https://www.youtube.com/@BBCNews" + tv_show_genre: "News" + tv_show_content_rating: "TV-14" diff --git a/src/ytdl_sub/prebuilt_presets/tv_show/episode.yaml b/src/ytdl_sub/prebuilt_presets/tv_show/episode.yaml index 2aec4ab5..cd3fd7ce 100644 --- a/src/ytdl_sub/prebuilt_presets/tv_show/episode.yaml +++ b/src/ytdl_sub/prebuilt_presets/tv_show/episode.yaml @@ -25,8 +25,11 @@ presets: # season_number_padded # episode_number # episode_number_padded - tv_show_genre: "ytdl-sub" - tv_show_content_rating: "TV-14" + subscription_indent_1: "ytdl-sub" # genre + subscription_indent_2: "TV-14" # content rating + tv_show_name: "{subscription_name}" + tv_show_genre: "{subscription_indent_1}" + tv_show_content_rating: "{subscription_indent_2}" season_title: "{season_number_padded}" episode_title: "{upload_date_standardized} - {title}" episode_plot: "{webpage_url}\n\n{description}" diff --git a/src/ytdl_sub/prebuilt_presets/tv_show/tv_show.yaml b/src/ytdl_sub/prebuilt_presets/tv_show/tv_show.yaml index c889a053..09e3cfe7 100644 --- a/src/ytdl_sub/prebuilt_presets/tv_show/tv_show.yaml +++ b/src/ytdl_sub/prebuilt_presets/tv_show/tv_show.yaml @@ -61,6 +61,7 @@ presets: - url: "{url19}" - url: "{url20}" overrides: + url: "{subscription_value}" url2: "" url3: "" url4: "" diff --git a/src/ytdl_sub/subscriptions/subscription.py b/src/ytdl_sub/subscriptions/subscription.py index 5e06ad91..8cf66dcb 100644 --- a/src/ytdl_sub/subscriptions/subscription.py +++ b/src/ytdl_sub/subscriptions/subscription.py @@ -1,4 +1,5 @@ import copy +from pathlib import Path from typing import Any from typing import Dict from typing import List @@ -92,7 +93,9 @@ class Subscription(SubscriptionDownload): return subscription_value_key @classmethod - def from_file_path(cls, config: ConfigFile, subscription_path: str) -> List["Subscription"]: + def from_file_path( + cls, config: ConfigFile, subscription_path: str | Path + ) -> List["Subscription"]: """ Loads subscriptions from a file and applies ``__preset__`` to all of them if present. If a subscription is in the form of key: value, it will set value to the override diff --git a/src/ytdl_sub/subscriptions/subscription_validators.py b/src/ytdl_sub/subscriptions/subscription_validators.py index 93390183..2b15f065 100644 --- a/src/ytdl_sub/subscriptions/subscription_validators.py +++ b/src/ytdl_sub/subscriptions/subscription_validators.py @@ -36,15 +36,16 @@ def subscription_value_variable_name() -> str: return "subscription_value" -def maybe_indent_override_value(value: str) -> Optional[str]: +def maybe_indent_override_values(value: str) -> List[str]: """ Returns ------- Value if it is an overide [Value]. None otherwise. """ - if value.startswith("[") and value.endswith("]"): - return value[1:-1] - return None + if value.startswith("="): + # Drop the =, split on |, and strip each indent_value (both left + right) + return [indent_value.strip() for indent_value in value[1:].split("|")] + return [] class SubscriptionOutput(Validator, ABC): @@ -112,24 +113,19 @@ class SubscriptionValueValidator(SubscriptionOutput, StringValidator): f"{self._leaf_name} conflicts with an existing preset name and cannot be " f"used as a subscription name" ) - - if subscription_value is None: - raise self._validation_exception( - f"Subscription {self._leaf_name} is a string, but the subscription value " - f"is not set to an override variable" - ) - - self._subscription_value: str = subscription_value + self._subscription_value: Optional[str] = subscription_value def subscription_dicts(self) -> Dict[str, Dict]: + subscription_value_dict: Dict[str, str] = {"subscription_value": self.value} + # TODO: Eventually delete in favor of {subscription_value} + if self._subscription_value: + subscription_value_dict[self._subscription_value] = self.value + return { self._leaf_name: { "preset": self._presets, "overrides": dict( - { - self._subscription_value: self.value, - "subscription_value": self.value, - }, + subscription_value_dict, **self._indent_overrides_dict(), ), } @@ -179,14 +175,14 @@ class SubscriptionValidator(SubscriptionOutput): subscription_value=subscription_value, ) ) - elif override_value := maybe_indent_override_value(key): + elif override_values := maybe_indent_override_values(key): self._children.append( SubscriptionValidator( name=obj_name, value=obj, config=config, presets=presets, - indent_overrides=indent_overrides + [override_value], + indent_overrides=indent_overrides + override_values, subscription_value=subscription_value, ) ) diff --git a/tests/conftest.py b/tests/conftest.py index 54fab744..c9d64608 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -179,6 +179,11 @@ def channel_as_tv_show_config(working_directory) -> ConfigFile: ) +@pytest.fixture() +def tv_show_subscriptions_path() -> Path: + return Path("examples/tv_show_subscriptions.yaml") + + @pytest.fixture() def music_audio_config(working_directory) -> ConfigFile: return _load_config( 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 diff --git a/tests/resources/expected_downloads_summaries/plugins/split_by_chapters_video.json b/tests/resources/expected_downloads_summaries/plugins/split_by_chapters_video.json index b809d06f..7b3e68c1 100644 --- a/tests/resources/expected_downloads_summaries/plugins/split_by_chapters_video.json +++ b/tests/resources/expected_downloads_summaries/plugins/split_by_chapters_video.json @@ -1,15 +1,15 @@ { - ".ytdl-sub-split_by_chapters_video-download-archive.json": "a4337aeeaded1a1ef5d4c17d8e5ed71f", - "Proved Records/[2017] Alfa Mist - Nocturne [Full Album]/01 - 01. Intro (Feat. Racheal Ofori & Barney Artist.mp3": "73a98c0f110519e42a5ef6629fd5c84d", - "Proved Records/[2017] Alfa Mist - Nocturne [Full Album]/02 - 02. Answers (Feat. Rick David & Kaya Thomas - Dyke.mp3": "37b52830e5860546548c1f1c73433c9f", - "Proved Records/[2017] Alfa Mist - Nocturne [Full Album]/03 - 03. Blaze (Feat. Kaya Thomas - Dyke.mp3": "44859cc006906ad20da3b5cc966636a3", - "Proved Records/[2017] Alfa Mist - Nocturne [Full Album]/04 - 04. What If (Interlude.mp3": "1e81ccbb8ca22e2a9ff7b7dc0e2264fe", - "Proved Records/[2017] Alfa Mist - Nocturne [Full Album]/05 - 05. No Peace (Feat. Tom Misch.mp3": "959ce7ebe3e39680c36c9e4b0472e138", - "Proved Records/[2017] Alfa Mist - Nocturne [Full Album]/06 - 06. Closer (Feat. Lester Duval.mp3": "f812f8614d95dfa535e2049d6344e0a8", - "Proved Records/[2017] Alfa Mist - Nocturne [Full Album]/07 - 07. Delusions: Rumination (Interlude) (Feat. Racheal Ofori.mp3": "d704c2e5c4c26ca11007c62880aa2f6e", - "Proved Records/[2017] Alfa Mist - Nocturne [Full Album]/08 - 08. Dreams (Feat. Carmody.mp3": "94cd88bc220e77239ac02affd3e676f9", - "Proved Records/[2017] Alfa Mist - Nocturne [Full Album]/09 - 09. Dreaming (Interlude) (Feat. Racheal Ofori.mp3": "d379a7f5d14dcc9432447a1751a14179", - "Proved Records/[2017] Alfa Mist - Nocturne [Full Album]/10 - 10. Hopeful (Feat. Jordan Rakei.mp3": "bd63f123d442166784df208b09e9c6b7", - "Proved Records/[2017] Alfa Mist - Nocturne [Full Album]/11 - 11. Sunrise (Pillows) (Feat. Emmavie.mp3": "7b5725a2d452d0457179084ce5d1c34e", + ".ytdl-sub-split_by_chapters_video-download-archive.json": "c3fb0b4f31caaa10ac7954ea93da33c4", + "Proved Records/[2017] Alfa Mist - Nocturne [Full Album]/01 - 01. Intro (Feat. Racheal Ofori & Barney Artist).mp3": "8827ac62201abeb94f44a46d91628aa8", + "Proved Records/[2017] Alfa Mist - Nocturne [Full Album]/02 - 02. Answers (Feat. Rick David & Kaya Thomas - Dyke).mp3": "f17e02119bf073c4ed98da2a960b85d3", + "Proved Records/[2017] Alfa Mist - Nocturne [Full Album]/03 - 03. Blaze (Feat. Kaya Thomas - Dyke).mp3": "63c0bc97cbdaf35203011378b1860418", + "Proved Records/[2017] Alfa Mist - Nocturne [Full Album]/04 - 04. What If (Interlude).mp3": "eb1a8533390243a5c4c49d8b6871c0ce", + "Proved Records/[2017] Alfa Mist - Nocturne [Full Album]/05 - 05. No Peace (Feat. Tom Misch).mp3": "a1b54772207228bd4922ad93d249c9f5", + "Proved Records/[2017] Alfa Mist - Nocturne [Full Album]/06 - 06. Closer (Feat. Lester Duval).mp3": "1d217264368d5f078e67691ea1b3df97", + "Proved Records/[2017] Alfa Mist - Nocturne [Full Album]/07 - 07. Delusions: Rumination (Interlude) (Feat. Racheal Ofori).mp3": "4d1a1728dbd69a30bbc2ffa354851169", + "Proved Records/[2017] Alfa Mist - Nocturne [Full Album]/08 - 08. Dreams (Feat. Carmody).mp3": "c204cf16f9f44945634c6171a5192e99", + "Proved Records/[2017] Alfa Mist - Nocturne [Full Album]/09 - 09. Dreaming (Interlude) (Feat. Racheal Ofori).mp3": "795e22297f8db00697563774328ffb3a", + "Proved Records/[2017] Alfa Mist - Nocturne [Full Album]/10 - 10. Hopeful (Feat. Jordan Rakei).mp3": "3904a5cd81b5ac43850b7858fb8dd378", + "Proved Records/[2017] Alfa Mist - Nocturne [Full Album]/11 - 11. Sunrise (Pillows) (Feat. Emmavie).mp3": "a89549db5b16ff76d04fd0bbbfba3424", "Proved Records/[2017] Alfa Mist - Nocturne [Full Album]/folder.jpg": "bd3685acc53072e591bae2505ecb0648" } \ No newline at end of file diff --git a/tests/resources/expected_downloads_summaries/plugins/split_by_chapters_with_regex_video.json b/tests/resources/expected_downloads_summaries/plugins/split_by_chapters_with_regex_video.json index b6485508..3daa3ef8 100644 --- a/tests/resources/expected_downloads_summaries/plugins/split_by_chapters_with_regex_video.json +++ b/tests/resources/expected_downloads_summaries/plugins/split_by_chapters_with_regex_video.json @@ -1,15 +1,15 @@ { - ".ytdl-sub-split_by_chapters_with_regex_video-download-archive.json": "d13f803a92fe9630d5e6fa6f1baa46a9", - "Alfa Mist/[2017] Nocturne/01 - Intro (Feat. Racheal Ofori & Barney Artist.mp3": "98c381825f8e0358711c21d084bc3568", - "Alfa Mist/[2017] Nocturne/02 - Answers (Feat. Rick David & Kaya Thomas - Dyke.mp3": "8c971f3f0ef230797b033043b49a8888", - "Alfa Mist/[2017] Nocturne/03 - Blaze (Feat. Kaya Thomas - Dyke.mp3": "50e74885a2a19a11420dc8c27b96b7bd", - "Alfa Mist/[2017] Nocturne/04 - What If (Interlude.mp3": "d655ca75ba791731c6c49b022188bb79", - "Alfa Mist/[2017] Nocturne/05 - No Peace (Feat. Tom Misch.mp3": "14e8492c8784913a0acd3be9a496ad5d", - "Alfa Mist/[2017] Nocturne/06 - Closer (Feat. Lester Duval.mp3": "2371ae9951b04b436ac2994aed6684cb", - "Alfa Mist/[2017] Nocturne/07 - Delusions: Rumination (Interlude) (Feat. Racheal Ofori.mp3": "644754ff7bcf926b34109f5d263a21b7", - "Alfa Mist/[2017] Nocturne/08 - Dreams (Feat. Carmody.mp3": "d9d6a014e453e3c6ede1544f3ec1bb03", - "Alfa Mist/[2017] Nocturne/09 - Dreaming (Interlude) (Feat. Racheal Ofori.mp3": "ea833ef0f0af9c347d3f5920899b8b44", - "Alfa Mist/[2017] Nocturne/10 - Hopeful (Feat. Jordan Rakei.mp3": "714fae9edfc7844411984e664ced7285", - "Alfa Mist/[2017] Nocturne/11 - Sunrise (Pillows) (Feat. Emmavie.mp3": "871d94d7e402cc3a29e80a5150735873", + ".ytdl-sub-split_by_chapters_with_regex_video-download-archive.json": "9798e8289742586d0efd295a97c6c906", + "Alfa Mist/[2017] Nocturne/01 - Intro (Feat. Racheal Ofori & Barney Artist).mp3": "c10cff170976c3c5139f6073eeb3e25e", + "Alfa Mist/[2017] Nocturne/02 - Answers (Feat. Rick David & Kaya Thomas - Dyke).mp3": "881ecdbee4a0d565c0ec6eacf03115df", + "Alfa Mist/[2017] Nocturne/03 - Blaze (Feat. Kaya Thomas - Dyke).mp3": "aa5c6fbab58dd2be2660bfb65be6a172", + "Alfa Mist/[2017] Nocturne/04 - What If (Interlude).mp3": "a64ce02ed1188276c9744f92cfc81e8e", + "Alfa Mist/[2017] Nocturne/05 - No Peace (Feat. Tom Misch).mp3": "a6dbe96141515caa32f3df4f66e46f75", + "Alfa Mist/[2017] Nocturne/06 - Closer (Feat. Lester Duval).mp3": "9b8ff5357109c376cce4bdd25e724d7b", + "Alfa Mist/[2017] Nocturne/07 - Delusions: Rumination (Interlude) (Feat. Racheal Ofori).mp3": "022b077892b838c478c65ba3b5f00b55", + "Alfa Mist/[2017] Nocturne/08 - Dreams (Feat. Carmody).mp3": "75c9c0f789c378c45bb176aa6cc6ec57", + "Alfa Mist/[2017] Nocturne/09 - Dreaming (Interlude) (Feat. Racheal Ofori).mp3": "af59a3ac869249ac6ef2586fa6c59009", + "Alfa Mist/[2017] Nocturne/10 - Hopeful (Feat. Jordan Rakei).mp3": "27d36f90dc87264c57e88f3663b29467", + "Alfa Mist/[2017] Nocturne/11 - Sunrise (Pillows) (Feat. Emmavie).mp3": "be7085f9a536dfd2f70ce001c65a416c", "Alfa Mist/[2017] Nocturne/folder.jpg": "bd3685acc53072e591bae2505ecb0648" } \ No newline at end of file diff --git a/tests/resources/transaction_log_summaries/plugins/split_by_chapters_video-dry-run.txt b/tests/resources/transaction_log_summaries/plugins/split_by_chapters_video-dry-run.txt index a57b70f5..4ab6d393 100644 --- a/tests/resources/transaction_log_summaries/plugins/split_by_chapters_video-dry-run.txt +++ b/tests/resources/transaction_log_summaries/plugins/split_by_chapters_video-dry-run.txt @@ -3,7 +3,7 @@ Files created: {output_directory} .ytdl-sub-split_by_chapters_video-download-archive.json {output_directory}/Proved Records/[2017] Alfa Mist - Nocturne [Full Album] - 01 - 01. Intro (Feat. Racheal Ofori & Barney Artist.mp3 + 01 - 01. Intro (Feat. Racheal Ofori & Barney Artist).mp3 From Chapter Split: Warning: Dry-run assumes embedded chapters with no modifications Source Title: Alfa Mist - Nocturne [Full Album] @@ -15,11 +15,11 @@ Files created: artist: Proved Records artists: Proved Records genre: Unset - title: 01. Intro (Feat. Racheal Ofori & Barney Artist + title: 01. Intro (Feat. Racheal Ofori & Barney Artist) track: 1 tracktotal: 11 year: 2017 - 02 - 02. Answers (Feat. Rick David & Kaya Thomas - Dyke.mp3 + 02 - 02. Answers (Feat. Rick David & Kaya Thomas - Dyke).mp3 From Chapter Split: Warning: Dry-run assumes embedded chapters with no modifications Source Title: Alfa Mist - Nocturne [Full Album] @@ -31,11 +31,11 @@ Files created: artist: Proved Records artists: Proved Records genre: Unset - title: 02. Answers (Feat. Rick David & Kaya Thomas - Dyke + title: 02. Answers (Feat. Rick David & Kaya Thomas - Dyke) track: 2 tracktotal: 11 year: 2017 - 03 - 03. Blaze (Feat. Kaya Thomas - Dyke.mp3 + 03 - 03. Blaze (Feat. Kaya Thomas - Dyke).mp3 From Chapter Split: Warning: Dry-run assumes embedded chapters with no modifications Source Title: Alfa Mist - Nocturne [Full Album] @@ -47,11 +47,11 @@ Files created: artist: Proved Records artists: Proved Records genre: Unset - title: 03. Blaze (Feat. Kaya Thomas - Dyke + title: 03. Blaze (Feat. Kaya Thomas - Dyke) track: 3 tracktotal: 11 year: 2017 - 04 - 04. What If (Interlude.mp3 + 04 - 04. What If (Interlude).mp3 From Chapter Split: Warning: Dry-run assumes embedded chapters with no modifications Source Title: Alfa Mist - Nocturne [Full Album] @@ -63,11 +63,11 @@ Files created: artist: Proved Records artists: Proved Records genre: Unset - title: 04. What If (Interlude + title: 04. What If (Interlude) track: 4 tracktotal: 11 year: 2017 - 05 - 05. No Peace (Feat. Tom Misch.mp3 + 05 - 05. No Peace (Feat. Tom Misch).mp3 From Chapter Split: Warning: Dry-run assumes embedded chapters with no modifications Source Title: Alfa Mist - Nocturne [Full Album] @@ -79,11 +79,11 @@ Files created: artist: Proved Records artists: Proved Records genre: Unset - title: 05. No Peace (Feat. Tom Misch + title: 05. No Peace (Feat. Tom Misch) track: 5 tracktotal: 11 year: 2017 - 06 - 06. Closer (Feat. Lester Duval.mp3 + 06 - 06. Closer (Feat. Lester Duval).mp3 From Chapter Split: Warning: Dry-run assumes embedded chapters with no modifications Source Title: Alfa Mist - Nocturne [Full Album] @@ -95,11 +95,11 @@ Files created: artist: Proved Records artists: Proved Records genre: Unset - title: 06. Closer (Feat. Lester Duval + title: 06. Closer (Feat. Lester Duval) track: 6 tracktotal: 11 year: 2017 - 07 - 07. Delusions: Rumination (Interlude) (Feat. Racheal Ofori.mp3 + 07 - 07. Delusions: Rumination (Interlude) (Feat. Racheal Ofori).mp3 From Chapter Split: Warning: Dry-run assumes embedded chapters with no modifications Source Title: Alfa Mist - Nocturne [Full Album] @@ -111,11 +111,11 @@ Files created: artist: Proved Records artists: Proved Records genre: Unset - title: 07. Delusions: Rumination (Interlude) (Feat. Racheal Ofori + title: 07. Delusions: Rumination (Interlude) (Feat. Racheal Ofori) track: 7 tracktotal: 11 year: 2017 - 08 - 08. Dreams (Feat. Carmody.mp3 + 08 - 08. Dreams (Feat. Carmody).mp3 From Chapter Split: Warning: Dry-run assumes embedded chapters with no modifications Source Title: Alfa Mist - Nocturne [Full Album] @@ -127,11 +127,11 @@ Files created: artist: Proved Records artists: Proved Records genre: Unset - title: 08. Dreams (Feat. Carmody + title: 08. Dreams (Feat. Carmody) track: 8 tracktotal: 11 year: 2017 - 09 - 09. Dreaming (Interlude) (Feat. Racheal Ofori.mp3 + 09 - 09. Dreaming (Interlude) (Feat. Racheal Ofori).mp3 From Chapter Split: Warning: Dry-run assumes embedded chapters with no modifications Source Title: Alfa Mist - Nocturne [Full Album] @@ -143,11 +143,11 @@ Files created: artist: Proved Records artists: Proved Records genre: Unset - title: 09. Dreaming (Interlude) (Feat. Racheal Ofori + title: 09. Dreaming (Interlude) (Feat. Racheal Ofori) track: 9 tracktotal: 11 year: 2017 - 10 - 10. Hopeful (Feat. Jordan Rakei.mp3 + 10 - 10. Hopeful (Feat. Jordan Rakei).mp3 From Chapter Split: Warning: Dry-run assumes embedded chapters with no modifications Source Title: Alfa Mist - Nocturne [Full Album] @@ -159,11 +159,11 @@ Files created: artist: Proved Records artists: Proved Records genre: Unset - title: 10. Hopeful (Feat. Jordan Rakei + title: 10. Hopeful (Feat. Jordan Rakei) track: 10 tracktotal: 11 year: 2017 - 11 - 11. Sunrise (Pillows) (Feat. Emmavie.mp3 + 11 - 11. Sunrise (Pillows) (Feat. Emmavie).mp3 From Chapter Split: Warning: Dry-run assumes embedded chapters with no modifications Source Title: Alfa Mist - Nocturne [Full Album] @@ -175,7 +175,7 @@ Files created: artist: Proved Records artists: Proved Records genre: Unset - title: 11. Sunrise (Pillows) (Feat. Emmavie + title: 11. Sunrise (Pillows) (Feat. Emmavie) track: 11 tracktotal: 11 year: 2017 diff --git a/tests/resources/transaction_log_summaries/plugins/split_by_chapters_video.txt b/tests/resources/transaction_log_summaries/plugins/split_by_chapters_video.txt index abbc7592..8ee4b650 100644 --- a/tests/resources/transaction_log_summaries/plugins/split_by_chapters_video.txt +++ b/tests/resources/transaction_log_summaries/plugins/split_by_chapters_video.txt @@ -3,7 +3,7 @@ Files created: {output_directory} .ytdl-sub-split_by_chapters_video-download-archive.json {output_directory}/Proved Records/[2017] Alfa Mist - Nocturne [Full Album] - 01 - 01. Intro (Feat. Racheal Ofori & Barney Artist.mp3 + 01 - 01. Intro (Feat. Racheal Ofori & Barney Artist).mp3 From Chapter Split: Source Title: Alfa Mist - Nocturne [Full Album] Segment: 0:00 - 2:06 @@ -14,11 +14,11 @@ Files created: artist: Proved Records artists: Proved Records genre: Unset - title: 01. Intro (Feat. Racheal Ofori & Barney Artist + title: 01. Intro (Feat. Racheal Ofori & Barney Artist) track: 1 tracktotal: 11 year: 2017 - 02 - 02. Answers (Feat. Rick David & Kaya Thomas - Dyke.mp3 + 02 - 02. Answers (Feat. Rick David & Kaya Thomas - Dyke).mp3 From Chapter Split: Source Title: Alfa Mist - Nocturne [Full Album] Segment: 2:06 - 5:40 @@ -29,11 +29,11 @@ Files created: artist: Proved Records artists: Proved Records genre: Unset - title: 02. Answers (Feat. Rick David & Kaya Thomas - Dyke + title: 02. Answers (Feat. Rick David & Kaya Thomas - Dyke) track: 2 tracktotal: 11 year: 2017 - 03 - 03. Blaze (Feat. Kaya Thomas - Dyke.mp3 + 03 - 03. Blaze (Feat. Kaya Thomas - Dyke).mp3 From Chapter Split: Source Title: Alfa Mist - Nocturne [Full Album] Segment: 5:40 - 8:11 @@ -44,11 +44,11 @@ Files created: artist: Proved Records artists: Proved Records genre: Unset - title: 03. Blaze (Feat. Kaya Thomas - Dyke + title: 03. Blaze (Feat. Kaya Thomas - Dyke) track: 3 tracktotal: 11 year: 2017 - 04 - 04. What If (Interlude.mp3 + 04 - 04. What If (Interlude).mp3 From Chapter Split: Source Title: Alfa Mist - Nocturne [Full Album] Segment: 8:11 - 9:35 @@ -59,11 +59,11 @@ Files created: artist: Proved Records artists: Proved Records genre: Unset - title: 04. What If (Interlude + title: 04. What If (Interlude) track: 4 tracktotal: 11 year: 2017 - 05 - 05. No Peace (Feat. Tom Misch.mp3 + 05 - 05. No Peace (Feat. Tom Misch).mp3 From Chapter Split: Source Title: Alfa Mist - Nocturne [Full Album] Segment: 9:35 - 13:19 @@ -74,11 +74,11 @@ Files created: artist: Proved Records artists: Proved Records genre: Unset - title: 05. No Peace (Feat. Tom Misch + title: 05. No Peace (Feat. Tom Misch) track: 5 tracktotal: 11 year: 2017 - 06 - 06. Closer (Feat. Lester Duval.mp3 + 06 - 06. Closer (Feat. Lester Duval).mp3 From Chapter Split: Source Title: Alfa Mist - Nocturne [Full Album] Segment: 13:19 - 17:57 @@ -89,11 +89,11 @@ Files created: artist: Proved Records artists: Proved Records genre: Unset - title: 06. Closer (Feat. Lester Duval + title: 06. Closer (Feat. Lester Duval) track: 6 tracktotal: 11 year: 2017 - 07 - 07. Delusions: Rumination (Interlude) (Feat. Racheal Ofori.mp3 + 07 - 07. Delusions: Rumination (Interlude) (Feat. Racheal Ofori).mp3 From Chapter Split: Source Title: Alfa Mist - Nocturne [Full Album] Segment: 17:57 - 20:05 @@ -104,11 +104,11 @@ Files created: artist: Proved Records artists: Proved Records genre: Unset - title: 07. Delusions: Rumination (Interlude) (Feat. Racheal Ofori + title: 07. Delusions: Rumination (Interlude) (Feat. Racheal Ofori) track: 7 tracktotal: 11 year: 2017 - 08 - 08. Dreams (Feat. Carmody.mp3 + 08 - 08. Dreams (Feat. Carmody).mp3 From Chapter Split: Source Title: Alfa Mist - Nocturne [Full Album] Segment: 20:05 - 23:58 @@ -119,11 +119,11 @@ Files created: artist: Proved Records artists: Proved Records genre: Unset - title: 08. Dreams (Feat. Carmody + title: 08. Dreams (Feat. Carmody) track: 8 tracktotal: 11 year: 2017 - 09 - 09. Dreaming (Interlude) (Feat. Racheal Ofori.mp3 + 09 - 09. Dreaming (Interlude) (Feat. Racheal Ofori).mp3 From Chapter Split: Source Title: Alfa Mist - Nocturne [Full Album] Segment: 23:58 - 24:45 @@ -134,11 +134,11 @@ Files created: artist: Proved Records artists: Proved Records genre: Unset - title: 09. Dreaming (Interlude) (Feat. Racheal Ofori + title: 09. Dreaming (Interlude) (Feat. Racheal Ofori) track: 9 tracktotal: 11 year: 2017 - 10 - 10. Hopeful (Feat. Jordan Rakei.mp3 + 10 - 10. Hopeful (Feat. Jordan Rakei).mp3 From Chapter Split: Source Title: Alfa Mist - Nocturne [Full Album] Segment: 24:45 - 28:53 @@ -149,11 +149,11 @@ Files created: artist: Proved Records artists: Proved Records genre: Unset - title: 10. Hopeful (Feat. Jordan Rakei + title: 10. Hopeful (Feat. Jordan Rakei) track: 10 tracktotal: 11 year: 2017 - 11 - 11. Sunrise (Pillows) (Feat. Emmavie.mp3 + 11 - 11. Sunrise (Pillows) (Feat. Emmavie).mp3 From Chapter Split: Source Title: Alfa Mist - Nocturne [Full Album] Segment: 28:53 - 31:43 @@ -164,7 +164,7 @@ Files created: artist: Proved Records artists: Proved Records genre: Unset - title: 11. Sunrise (Pillows) (Feat. Emmavie + title: 11. Sunrise (Pillows) (Feat. Emmavie) track: 11 tracktotal: 11 year: 2017 diff --git a/tests/resources/transaction_log_summaries/plugins/split_by_chapters_with_regex_video-dry-run.txt b/tests/resources/transaction_log_summaries/plugins/split_by_chapters_with_regex_video-dry-run.txt index f1196a37..530c205e 100644 --- a/tests/resources/transaction_log_summaries/plugins/split_by_chapters_with_regex_video-dry-run.txt +++ b/tests/resources/transaction_log_summaries/plugins/split_by_chapters_with_regex_video-dry-run.txt @@ -3,7 +3,7 @@ Files created: {output_directory} .ytdl-sub-split_by_chapters_with_regex_video-download-archive.json {output_directory}/Alfa Mist/[2017] Nocturne - 01 - Intro (Feat. Racheal Ofori & Barney Artist.mp3 + 01 - Intro (Feat. Racheal Ofori & Barney Artist).mp3 From Chapter Split: Warning: Dry-run assumes embedded chapters with no modifications Source Title: Alfa Mist - Nocturne [Full Album] @@ -15,11 +15,11 @@ Files created: artist: Alfa Mist artists: Alfa Mist genre: Unset - title: Intro (Feat. Racheal Ofori & Barney Artist + title: Intro (Feat. Racheal Ofori & Barney Artist) track: 1 tracktotal: 11 year: 2017 - 02 - Answers (Feat. Rick David & Kaya Thomas - Dyke.mp3 + 02 - Answers (Feat. Rick David & Kaya Thomas - Dyke).mp3 From Chapter Split: Warning: Dry-run assumes embedded chapters with no modifications Source Title: Alfa Mist - Nocturne [Full Album] @@ -31,11 +31,11 @@ Files created: artist: Alfa Mist artists: Alfa Mist genre: Unset - title: Answers (Feat. Rick David & Kaya Thomas - Dyke + title: Answers (Feat. Rick David & Kaya Thomas - Dyke) track: 2 tracktotal: 11 year: 2017 - 03 - Blaze (Feat. Kaya Thomas - Dyke.mp3 + 03 - Blaze (Feat. Kaya Thomas - Dyke).mp3 From Chapter Split: Warning: Dry-run assumes embedded chapters with no modifications Source Title: Alfa Mist - Nocturne [Full Album] @@ -47,11 +47,11 @@ Files created: artist: Alfa Mist artists: Alfa Mist genre: Unset - title: Blaze (Feat. Kaya Thomas - Dyke + title: Blaze (Feat. Kaya Thomas - Dyke) track: 3 tracktotal: 11 year: 2017 - 04 - What If (Interlude.mp3 + 04 - What If (Interlude).mp3 From Chapter Split: Warning: Dry-run assumes embedded chapters with no modifications Source Title: Alfa Mist - Nocturne [Full Album] @@ -63,11 +63,11 @@ Files created: artist: Alfa Mist artists: Alfa Mist genre: Unset - title: What If (Interlude + title: What If (Interlude) track: 4 tracktotal: 11 year: 2017 - 05 - No Peace (Feat. Tom Misch.mp3 + 05 - No Peace (Feat. Tom Misch).mp3 From Chapter Split: Warning: Dry-run assumes embedded chapters with no modifications Source Title: Alfa Mist - Nocturne [Full Album] @@ -79,11 +79,11 @@ Files created: artist: Alfa Mist artists: Alfa Mist genre: Unset - title: No Peace (Feat. Tom Misch + title: No Peace (Feat. Tom Misch) track: 5 tracktotal: 11 year: 2017 - 06 - Closer (Feat. Lester Duval.mp3 + 06 - Closer (Feat. Lester Duval).mp3 From Chapter Split: Warning: Dry-run assumes embedded chapters with no modifications Source Title: Alfa Mist - Nocturne [Full Album] @@ -95,11 +95,11 @@ Files created: artist: Alfa Mist artists: Alfa Mist genre: Unset - title: Closer (Feat. Lester Duval + title: Closer (Feat. Lester Duval) track: 6 tracktotal: 11 year: 2017 - 07 - Delusions: Rumination (Interlude) (Feat. Racheal Ofori.mp3 + 07 - Delusions: Rumination (Interlude) (Feat. Racheal Ofori).mp3 From Chapter Split: Warning: Dry-run assumes embedded chapters with no modifications Source Title: Alfa Mist - Nocturne [Full Album] @@ -111,11 +111,11 @@ Files created: artist: Alfa Mist artists: Alfa Mist genre: Unset - title: Delusions: Rumination (Interlude) (Feat. Racheal Ofori + title: Delusions: Rumination (Interlude) (Feat. Racheal Ofori) track: 7 tracktotal: 11 year: 2017 - 08 - Dreams (Feat. Carmody.mp3 + 08 - Dreams (Feat. Carmody).mp3 From Chapter Split: Warning: Dry-run assumes embedded chapters with no modifications Source Title: Alfa Mist - Nocturne [Full Album] @@ -127,11 +127,11 @@ Files created: artist: Alfa Mist artists: Alfa Mist genre: Unset - title: Dreams (Feat. Carmody + title: Dreams (Feat. Carmody) track: 8 tracktotal: 11 year: 2017 - 09 - Dreaming (Interlude) (Feat. Racheal Ofori.mp3 + 09 - Dreaming (Interlude) (Feat. Racheal Ofori).mp3 From Chapter Split: Warning: Dry-run assumes embedded chapters with no modifications Source Title: Alfa Mist - Nocturne [Full Album] @@ -143,11 +143,11 @@ Files created: artist: Alfa Mist artists: Alfa Mist genre: Unset - title: Dreaming (Interlude) (Feat. Racheal Ofori + title: Dreaming (Interlude) (Feat. Racheal Ofori) track: 9 tracktotal: 11 year: 2017 - 10 - Hopeful (Feat. Jordan Rakei.mp3 + 10 - Hopeful (Feat. Jordan Rakei).mp3 From Chapter Split: Warning: Dry-run assumes embedded chapters with no modifications Source Title: Alfa Mist - Nocturne [Full Album] @@ -159,11 +159,11 @@ Files created: artist: Alfa Mist artists: Alfa Mist genre: Unset - title: Hopeful (Feat. Jordan Rakei + title: Hopeful (Feat. Jordan Rakei) track: 10 tracktotal: 11 year: 2017 - 11 - Sunrise (Pillows) (Feat. Emmavie.mp3 + 11 - Sunrise (Pillows) (Feat. Emmavie).mp3 From Chapter Split: Warning: Dry-run assumes embedded chapters with no modifications Source Title: Alfa Mist - Nocturne [Full Album] @@ -175,7 +175,7 @@ Files created: artist: Alfa Mist artists: Alfa Mist genre: Unset - title: Sunrise (Pillows) (Feat. Emmavie + title: Sunrise (Pillows) (Feat. Emmavie) track: 11 tracktotal: 11 year: 2017 diff --git a/tests/resources/transaction_log_summaries/plugins/split_by_chapters_with_regex_video.txt b/tests/resources/transaction_log_summaries/plugins/split_by_chapters_with_regex_video.txt index 57053b62..1df12e08 100644 --- a/tests/resources/transaction_log_summaries/plugins/split_by_chapters_with_regex_video.txt +++ b/tests/resources/transaction_log_summaries/plugins/split_by_chapters_with_regex_video.txt @@ -3,7 +3,7 @@ Files created: {output_directory} .ytdl-sub-split_by_chapters_with_regex_video-download-archive.json {output_directory}/Alfa Mist/[2017] Nocturne - 01 - Intro (Feat. Racheal Ofori & Barney Artist.mp3 + 01 - Intro (Feat. Racheal Ofori & Barney Artist).mp3 From Chapter Split: Source Title: Alfa Mist - Nocturne [Full Album] Segment: 0:00 - 2:06 @@ -14,11 +14,11 @@ Files created: artist: Alfa Mist artists: Alfa Mist genre: Unset - title: Intro (Feat. Racheal Ofori & Barney Artist + title: Intro (Feat. Racheal Ofori & Barney Artist) track: 1 tracktotal: 11 year: 2017 - 02 - Answers (Feat. Rick David & Kaya Thomas - Dyke.mp3 + 02 - Answers (Feat. Rick David & Kaya Thomas - Dyke).mp3 From Chapter Split: Source Title: Alfa Mist - Nocturne [Full Album] Segment: 2:06 - 5:40 @@ -29,11 +29,11 @@ Files created: artist: Alfa Mist artists: Alfa Mist genre: Unset - title: Answers (Feat. Rick David & Kaya Thomas - Dyke + title: Answers (Feat. Rick David & Kaya Thomas - Dyke) track: 2 tracktotal: 11 year: 2017 - 03 - Blaze (Feat. Kaya Thomas - Dyke.mp3 + 03 - Blaze (Feat. Kaya Thomas - Dyke).mp3 From Chapter Split: Source Title: Alfa Mist - Nocturne [Full Album] Segment: 5:40 - 8:11 @@ -44,11 +44,11 @@ Files created: artist: Alfa Mist artists: Alfa Mist genre: Unset - title: Blaze (Feat. Kaya Thomas - Dyke + title: Blaze (Feat. Kaya Thomas - Dyke) track: 3 tracktotal: 11 year: 2017 - 04 - What If (Interlude.mp3 + 04 - What If (Interlude).mp3 From Chapter Split: Source Title: Alfa Mist - Nocturne [Full Album] Segment: 8:11 - 9:35 @@ -59,11 +59,11 @@ Files created: artist: Alfa Mist artists: Alfa Mist genre: Unset - title: What If (Interlude + title: What If (Interlude) track: 4 tracktotal: 11 year: 2017 - 05 - No Peace (Feat. Tom Misch.mp3 + 05 - No Peace (Feat. Tom Misch).mp3 From Chapter Split: Source Title: Alfa Mist - Nocturne [Full Album] Segment: 9:35 - 13:19 @@ -74,11 +74,11 @@ Files created: artist: Alfa Mist artists: Alfa Mist genre: Unset - title: No Peace (Feat. Tom Misch + title: No Peace (Feat. Tom Misch) track: 5 tracktotal: 11 year: 2017 - 06 - Closer (Feat. Lester Duval.mp3 + 06 - Closer (Feat. Lester Duval).mp3 From Chapter Split: Source Title: Alfa Mist - Nocturne [Full Album] Segment: 13:19 - 17:57 @@ -89,11 +89,11 @@ Files created: artist: Alfa Mist artists: Alfa Mist genre: Unset - title: Closer (Feat. Lester Duval + title: Closer (Feat. Lester Duval) track: 6 tracktotal: 11 year: 2017 - 07 - Delusions: Rumination (Interlude) (Feat. Racheal Ofori.mp3 + 07 - Delusions: Rumination (Interlude) (Feat. Racheal Ofori).mp3 From Chapter Split: Source Title: Alfa Mist - Nocturne [Full Album] Segment: 17:57 - 20:05 @@ -104,11 +104,11 @@ Files created: artist: Alfa Mist artists: Alfa Mist genre: Unset - title: Delusions: Rumination (Interlude) (Feat. Racheal Ofori + title: Delusions: Rumination (Interlude) (Feat. Racheal Ofori) track: 7 tracktotal: 11 year: 2017 - 08 - Dreams (Feat. Carmody.mp3 + 08 - Dreams (Feat. Carmody).mp3 From Chapter Split: Source Title: Alfa Mist - Nocturne [Full Album] Segment: 20:05 - 23:58 @@ -119,11 +119,11 @@ Files created: artist: Alfa Mist artists: Alfa Mist genre: Unset - title: Dreams (Feat. Carmody + title: Dreams (Feat. Carmody) track: 8 tracktotal: 11 year: 2017 - 09 - Dreaming (Interlude) (Feat. Racheal Ofori.mp3 + 09 - Dreaming (Interlude) (Feat. Racheal Ofori).mp3 From Chapter Split: Source Title: Alfa Mist - Nocturne [Full Album] Segment: 23:58 - 24:45 @@ -134,11 +134,11 @@ Files created: artist: Alfa Mist artists: Alfa Mist genre: Unset - title: Dreaming (Interlude) (Feat. Racheal Ofori + title: Dreaming (Interlude) (Feat. Racheal Ofori) track: 9 tracktotal: 11 year: 2017 - 10 - Hopeful (Feat. Jordan Rakei.mp3 + 10 - Hopeful (Feat. Jordan Rakei).mp3 From Chapter Split: Source Title: Alfa Mist - Nocturne [Full Album] Segment: 24:45 - 28:53 @@ -149,11 +149,11 @@ Files created: artist: Alfa Mist artists: Alfa Mist genre: Unset - title: Hopeful (Feat. Jordan Rakei + title: Hopeful (Feat. Jordan Rakei) track: 10 tracktotal: 11 year: 2017 - 11 - Sunrise (Pillows) (Feat. Emmavie.mp3 + 11 - Sunrise (Pillows) (Feat. Emmavie).mp3 From Chapter Split: Source Title: Alfa Mist - Nocturne [Full Album] Segment: 28:53 - 31:43 @@ -164,7 +164,7 @@ Files created: artist: Alfa Mist artists: Alfa Mist genre: Unset - title: Sunrise (Pillows) (Feat. Emmavie + title: Sunrise (Pillows) (Feat. Emmavie) track: 11 tracktotal: 11 year: 2017 diff --git a/tests/unit/config/test_subscription.py b/tests/unit/config/test_subscription.py index f5aed89d..3b99b7bf 100644 --- a/tests/unit/config/test_subscription.py +++ b/tests/unit/config/test_subscription.py @@ -1,5 +1,6 @@ import re from contextlib import contextmanager +from pathlib import Path from typing import Dict from unittest.mock import patch @@ -11,6 +12,7 @@ from ytdl_sub.plugins.nfo_tags import NfoTagsOptions from ytdl_sub.subscriptions.subscription import FILE_SUBSCRIPTION_VALUE_KEY from ytdl_sub.subscriptions.subscription import Subscription from ytdl_sub.utils.exceptions import ValidationException +from ytdl_sub.utils.yaml import load_yaml @pytest.fixture @@ -98,9 +100,28 @@ def preset_with_subscription_value_nested_presets_and_indent_variables( preset_with_subscription_value, **{ "parent_preset_2": { - "[INDENT_1]": { + "= INDENT_1 ": { "parent_preset_1": {"test_2_1": "is_2_1_overwritten"}, - "[INDENT_2]": { + "=INDENT_2": { + "test_1": "is_1_overwritten", + }, + } + } + }, + ) + + +@pytest.fixture +def preset_with_subscription_value_nested_presets_and_indent_variables_same_line( + preset_with_subscription_value: Dict, +): + return dict( + preset_with_subscription_value, + **{ + "parent_preset_2": { + "=INDENT_1": { + "parent_preset_1": {"test_2_1": "is_2_1_overwritten"}, + "= INDENT_2 | INDENT_3 ": { "test_1": "is_1_overwritten", }, } @@ -239,6 +260,43 @@ def test_subscription_file_value_applies_from_config_and_nested_and_indent_varia assert sub_2_1.get("subscription_indent_2") == "original_2" +def test_subscription_file_value_applies_from_config_and_nested_and_indent_variables_same_line( + config_file_with_subscription_value: ConfigFile, + preset_with_subscription_value_nested_presets_and_indent_variables_same_line: Dict, +): + with mock_load_yaml( + preset_dict=preset_with_subscription_value_nested_presets_and_indent_variables_same_line + ): + subs = Subscription.from_file_path( + config=config_file_with_subscription_value, subscription_path="mocked" + ) + assert len(subs) == 4 + + # Test __value__ worked correctly from the config + sub_test_value = [sub for sub in subs if sub.name == "test_value"][ + 0 + ].overrides.dict_with_format_strings + sub_1 = [sub for sub in subs if sub.name == "test_1"][0].overrides.dict_with_format_strings + sub_2_1 = [sub for sub in subs if sub.name == "test_2_1"][0].overrides.dict_with_format_strings + + assert sub_test_value.get("subscription_indent_1") == "original_1" + assert sub_test_value.get("subscription_indent_2") == "original_2" + + assert sub_1.get("test_config_subscription_value") == "is_1_overwritten" + assert sub_1.get("subscription_name") == "test_1" + assert sub_1.get("subscription_value") == "is_1_overwritten" + assert sub_1.get("subscription_indent_1") == "INDENT_1" + assert sub_1.get("subscription_indent_2") == "INDENT_2" + assert sub_1.get("subscription_indent_3") == "INDENT_3" + + assert sub_2_1.get("test_config_subscription_value") == "is_2_1_overwritten" + assert sub_2_1.get("subscription_name") == "test_2_1" + assert sub_2_1.get("subscription_value") == "is_2_1_overwritten" + assert sub_2_1.get("subscription_indent_1") == "INDENT_1" + assert sub_2_1.get("subscription_indent_2") == "original_2" + assert "subscription_indent_3" not in sub_2_1 + + def test_subscription_file_bad_value(config_file: ConfigFile): with mock_load_yaml(preset_dict={"__value__": {"should be": "string"}}), pytest.raises( ValidationException, @@ -250,30 +308,17 @@ def test_subscription_file_bad_value(config_file: ConfigFile): _ = Subscription.from_file_path(config=config_file, subscription_path="mocked") -def test_subscription_file_using_value_when_not_defined(config_file: ConfigFile): - with mock_load_yaml( - preset_dict={"[INDENTS_IN_ERR_MSG]": {"sub_name": "single value, __value__ not defined"}} - ), pytest.raises( - ValidationException, - match=re.escape( - "Validation error in [INDENTS_IN_ERR_MSG].sub_name: Subscription " - "sub_name is a string, but the subscription value is not set to an override variable" - ), - ): - _ = Subscription.from_file_path(config=config_file, subscription_path="mocked") - - def test_subscription_file_using_conflicting_preset_name(config_file: ConfigFile): with mock_load_yaml( preset_dict={ - "[INDENTS_IN_ERR_MSG]": { - "[ANOTHER]": {"jellyfin_tv_show_by_date": "single value, __value__ not defined"} + "= INDENTS_IN_ERR_MSG ": { + "=ANOTHER": {"jellyfin_tv_show_by_date": "single value, __value__ not defined"} } } ), pytest.raises( ValidationException, 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 " "as a subscription name" ), @@ -287,3 +332,20 @@ def test_subscription_file_invalid_form(config_file: ConfigFile): match=re.escape(f"Validation error in sub_name: should be of type object."), ): _ = Subscription.from_file_path(config=config_file, subscription_path="mocked") + + +def test_tv_show_subscriptions( + channel_as_tv_show_config: ConfigFile, tv_show_subscriptions_path: Path +): + subs = Subscription.from_file_path( + config=channel_as_tv_show_config, subscription_path=tv_show_subscriptions_path + ) + + assert len(subs) == 6 + assert subs[2].name == "Jake Trains" + jake_train_overrides = subs[2].overrides.dict_with_format_strings + + assert jake_train_overrides["subscription_name"] == "Jake Trains" + assert jake_train_overrides["subscription_value"] == "https://www.youtube.com/@JakeTrains" + assert jake_train_overrides["subscription_indent_1"] == "Kids" + assert jake_train_overrides["subscription_indent_2"] == "TV-Y"