From d2e733f2e7945e4b66cd210c52d23ced7ae68ab2 Mon Sep 17 00:00:00 2001 From: Jesse Bannon Date: Thu, 18 Jan 2024 15:00:17 -0800 Subject: [PATCH 1/2] [BACKEND] Only download audio when using audio_extract plugin (#902) This addition optimizes the `audio_extract` plugin by preemptively telling yt-dlp to discard the video and only download the audio stream --- src/ytdl_sub/plugins/audio_extract.py | 2 ++ .../subscription_ytdl_options.py | 3 ++- tests/e2e/plugins/test_audio_extract.py | 2 -- .../plugins/split_by_chapters_video.json | 22 +++++++++---------- ...ters_with_regex_no_chapters_video_pass.txt | 2 +- .../split_by_chapters_with_regex_video.json | 22 +++++++++---------- .../plugins/test_audio_extract_playlist.json | 6 ++--- .../plugins/test_audio_extract_single.json | 2 +- .../test_audio_extract_single_best.json | 4 ++-- .../test_audio_extract_single_best.txt | 2 +- 10 files changed, 34 insertions(+), 33 deletions(-) diff --git a/src/ytdl_sub/plugins/audio_extract.py b/src/ytdl_sub/plugins/audio_extract.py index 3c5368a4..2fbd1d6b 100644 --- a/src/ytdl_sub/plugins/audio_extract.py +++ b/src/ytdl_sub/plugins/audio_extract.py @@ -102,6 +102,8 @@ class AudioExtractPlugin(Plugin[AudioExtractOptions]): return ytdl_options_builder.add( { "postprocessors": [postprocessor_dict], + "format": "bestaudio/best", + "keepvideo": False, } ).to_dict() diff --git a/src/ytdl_sub/subscriptions/subscription_ytdl_options.py b/src/ytdl_sub/subscriptions/subscription_ytdl_options.py index c407cd8a..4f6292f1 100644 --- a/src/ytdl_sub/subscriptions/subscription_ytdl_options.py +++ b/src/ytdl_sub/subscriptions/subscription_ytdl_options.py @@ -178,6 +178,7 @@ class SubscriptionYTDLOptions: self._output_options, self._plugin_match_filters, self._plugin_ytdl_options(FormatPlugin), + self._plugin_ytdl_options(AudioExtractPlugin), # will override format self._user_ytdl_options, # user ytdl options... self._info_json_only_options, # then info_json_only options ) @@ -195,8 +196,8 @@ class SubscriptionYTDLOptions: self._plugin_ytdl_options(FileConvertPlugin), self._plugin_ytdl_options(SubtitlesPlugin), self._plugin_ytdl_options(ChaptersPlugin), - self._plugin_ytdl_options(AudioExtractPlugin), self._plugin_ytdl_options(FormatPlugin), + self._plugin_ytdl_options(AudioExtractPlugin), # will override format self._user_ytdl_options, # user ytdl options... self._download_only_options, # then download_only options ) diff --git a/tests/e2e/plugins/test_audio_extract.py b/tests/e2e/plugins/test_audio_extract.py index b50972a5..90be1603 100644 --- a/tests/e2e/plugins/test_audio_extract.py +++ b/tests/e2e/plugins/test_audio_extract.py @@ -13,7 +13,6 @@ def single_preset_dict(output_directory): "music_tags": {"genres": ["multi_tag_1", "multi_tag_2"]}, # test the new embed_thumbnail plugin "embed_thumbnail": True, - "format": "worst[ext=mp4]", "audio_extract": {"codec": "mp3", "quality": 320}, "ytdl_options": { "postprocessor_args": {"ffmpeg": ["-bitexact"]}, # Must add this for reproducibility @@ -36,7 +35,6 @@ def youtube_release_preset_dict(output_directory): return { "preset": "YouTube Releases", "audio_extract": {"codec": "vorbis", "quality": 140}, - "format": "worst[ext=mp4]", # download the worst format so it is fast "ytdl_options": { "postprocessor_args": {"ffmpeg": ["-bitexact"]}, # Must add this for reproducibility }, 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 5ef02a47..07adaebb 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-Proved Records-download-archive.json": "c3fb0b4f31caaa10ac7954ea93da33c4", - "Proved Records/[2017] Alfa Mist - Nocturne [Full Album]/01 - 01. Intro (Feat. Racheal Ofori & Barney Artist).mp3": "29d09da874133ce5c5f7459c2fa6cd85", - "Proved Records/[2017] Alfa Mist - Nocturne [Full Album]/02 - 02. Answers (Feat. Rick David & Kaya Thomas - Dyke).mp3": "d5432e6a4f7af9810b0e7c8eebe4898a", - "Proved Records/[2017] Alfa Mist - Nocturne [Full Album]/03 - 03. Blaze (Feat. Kaya Thomas - Dyke).mp3": "cf03da6688a73373f9295dc595156e11", - "Proved Records/[2017] Alfa Mist - Nocturne [Full Album]/04 - 04. What If (Interlude).mp3": "b7b943b6f3395c05433b8532364d63d6", - "Proved Records/[2017] Alfa Mist - Nocturne [Full Album]/05 - 05. No Peace (Feat. Tom Misch).mp3": "0d9719268900d4abcd8c0f51ad3af92c", - "Proved Records/[2017] Alfa Mist - Nocturne [Full Album]/06 - 06. Closer (Feat. Lester Duval).mp3": "bbd9ec616a0f7d3c5d13c04bb118681e", - "Proved Records/[2017] Alfa Mist - Nocturne [Full Album]/07 - 07. Delusions: Rumination (Interlude) (Feat. Racheal Ofori).mp3": "2e59ecdc0f8050bcf190a7898d7ae968", - "Proved Records/[2017] Alfa Mist - Nocturne [Full Album]/08 - 08. Dreams (Feat. Carmody).mp3": "e58966f3326b876f0ab97459b681f76f", - "Proved Records/[2017] Alfa Mist - Nocturne [Full Album]/09 - 09. Dreaming (Interlude) (Feat. Racheal Ofori).mp3": "d6939215b73457fce4e026f8c9b57ecc", - "Proved Records/[2017] Alfa Mist - Nocturne [Full Album]/10 - 10. Hopeful (Feat. Jordan Rakei).mp3": "82d0e7d8070fd15d71c2e11c0285d426", - "Proved Records/[2017] Alfa Mist - Nocturne [Full Album]/11 - 11. Sunrise (Pillows) (Feat. Emmavie).mp3": "3edb11e8cd5f270dd42ee62d9a9aa4ff", + "Proved Records/[2017] Alfa Mist - Nocturne [Full Album]/01 - 01. Intro (Feat. Racheal Ofori & Barney Artist).mp3": "1e3583c9c1dc166b7baf98b81b4ca106", + "Proved Records/[2017] Alfa Mist - Nocturne [Full Album]/02 - 02. Answers (Feat. Rick David & Kaya Thomas - Dyke).mp3": "bb4c9085a4345515e6dffcf2c09f0f0f", + "Proved Records/[2017] Alfa Mist - Nocturne [Full Album]/03 - 03. Blaze (Feat. Kaya Thomas - Dyke).mp3": "c6766f80d0f9993ec6051555cd37dc32", + "Proved Records/[2017] Alfa Mist - Nocturne [Full Album]/04 - 04. What If (Interlude).mp3": "2139e6eedc4d1bc2025f8ef78b0bd2af", + "Proved Records/[2017] Alfa Mist - Nocturne [Full Album]/05 - 05. No Peace (Feat. Tom Misch).mp3": "8194d6a4018121e40b1733a0fa7a382e", + "Proved Records/[2017] Alfa Mist - Nocturne [Full Album]/06 - 06. Closer (Feat. Lester Duval).mp3": "e244183723e23c65156076b5f7ffcf56", + "Proved Records/[2017] Alfa Mist - Nocturne [Full Album]/07 - 07. Delusions: Rumination (Interlude) (Feat. Racheal Ofori).mp3": "692224c169be4735c0892e05726cb335", + "Proved Records/[2017] Alfa Mist - Nocturne [Full Album]/08 - 08. Dreams (Feat. Carmody).mp3": "561c339d4d1232c15ad38a5afe8d61c3", + "Proved Records/[2017] Alfa Mist - Nocturne [Full Album]/09 - 09. Dreaming (Interlude) (Feat. Racheal Ofori).mp3": "bdef7ad26848b45552891b9ea722659e", + "Proved Records/[2017] Alfa Mist - Nocturne [Full Album]/10 - 10. Hopeful (Feat. Jordan Rakei).mp3": "ffff4506702e708288eb54eff8fbaca4", + "Proved Records/[2017] Alfa Mist - Nocturne [Full Album]/11 - 11. Sunrise (Pillows) (Feat. Emmavie).mp3": "41a88d6c07047bb4215fed0e71443f17", "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_no_chapters_video_pass.txt b/tests/resources/expected_downloads_summaries/plugins/split_by_chapters_with_regex_no_chapters_video_pass.txt index 4b7fb2b5..97f6d053 100644 --- a/tests/resources/expected_downloads_summaries/plugins/split_by_chapters_with_regex_no_chapters_video_pass.txt +++ b/tests/resources/expected_downloads_summaries/plugins/split_by_chapters_with_regex_no_chapters_video_pass.txt @@ -1,5 +1,5 @@ { ".ytdl-sub-split_by_chapters_with_regex_video_no_chapters-download-archive.json": "4008e43668447f1a3a6a55520a6ff475", - "Project Zombie/[2010] Oblivion Mod "Falcor" p.1/01 - Oblivion Mod "Falcor" p.1.mp3": "d53121df33ac8c4a4699ec8919196552", + "Project Zombie/[2010] Oblivion Mod "Falcor" p.1/01 - Oblivion Mod "Falcor" p.1.mp3": "b886f268a2a9b3b62f528fcf46699082", "Project Zombie/[2010] Oblivion Mod "Falcor" p.1/folder.jpg": "fb95b510681676e81c321171fc23143e" } \ 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 653c1f0d..c57034be 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_preset-download-archive.json": "9798e8289742586d0efd295a97c6c906", - "Alfa Mist/[2017] Nocturne/01 - Intro (Feat. Racheal Ofori & Barney Artist).mp3": "7be57c4dde9ba2c3fa72e9cc65b0f586", - "Alfa Mist/[2017] Nocturne/02 - Answers (Feat. Rick David & Kaya Thomas - Dyke).mp3": "5ee032da9965c51913fcfa0319d061bd", - "Alfa Mist/[2017] Nocturne/03 - Blaze (Feat. Kaya Thomas - Dyke).mp3": "82c1f35bdccfb4ec146f33661ac94d6b", - "Alfa Mist/[2017] Nocturne/04 - What If (Interlude).mp3": "040b38c249e478d8832dcea8bfeca17f", - "Alfa Mist/[2017] Nocturne/05 - No Peace (Feat. Tom Misch).mp3": "06f7e57fecdc7b4d2e37c7652791ce19", - "Alfa Mist/[2017] Nocturne/06 - Closer (Feat. Lester Duval).mp3": "91a03449c33bf9dcff5a9654a8525626", - "Alfa Mist/[2017] Nocturne/07 - Delusions: Rumination (Interlude) (Feat. Racheal Ofori).mp3": "54c26621b8d4e74f37217c836479a077", - "Alfa Mist/[2017] Nocturne/08 - Dreams (Feat. Carmody).mp3": "2704327ac5998086e77a77da164e2afd", - "Alfa Mist/[2017] Nocturne/09 - Dreaming (Interlude) (Feat. Racheal Ofori).mp3": "75b8a26d3099aa2d9ba488b33c4eb1e7", - "Alfa Mist/[2017] Nocturne/10 - Hopeful (Feat. Jordan Rakei).mp3": "0bf0979c99c55ef986efaba55c0dc858", - "Alfa Mist/[2017] Nocturne/11 - Sunrise (Pillows) (Feat. Emmavie).mp3": "78950fbfe459de8e9aa951ab6fa153bf", + "Alfa Mist/[2017] Nocturne/01 - Intro (Feat. Racheal Ofori & Barney Artist).mp3": "d07f90d214416a11736e3f73c0955208", + "Alfa Mist/[2017] Nocturne/02 - Answers (Feat. Rick David & Kaya Thomas - Dyke).mp3": "9057d3d7fcd98701e06d399a507c0e5b", + "Alfa Mist/[2017] Nocturne/03 - Blaze (Feat. Kaya Thomas - Dyke).mp3": "4cc4e7066112388e83bdd9e803e8051a", + "Alfa Mist/[2017] Nocturne/04 - What If (Interlude).mp3": "8d0f04c04f8c2b0565954dac66ee29a3", + "Alfa Mist/[2017] Nocturne/05 - No Peace (Feat. Tom Misch).mp3": "e8166110c85e6b9af8d1067b8ffbb428", + "Alfa Mist/[2017] Nocturne/06 - Closer (Feat. Lester Duval).mp3": "64e39199ddcd05b96c15c82a3c695d25", + "Alfa Mist/[2017] Nocturne/07 - Delusions: Rumination (Interlude) (Feat. Racheal Ofori).mp3": "9a53bee41d1985e48e771a02b052986b", + "Alfa Mist/[2017] Nocturne/08 - Dreams (Feat. Carmody).mp3": "19c50e84c08eacdd1095e461306d9077", + "Alfa Mist/[2017] Nocturne/09 - Dreaming (Interlude) (Feat. Racheal Ofori).mp3": "f28df20fdbadf0ec4985b5f1f30c4e5d", + "Alfa Mist/[2017] Nocturne/10 - Hopeful (Feat. Jordan Rakei).mp3": "d7261e48713426ad4905919915a9b103", + "Alfa Mist/[2017] Nocturne/11 - Sunrise (Pillows) (Feat. Emmavie).mp3": "5d51491d0999e1f29918d4db4ed796d3", "Alfa Mist/[2017] Nocturne/folder.jpg": "bd3685acc53072e591bae2505ecb0648" } \ No newline at end of file diff --git a/tests/resources/expected_downloads_summaries/plugins/test_audio_extract_playlist.json b/tests/resources/expected_downloads_summaries/plugins/test_audio_extract_playlist.json index bca32890..662e2f86 100644 --- a/tests/resources/expected_downloads_summaries/plugins/test_audio_extract_playlist.json +++ b/tests/resources/expected_downloads_summaries/plugins/test_audio_extract_playlist.json @@ -1,7 +1,7 @@ { ".ytdl-sub-multiple_songs_test-download-archive.json": "54237df5e00d1598dfd39f341ee03d75", - "Project Zombie/[2011] Jesse's Minecraft Server/01 - Jesse's Minecraft Server [Trailer - Mar.21].ogg": "93665cc4302010d9f20001f308c4978a", - "Project Zombie/[2011] Jesse's Minecraft Server/02 - Jesse's Minecraft Server [Trailer - Feb.27].ogg": "a2a3a34e02e26a6c0265530d4499473b", - "Project Zombie/[2011] Jesse's Minecraft Server/03 - Jesse's Minecraft Server [Trailer - Feb.1].ogg": "0a385da3aa06b994a69b8ab812b44975", + "Project Zombie/[2011] Jesse's Minecraft Server/01 - Jesse's Minecraft Server [Trailer - Mar.21].ogg": "e7a8a94ebe9f02f086f4bbf3df3946f6", + "Project Zombie/[2011] Jesse's Minecraft Server/02 - Jesse's Minecraft Server [Trailer - Feb.27].ogg": "aeea4b086507fd7fde3c09c0bd868950", + "Project Zombie/[2011] Jesse's Minecraft Server/03 - Jesse's Minecraft Server [Trailer - Feb.1].ogg": "80200d21a46c7f521bfb23aef2f87e34", "Project Zombie/[2011] Jesse's Minecraft Server/folder.jpg": "e7830aa8a64b0cde65ba3f7e5fc56530" } \ No newline at end of file diff --git a/tests/resources/expected_downloads_summaries/plugins/test_audio_extract_single.json b/tests/resources/expected_downloads_summaries/plugins/test_audio_extract_single.json index e0035559..180cc879 100644 --- a/tests/resources/expected_downloads_summaries/plugins/test_audio_extract_single.json +++ b/tests/resources/expected_downloads_summaries/plugins/test_audio_extract_single.json @@ -1,5 +1,5 @@ { ".ytdl-sub-single_song_test-download-archive.json": "c8ff22ec3304c9f8dab18cedaed4e8b4", - "YouTube/[2019] YouTube Rewind 2019: For the Record | #YouTubeRewind/01 - YouTube Rewind 2019: For the Record | #YouTubeRewind.mp3": "991b0eb62683c2194c5bdfa9a61ab18e", + "YouTube/[2019] YouTube Rewind 2019: For the Record | #YouTubeRewind/01 - YouTube Rewind 2019: For the Record | #YouTubeRewind.mp3": "829eb7dcc5dcae41240701dec4e1708d", "YouTube/[2019] YouTube Rewind 2019: For the Record | #YouTubeRewind/folder.jpg": "50ee47c80f679029f5d3503bb91b045a" } \ No newline at end of file diff --git a/tests/resources/expected_downloads_summaries/plugins/test_audio_extract_single_best.json b/tests/resources/expected_downloads_summaries/plugins/test_audio_extract_single_best.json index 11201b53..25c1b7e9 100644 --- a/tests/resources/expected_downloads_summaries/plugins/test_audio_extract_single_best.json +++ b/tests/resources/expected_downloads_summaries/plugins/test_audio_extract_single_best.json @@ -1,5 +1,5 @@ { - ".ytdl-sub-single_song_best_test-download-archive.json": "f179ccfe0a9b3a76ae62122a3ccb58fd", - "YouTube/[2019] YouTube Rewind 2019: For the Record | #YouTubeRewind/01 - YouTube Rewind 2019: For the Record | #YouTubeRewind.m4a": "114b35c29df84146cd98207f807b837b", + ".ytdl-sub-single_song_best_test-download-archive.json": "0f9484ed868dcbeef82810a3cf7b0eea", + "YouTube/[2019] YouTube Rewind 2019: For the Record | #YouTubeRewind/01 - YouTube Rewind 2019: For the Record | #YouTubeRewind.opus": "73e4afdda9bc792807c8b07a63128e5a", "YouTube/[2019] YouTube Rewind 2019: For the Record | #YouTubeRewind/folder.jpg": "50ee47c80f679029f5d3503bb91b045a" } \ No newline at end of file diff --git a/tests/resources/transaction_log_summaries/plugins/test_audio_extract_single_best.txt b/tests/resources/transaction_log_summaries/plugins/test_audio_extract_single_best.txt index 9b538e8d..07cb8132 100644 --- a/tests/resources/transaction_log_summaries/plugins/test_audio_extract_single_best.txt +++ b/tests/resources/transaction_log_summaries/plugins/test_audio_extract_single_best.txt @@ -3,7 +3,7 @@ Files created: {output_directory} .ytdl-sub-single_song_best_test-download-archive.json {output_directory}/YouTube/[2019] YouTube Rewind 2019: For the Record | #YouTubeRewind - 01 - YouTube Rewind 2019: For the Record | #YouTubeRewind.m4a + 01 - YouTube Rewind 2019: For the Record | #YouTubeRewind.opus Music Tags: album: YouTube Rewind 2019: For the Record | #YouTubeRewind albumartist: YouTube From c7823a40ad3ba1545e69717e97d54ef2ec32bc50 Mon Sep 17 00:00:00 2001 From: Qualis Svagtlys <45446348+Svagtlys@users.noreply.github.com> Date: Thu, 18 Jan 2024 17:01:29 -0600 Subject: [PATCH 2/2] [DEV] Prebuilt Presets Revamp (#864) Modifies some of the prebuilt preset logic in the backend --- ...on.yaml => download_deletion_options.yaml} | 51 +++--- .../helpers/media_quality.yaml | 40 +++++ .../music/albums_from_chapters.yaml | 21 +++ .../music/albums_from_playlists.yaml | 36 ++++ .../prebuilt_presets/music/music.yaml | 163 ------------------ .../music/other_websites.yaml | 38 ++++ .../prebuilt_presets/music/singles.yaml | 72 ++++++++ .../music_videos/music_video_base.yaml | 35 ++++ .../music_videos/music_videos.yaml | 70 ++------ .../prebuilt_presets/tv_show/episode.yaml | 99 +---------- .../prebuilt_presets/tv_show/tv_show.yaml | 37 +++- .../tv_show/tv_show_by_date.yaml | 44 ++++- .../tv_show/tv_show_collection.yaml | 26 ++- 13 files changed, 391 insertions(+), 341 deletions(-) rename src/ytdl_sub/prebuilt_presets/helpers/{common.yaml => download_deletion_options.yaml} (70%) create mode 100644 src/ytdl_sub/prebuilt_presets/helpers/media_quality.yaml create mode 100644 src/ytdl_sub/prebuilt_presets/music/albums_from_chapters.yaml create mode 100644 src/ytdl_sub/prebuilt_presets/music/albums_from_playlists.yaml delete mode 100644 src/ytdl_sub/prebuilt_presets/music/music.yaml create mode 100644 src/ytdl_sub/prebuilt_presets/music/other_websites.yaml create mode 100644 src/ytdl_sub/prebuilt_presets/music/singles.yaml create mode 100644 src/ytdl_sub/prebuilt_presets/music_videos/music_video_base.yaml diff --git a/src/ytdl_sub/prebuilt_presets/helpers/common.yaml b/src/ytdl_sub/prebuilt_presets/helpers/download_deletion_options.yaml similarity index 70% rename from src/ytdl_sub/prebuilt_presets/helpers/common.yaml rename to src/ytdl_sub/prebuilt_presets/helpers/download_deletion_options.yaml index 9278d012..cc964d4d 100644 --- a/src/ytdl_sub/prebuilt_presets/helpers/common.yaml +++ b/src/ytdl_sub/prebuilt_presets/helpers/download_deletion_options.yaml @@ -1,16 +1,29 @@ - - presets: - best_video_quality: - format: "bestvideo+bestaudio/best" - ytdl_options: - merge_output_format: "mp4" + "Only Recent": + preset: + - "Only Recent Archive" + # Only fetch videos after today minus date_range - max_1080p: - format: "(bv*[height<=1080]+bestaudio/best[height<=1080])" - ytdl_options: - merge_output_format: "mp4" + # Only keep files uploaded after date_range + output_options: + keep_files_after: "today-{only_recent_date_range}" + keep_max_files: "{only_recent_max_files}" + + overrides: + only_recent_max_files: 0 + + + "Only Recent Archive": + # Only fetch videos after today minus date_range + date_range: + after: "today-{only_recent_date_range}" + + # Set the default date_range to 2 months + overrides: + date_range: "2months" # keep for legacy-reasons + only_recent_date_range: "{date_range}" + chunk_initial_download: ytdl_options: @@ -19,18 +32,6 @@ presets: break_on_existing: False break_on_reject: True - "Only Recent": - # Only fetch videos after today minus date_range - date_range: - after: "today-{only_recent_date_range}" - - # Only keep files uploaded after date_range - output_options: - keep_files_after: "today-{only_recent_date_range}" - keep_max_files: "{only_recent_max_files}" - - # Set the default date_range to 2 months - overrides: - date_range: "2months" # keep for legacy-reasons - only_recent_date_range: "{date_range}" - only_recent_max_files: 0 \ No newline at end of file + "Download in Chunks": + preset: + - chunk_initial_download \ No newline at end of file diff --git a/src/ytdl_sub/prebuilt_presets/helpers/media_quality.yaml b/src/ytdl_sub/prebuilt_presets/helpers/media_quality.yaml new file mode 100644 index 00000000..7bb5e53d --- /dev/null +++ b/src/ytdl_sub/prebuilt_presets/helpers/media_quality.yaml @@ -0,0 +1,40 @@ +presets: + + best_video_quality: + format: "bestvideo+bestaudio/best" + ytdl_options: + merge_output_format: "mp4" + + "Best Video Quality": + preset: + - best_video_quality + + + "Max 2160p": + format: "(bv*[height<=2160]+bestaudio/best[height<=2160])" + ytdl_options: + merge_output_format: "mp4" + + "Max 1440p": + format: "(bv*[height<=1440]+bestaudio/best[height<=1440])" + ytdl_options: + merge_output_format: "mp4" + + max_1080p: + format: "(bv*[height<=1080]+bestaudio/best[height<=1080])" + ytdl_options: + merge_output_format: "mp4" + + "Max 1080p": + preset: + - max_1080p + + "Max 720p": + format: "(bv*[height<=720]+bestaudio/best[height<=720])" + ytdl_options: + merge_output_format: "mp4" + + "Max 480p": + format: "(bv*[height<=480]+bestaudio/best[height<=480])" + ytdl_options: + merge_output_format: "mp4" \ No newline at end of file diff --git a/src/ytdl_sub/prebuilt_presets/music/albums_from_chapters.yaml b/src/ytdl_sub/prebuilt_presets/music/albums_from_chapters.yaml new file mode 100644 index 00000000..0c629516 --- /dev/null +++ b/src/ytdl_sub/prebuilt_presets/music/albums_from_chapters.yaml @@ -0,0 +1,21 @@ +presets: + + # assumes that each chapter in an entry is a song + _albums_from_chapters: + preset: "Single" + + chapters: + embed_chapters: True + split_by_chapters: + when_no_chapters: "pass" + + overrides: + track_title: "{chapter_title}" # Chapter title is the track title + track_album: "{title}" # Video's title is the album title + track_number: "{chapter_index}" + track_number_padded: "{chapter_index_padded}" + track_total: "{chapter_count}" + + "YouTube Full Albums": + preset: + - "_albums_from_chapters" \ No newline at end of file diff --git a/src/ytdl_sub/prebuilt_presets/music/albums_from_playlists.yaml b/src/ytdl_sub/prebuilt_presets/music/albums_from_playlists.yaml new file mode 100644 index 00000000..ab0955a0 --- /dev/null +++ b/src/ytdl_sub/prebuilt_presets/music/albums_from_playlists.yaml @@ -0,0 +1,36 @@ +presets: + + # assumes that each entry is a song in one album + _albums_from_playlists: + preset: + - "_music_base" + + download: + - url: "{url}" + include_sibling_metadata: True + + overrides: + track_album: "{playlist_title}" + track_number: "{playlist_index}" + track_number_padded: "{playlist_index_padded}" + track_total: "{playlist_count}" + track_year: "{playlist_max_upload_year}" + + "YouTube Releases": + preset: + - "_albums_from_playlists" + + "Bandcamp": + preset: + - "_albums_from_playlists" + regex: + from: + title: + match: + - ".*? - (.*)" # Captures 'Some - Song' from 'Emily Hopkins - Some - Song' + capture_group_names: + - "captured_track_title" + capture_group_defaults: + - "{title}" + overrides: + track_title: "{captured_track_title}" \ No newline at end of file diff --git a/src/ytdl_sub/prebuilt_presets/music/music.yaml b/src/ytdl_sub/prebuilt_presets/music/music.yaml deleted file mode 100644 index 7c2f23a3..00000000 --- a/src/ytdl_sub/prebuilt_presets/music/music.yaml +++ /dev/null @@ -1,163 +0,0 @@ -presets: - - _music_base: - output_options: - output_directory: "{music_directory}" - file_name: "{track_full_path}" - thumbnail_name: "{album_cover_path}" - maintain_download_archive: True - - ytdl_options: - break_on_existing: True - - format: "ba[ext=webm]/ba" - - audio_extract: - codec: "best" - - music_tags: - artist: "{track_artist}" - albumartist: "{track_album_artist}" - title: "{track_title}" - album: "{track_album}" - track: "{track_number}" - tracktotal: "{track_total}" - year: "{track_year}" - # multi-tags - artists: - - "{track_artist}" - albumartists: - - "{track_album_artist}" - genres: - - "{track_genre}" - - overrides: -# MUST DEFINE: -# music_directory - - # Defaults - track_genre_default: "Unset" - - # Subscription overrides - subscription_indent_1: "{track_genre_default}" - subscription_value: "" - url: "{subscription_value}" - - # Track Overrides - track_title: "{title}" - track_album: "{title}" - track_artist: "{subscription_name}" - track_album_artist: "{track_artist}" - track_number: "1" - track_number_padded: "01" - track_total: "1" - track_year: "{upload_year}" - track_genre: "{subscription_indent_1}" - - # Directory Overrides - artist_dir: "{track_artist_sanitized}" - album_dir: "[{track_year}] {track_album_sanitized}" - track_file_name: "{track_number_padded} - {track_title_sanitized}.{ext}" - track_full_path: "{artist_dir}/{album_dir}/{track_file_name}" - album_cover_path: "{artist_dir}/{album_dir}/folder.{thumbnail_ext}" - - - "Single": - preset: - - "_music_base" - - download: - - url: "{url}" - include_sibling_metadata: False - - - _albums_from_playlists: - preset: - - "_music_base" - - download: - - url: "{url}" - include_sibling_metadata: True - - overrides: - track_album: "{playlist_title}" - track_number: "{playlist_index}" - track_number_padded: "{playlist_index_padded}" - track_total: "{playlist_count}" - track_year: "{playlist_max_upload_year}" - - - _albums_from_chapters: - preset: "Single" - - chapters: - embed_chapters: True - split_by_chapters: - when_no_chapters: "pass" - - overrides: - track_title: "{chapter_title}" # Chapter title is the track title - track_album: "{title}" # Video's title is the album title - track_number: "{chapter_index}" - track_number_padded: "{chapter_index_padded}" - track_total: "{chapter_count}" - - "SoundCloud Discography": - preset: "_music_base" - - # Download using the multi_url strategy - download: - download_strategy: "multi_url" - urls: - # The first URL will be all the artist's tracks. - # Treat these as singles - an album with a single track - - url: "{url}/tracks" - include_sibling_metadata: False - variables: - sc_track_album: "{title}" - sc_track_number: "1" - sc_track_number_padded: "01" - sc_track_total: "1" - sc_track_year: "{upload_year}" - # Set the second URL to the artist's albums. If a track belongs to both - # to an album and tracks (in the URL above), it will resolve to this - # URL and include the album metadata we set below. - - url: "{url}/albums" - include_sibling_metadata: True - variables: - sc_track_album: "{playlist_title}" - sc_track_number: "{playlist_index}" - sc_track_number_padded: "{playlist_index_padded}" - sc_track_total: "{playlist_count}" - sc_track_year: "{playlist_max_upload_year}" - - # Override various track properties using playlist variables. - overrides: - track_album: "{sc_track_album}" - track_number: "{sc_track_number}" - track_number_padded: "{sc_track_number_padded}" - track_total: "{sc_track_total}" - track_year: "{sc_track_year}" - - "YouTube Releases": - preset: - - "_albums_from_playlists" - - "YouTube Full Albums": - preset: - - "_albums_from_chapters" - - "Bandcamp": - preset: - - "_albums_from_playlists" - regex: - from: - title: - match: - - ".*? - (.*)" # Captures 'Some - Song' from 'Emily Hopkins - Some - Song' - capture_group_names: - - "captured_track_title" - capture_group_defaults: - - "{title}" - overrides: - track_title: "{captured_track_title}" diff --git a/src/ytdl_sub/prebuilt_presets/music/other_websites.yaml b/src/ytdl_sub/prebuilt_presets/music/other_websites.yaml new file mode 100644 index 00000000..14780bea --- /dev/null +++ b/src/ytdl_sub/prebuilt_presets/music/other_websites.yaml @@ -0,0 +1,38 @@ +presets: + + "SoundCloud Discography": + preset: "_music_base" + + # Download using the multi_url strategy + download: + download_strategy: "multi_url" + urls: + # The first URL will be all the artist's tracks. + # Treat these as singles - an album with a single track + - url: "{url}/tracks" + include_sibling_metadata: False + variables: + sc_track_album: "{title}" + sc_track_number: "1" + sc_track_number_padded: "01" + sc_track_total: "1" + sc_track_year: "{upload_year}" + # Set the second URL to the artist's albums. If a track belongs to both + # to an album and tracks (in the URL above), it will resolve to this + # URL and include the album metadata we set below. + - url: "{url}/albums" + include_sibling_metadata: True + variables: + sc_track_album: "{playlist_title}" + sc_track_number: "{playlist_index}" + sc_track_number_padded: "{playlist_index_padded}" + sc_track_total: "{playlist_count}" + sc_track_year: "{playlist_max_upload_year}" + + # Override various track properties using playlist variables. + overrides: + track_album: "{sc_track_album}" + track_number: "{sc_track_number}" + track_number_padded: "{sc_track_number_padded}" + track_total: "{sc_track_total}" + track_year: "{sc_track_year}" \ No newline at end of file diff --git a/src/ytdl_sub/prebuilt_presets/music/singles.yaml b/src/ytdl_sub/prebuilt_presets/music/singles.yaml new file mode 100644 index 00000000..634fd43f --- /dev/null +++ b/src/ytdl_sub/prebuilt_presets/music/singles.yaml @@ -0,0 +1,72 @@ +presets: + + + _music_base: + output_options: + output_directory: "{music_directory}" + file_name: "{track_full_path}" + thumbnail_name: "{album_cover_path}" + maintain_download_archive: True + + ytdl_options: + break_on_existing: True + + format: "ba[ext=webm]/ba" + + audio_extract: + codec: "best" + + music_tags: + artist: "{track_artist}" + albumartist: "{track_album_artist}" + title: "{track_title}" + album: "{track_album}" + track: "{track_number}" + tracktotal: "{track_total}" + year: "{track_year}" + # multi-tags + artists: + - "{track_artist}" + albumartists: + - "{track_album_artist}" + genres: + - "{track_genre}" + + overrides: +# MUST DEFINE: +# music_directory + + # Defaults + track_genre_default: "Unset" + + # Subscription overrides + subscription_indent_1: "{track_genre_default}" + subscription_value: "" + url: "{subscription_value}" + + # Track Overrides + track_title: "{title}" + track_album: "{title}" + track_artist: "{subscription_name}" + track_album_artist: "{track_artist}" + track_number: "1" + track_number_padded: "01" + track_total: "1" + track_year: "{upload_year}" + track_genre: "{subscription_indent_1}" + + # Directory Overrides + artist_dir: "{track_artist_sanitized}" + album_dir: "[{track_year}] {track_album_sanitized}" + track_file_name: "{track_number_padded} - {track_title_sanitized}.{ext}" + track_full_path: "{artist_dir}/{album_dir}/{track_file_name}" + album_cover_path: "{artist_dir}/{album_dir}/folder.{thumbnail_ext}" + + + "Single": + preset: + - "_music_base" + + download: + - url: "{url}" + include_sibling_metadata: False \ No newline at end of file diff --git a/src/ytdl_sub/prebuilt_presets/music_videos/music_video_base.yaml b/src/ytdl_sub/prebuilt_presets/music_videos/music_video_base.yaml new file mode 100644 index 00000000..9f85dd46 --- /dev/null +++ b/src/ytdl_sub/prebuilt_presets/music_videos/music_video_base.yaml @@ -0,0 +1,35 @@ +presets: + _music_video_base: + preset: + - "_multi_url" + + output_options: + output_directory: "{music_video_directory}" + file_name: "{music_video_file_name}.{ext}" + thumbnail_name: "{music_video_file_name}.jpg" + maintain_download_archive: True + + ytdl_options: + break_on_existing: True + + overrides: +# MUST DEFINE: +# music_video_directory + + # Defaults + music_video_genre_default: "ytdl-sub" + music_video_album_default: "Music Videos" + + # Subscription overrides + subscription_indent_1: "{music_video_genre_default}" + + # Music Video Overrides + music_video_title: "{title}" + music_video_album: "{music_video_album_default}" + music_video_artist: "{subscription_name}" + music_video_year: "{upload_year}" + music_video_date: "{upload_date_standardized}" + music_video_genre: "{subscription_indent_1}" + + # Directory Overrides + music_video_file_name: "{music_video_artist_sanitized}/{music_video_title_sanitized}" \ No newline at end of file diff --git a/src/ytdl_sub/prebuilt_presets/music_videos/music_videos.yaml b/src/ytdl_sub/prebuilt_presets/music_videos/music_videos.yaml index 47c73bb6..dcacd330 100644 --- a/src/ytdl_sub/prebuilt_presets/music_videos/music_videos.yaml +++ b/src/ytdl_sub/prebuilt_presets/music_videos/music_videos.yaml @@ -1,38 +1,24 @@ presets: - _music_video_base: + + "Jellyfin Music Videos": preset: - - "_multi_url" + - "_base" + - "_music_video_base" + - "_music_video_nfo" + - "_music_video_tags" - output_options: - output_directory: "{music_video_directory}" - file_name: "{music_video_file_name}.{ext}" - thumbnail_name: "{music_video_file_name}.jpg" - maintain_download_archive: True + "Kodi Music Videos": + preset: + - "_kodi_base" + - "_music_video_base" + - "_music_video_nfo" + - "_music_video_tags" - ytdl_options: - break_on_existing: True - - overrides: -# MUST DEFINE: -# music_video_directory - - # Defaults - music_video_genre_default: "ytdl-sub" - music_video_album_default: "Music Videos" - - # Subscription overrides - subscription_indent_1: "{music_video_genre_default}" - - # Music Video Overrides - music_video_title: "{title}" - music_video_album: "{music_video_album_default}" - music_video_artist: "{subscription_name}" - music_video_year: "{upload_year}" - music_video_date: "{upload_date_standardized}" - music_video_genre: "{subscription_indent_1}" - - # Directory Overrides - music_video_file_name: "{music_video_artist_sanitized}/{music_video_title_sanitized}" + "Plex Music Videos": + preset: + - "_plex_video_base" + - "_music_video_base" + - "_music_video_tags" _music_video_nfo: nfo_tags: @@ -54,24 +40,4 @@ presets: album: "{music_video_album}" genre: "{music_video_genre}" year: "{music_video_year}" - premiered: "{music_video_date}" - - "Jellyfin Music Videos": - preset: - - "_base" - - "_music_video_base" - - "_music_video_nfo" - - "_music_video_tags" - - "Kodi Music Videos": - preset: - - "_kodi_base" - - "_music_video_base" - - "_music_video_nfo" - - "_music_video_tags" - - "Plex Music Videos": - preset: - - "_plex_video_base" - - "_music_video_base" - - "_music_video_tags" \ No newline at end of file + premiered: "{music_video_date}" \ No newline at end of file diff --git a/src/ytdl_sub/prebuilt_presets/tv_show/episode.yaml b/src/ytdl_sub/prebuilt_presets/tv_show/episode.yaml index bb1c9047..b6bacd27 100644 --- a/src/ytdl_sub/prebuilt_presets/tv_show/episode.yaml +++ b/src/ytdl_sub/prebuilt_presets/tv_show/episode.yaml @@ -6,7 +6,7 @@ presets: output_options: output_directory: "{tv_show_directory}/{tv_show_name_sanitized}" file_name: "{episode_file_path}.{ext}" - thumbnail_name: "{episode_file_path}-thumb.jpg" + thumbnail_name: "{thumbnail_file_name}" info_json_name: "{episode_file_path}.{info_json_ext}" maintain_download_archive: True @@ -43,102 +43,7 @@ presets: episode_date_standardized: "{upload_date_standardized}" episode_file_name: "s{season_number_padded}.e{episode_number_padded} - {file_title}" episode_file_path: "{season_directory_name_sanitized}/{episode_file_name_sanitized}" + thumbnail_file_name: "{episode_file_path}-thumb.jpg" - _episode_video_tags: - video_tags: - show: "{tv_show_name}" - genre: "{tv_show_genre}" - episode_id: "{episode_number}" - title: "{episode_title}" - synopsis: "{episode_plot}" - year: "{episode_year}" - date: "{episode_date_standardized}" - contentRating: "{episode_content_rating}" - _episode_nfo_tags: - nfo_tags: - nfo_name: "{episode_file_path}.nfo" - nfo_root: "episodedetails" - tags: - genre: - - "{tv_show_genre}" - season: "{season_number}" - episode: "{episode_number}" - title: "{episode_title}" - plot: "{episode_plot}" - year: "{episode_year}" - aired: "{episode_date_standardized}" - mpaa: "{episode_content_rating}" - output_directory_nfo_tags: - nfo_name: "tvshow.nfo" - nfo_root: "tvshow" - tags: - title: "{tv_show_name}" - genre: - - "{tv_show_genre}" - mpaa: "{tv_show_content_rating}" - -#################################################################################################### - - _season_by_year: - overrides: - season_number: "{upload_year}" - season_number_padded: "{season_number}" - - _season_by_year_month: - overrides: - season_number: "{upload_year}{upload_month_padded}" - season_number_padded: "{season_number}" - -#################################################################################################### - - season_by_year_month__episode_by_day: - preset: - - "_season_by_year_month" - overrides: - episode_number: "{upload_day}{upload_date_index_padded}" - episode_number_padded: "{upload_day_padded}{upload_date_index_padded}" - - season_by_year__episode_by_month_day: - preset: - - "_season_by_year" - overrides: - episode_number: "{upload_month}{upload_day_padded}{upload_date_index_padded}" - episode_number_padded: "{upload_month_padded}{upload_day_padded}{upload_date_index_padded}" - - season_by_year__episode_by_month_day_reversed: - preset: - - "_season_by_year" - overrides: - episode_number: "{upload_day_of_year_reversed}{upload_date_index_reversed_padded}" - episode_number_padded: "{upload_day_of_year_reversed_padded}{upload_date_index_reversed_padded}" - - season_by_year__episode_by_download_index: - preset: - - "_season_by_year" - overrides: - episode_number: "{download_index}" - episode_number_padded: "{download_index_padded6}" - - ############### - - season_by_collection__episode_by_year_month_day: - overrides: - episode_number: "{upload_year_truncated}{upload_month_padded}{upload_day_padded}{upload_date_index_padded}" - episode_number_padded: "{episode_number}" - - season_by_collection__episode_by_year_month_day_reversed: - overrides: - episode_number: "{upload_year_truncated_reversed}{upload_month_reversed_padded}{upload_day_reversed_padded}{upload_date_index_reversed_padded}" - episode_number_padded: "{episode_number}" - - season_by_collection__episode_by_playlist_index: - overrides: - episode_number: "{playlist_index}" - episode_number_padded: "{playlist_index_padded6}" - - season_by_collection__episode_by_playlist_index_reversed: - overrides: - episode_number: "{playlist_index_reversed}" - episode_number_padded: "{playlist_index_reversed_padded6}" 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 308162e2..edf64ec5 100644 --- a/src/ytdl_sub/prebuilt_presets/tv_show/tv_show.yaml +++ b/src/ytdl_sub/prebuilt_presets/tv_show/tv_show.yaml @@ -46,4 +46,39 @@ presets: overrides: collection_season_number_padded: "{ %pad_zero(%int(collection_season_number), 2) }" season_number: "{collection_season_number}" - season_number_padded: "{collection_season_number_padded}" \ No newline at end of file + season_number_padded: "{collection_season_number_padded}" + + _episode_video_tags: + video_tags: + show: "{tv_show_name}" + genre: "{tv_show_genre}" + episode_id: "{episode_number}" + title: "{episode_title}" + synopsis: "{episode_plot}" + year: "{episode_year}" + date: "{episode_date_standardized}" + contentRating: "{episode_content_rating}" + + _episode_nfo_tags: + nfo_tags: + nfo_name: "{episode_file_path}.nfo" + nfo_root: "episodedetails" + tags: + genre: + - "{tv_show_genre}" + season: "{season_number}" + episode: "{episode_number}" + title: "{episode_title}" + plot: "{episode_plot}" + year: "{episode_year}" + aired: "{episode_date_standardized}" + mpaa: "{episode_content_rating}" + + output_directory_nfo_tags: + nfo_name: "tvshow.nfo" + nfo_root: "tvshow" + tags: + title: "{tv_show_name}" + genre: + - "{tv_show_genre}" + mpaa: "{tv_show_content_rating}" \ No newline at end of file diff --git a/src/ytdl_sub/prebuilt_presets/tv_show/tv_show_by_date.yaml b/src/ytdl_sub/prebuilt_presets/tv_show/tv_show_by_date.yaml index 275216fe..30027444 100644 --- a/src/ytdl_sub/prebuilt_presets/tv_show/tv_show_by_date.yaml +++ b/src/ytdl_sub/prebuilt_presets/tv_show/tv_show_by_date.yaml @@ -29,4 +29,46 @@ presets: "Plex TV Show by Date": preset: - "plex_tv_show_by_date" - - "season_by_year__episode_by_month_day" \ No newline at end of file + - "season_by_year__episode_by_month_day" + +#################################################################################################### + + _season_by_year: + overrides: + season_number: "{upload_year}" + season_number_padded: "{season_number}" + + _season_by_year_month: + overrides: + season_number: "{upload_year}{upload_month_padded}" + season_number_padded: "{season_number}" + +#################################################################################################### + + season_by_year_month__episode_by_day: + preset: + - "_season_by_year_month" + overrides: + episode_number: "{upload_day}{upload_date_index_padded}" + episode_number_padded: "{upload_day_padded}{upload_date_index_padded}" + + season_by_year__episode_by_month_day: + preset: + - "_season_by_year" + overrides: + episode_number: "{upload_month}{upload_day_padded}{upload_date_index_padded}" + episode_number_padded: "{upload_month_padded}{upload_day_padded}{upload_date_index_padded}" + + season_by_year__episode_by_month_day_reversed: + preset: + - "_season_by_year" + overrides: + episode_number: "{upload_day_of_year_reversed}{upload_date_index_reversed_padded}" + episode_number_padded: "{upload_day_of_year_reversed_padded}{upload_date_index_reversed_padded}" + + season_by_year__episode_by_download_index: + preset: + - "_season_by_year" + overrides: + episode_number: "{download_index}" + episode_number_padded: "{download_index_padded6}" \ No newline at end of file diff --git a/src/ytdl_sub/prebuilt_presets/tv_show/tv_show_collection.yaml b/src/ytdl_sub/prebuilt_presets/tv_show/tv_show_collection.yaml index e54e07d2..0999161c 100644 --- a/src/ytdl_sub/prebuilt_presets/tv_show/tv_show_collection.yaml +++ b/src/ytdl_sub/prebuilt_presets/tv_show/tv_show_collection.yaml @@ -1,6 +1,5 @@ presets: - kodi_tv_show_collection: preset: - "_kodi_tv_show" @@ -708,4 +707,27 @@ presets: namedseason: - tag: "{collection_season_40_name}" attributes: - number: "40" \ No newline at end of file + number: "40" + + + ############### + + season_by_collection__episode_by_year_month_day: + overrides: + episode_number: "{upload_year_truncated}{upload_month_padded}{upload_day_padded}{upload_date_index_padded}" + episode_number_padded: "{episode_number}" + + season_by_collection__episode_by_year_month_day_reversed: + overrides: + episode_number: "{upload_year_truncated_reversed}{upload_month_reversed_padded}{upload_day_reversed_padded}{upload_date_index_reversed_padded}" + episode_number_padded: "{episode_number}" + + season_by_collection__episode_by_playlist_index: + overrides: + episode_number: "{playlist_index}" + episode_number_padded: "{playlist_index_padded6}" + + season_by_collection__episode_by_playlist_index_reversed: + overrides: + episode_number: "{playlist_index_reversed}" + episode_number_padded: "{playlist_index_reversed_padded6}" \ No newline at end of file