[FEATURE] TV Show Collection multi-url, s00 support (#1391)
Closes https://github.com/jmbannon/ytdl-sub/issues/1251, https://github.com/jmbannon/ytdl-sub/issues/1290 Required for https://github.com/jmbannon/ytdl-sub/issues/1383 Adds both s00 support and multi-url support per season, up to 11 URLs currently. This can and should be extended, but with a more principled approach instead of the current method: AI generating boiler-plate YAML 🙂 ``` Plex TV Show Collection: = Music: "~Beyond the Guitar": s00_name: "Specials" s00_url: - "https://www.youtube.com/watch?v=vXzguOdulAI" - "https://www.youtube.com/watch?v=IGwYDvaGAz0" s01_name: "Videos" s01_url: - "https://www.youtube.com/c/BeyondTheGuitar" - "https://www.youtube.com/@BeyondTheGuitarAcademy" s02_name: "Covers" s02_url: "https://www.youtube.com/playlist?list=PLE62gWlWZk5NWVAVuf0Lm9jdv_-_KXs0W" ```
This commit is contained in:
parent
19f47cd914
commit
8d5d2be6a7
3 changed files with 4718 additions and 80 deletions
|
|
@ -160,6 +160,8 @@ Two main use cases of a collection are:
|
|||
2. Organize one or more YouTube channels/playlists, where each season represents a
|
||||
separate channel/playlist.
|
||||
|
||||
Today, ytdl-supports up to 40 seasons with 11 URLs per season.
|
||||
|
||||
Example
|
||||
~~~~~~~
|
||||
|
||||
|
|
@ -185,6 +187,29 @@ Must define ``tv_show_directory``. Available presets:
|
|||
s02_name: "Covers"
|
||||
s02_url: "https://www.youtube.com/playlist?list=PLE62gWlWZk5NWVAVuf0Lm9jdv_-_KXs0W"
|
||||
|
||||
Other notable features include:
|
||||
|
||||
* TV show poster info is pulled from the first URL in s01.
|
||||
* Duplicate videos in different URLs (channel /videos vs playlist) will not download twice.
|
||||
|
||||
* The video will attributed to the season with the highest number.
|
||||
* Individual seasons support both single and multi URL.
|
||||
* s00 is supported for specials.
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
"~Beyond the Guitar":
|
||||
s00_name: "Specials"
|
||||
s00_url:
|
||||
- "https://www.youtube.com/watch?v=vXzguOdulAI"
|
||||
- "https://www.youtube.com/watch?v=IGwYDvaGAz0"
|
||||
s01_name: "Videos"
|
||||
s01_url:
|
||||
- "https://www.youtube.com/c/BeyondTheGuitar"
|
||||
- "https://www.youtube.com/@BeyondTheGuitarAcademy"
|
||||
s02_name: "Covers"
|
||||
s02_url: "https://www.youtube.com/playlist?list=PLE62gWlWZk5NWVAVuf0Lm9jdv_-_KXs0W"
|
||||
|
||||
Advanced Usage
|
||||
~~~~~~~~~~~~~~
|
||||
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -24,3 +24,54 @@ class TestTvShowCollectionPreset:
|
|||
"overrides": {"tv_show_directory": "abc", "url": "test"},
|
||||
},
|
||||
)
|
||||
|
||||
def test_multi_url(self, default_config):
|
||||
num_seasons = 40 # excluding season 0
|
||||
num_urls_per_season = 11
|
||||
|
||||
overrides = {
|
||||
"tv_show_directory": "abc",
|
||||
}
|
||||
for season_num in range(0, num_seasons + 1):
|
||||
overrides[f"s{season_num:02d}_name"] = f"The Season {season_num}"
|
||||
overrides[f"s{season_num:02d}_url"] = [
|
||||
f"youtube.com/playlist?url_{season_num}_{i}" for i in range(num_urls_per_season)
|
||||
]
|
||||
|
||||
sub = Subscription.from_dict(
|
||||
config=default_config,
|
||||
preset_name="test",
|
||||
preset_dict={"preset": "Jellyfin TV Show Collection", "overrides": overrides},
|
||||
)
|
||||
|
||||
assert len(sub.downloader_options.urls.list) == (num_seasons + 1) * num_urls_per_season * 2
|
||||
url_list = sub.downloader_options.urls.list
|
||||
itr = 0
|
||||
|
||||
# loop twice for bilateral
|
||||
for i in range(2):
|
||||
for season_num in range(1, num_seasons + 2):
|
||||
# Season 0 is placed last, adjust here
|
||||
if season_num == num_seasons + 1:
|
||||
season_num = 0
|
||||
|
||||
for i in range(num_urls_per_season):
|
||||
url = sub.overrides.apply_formatter(
|
||||
url_list[itr].url,
|
||||
function_overrides={
|
||||
# mock so bilateral url gets enabled
|
||||
"subscription_has_download_archive": "True"
|
||||
},
|
||||
)
|
||||
variables = url_list[itr].variables.dict
|
||||
assert url == f"youtube.com/playlist?url_{season_num}_{i}"
|
||||
assert (
|
||||
sub.overrides.apply_formatter(variables["collection_season_number"])
|
||||
== f"{season_num}"
|
||||
)
|
||||
assert (
|
||||
sub.overrides.apply_formatter(variables["collection_season_name"])
|
||||
== f"The Season {season_num}"
|
||||
)
|
||||
|
||||
itr += 1
|
||||
|
|
|
|||
Loading…
Reference in a new issue