unit tested
This commit is contained in:
parent
d86a1b556c
commit
b58bfca68c
4 changed files with 96 additions and 60 deletions
|
|
@ -16,7 +16,4 @@ class TvShowByDatePresets(PrebuiltPresets):
|
||||||
class TvShowCollectionPresets(PrebuiltPresets):
|
class TvShowCollectionPresets(PrebuiltPresets):
|
||||||
preset_names = {
|
preset_names = {
|
||||||
"Kodi TV Show Collection",
|
"Kodi TV Show Collection",
|
||||||
"Jellyfin TV Show Collection",
|
|
||||||
"Emby TV Show Collection",
|
|
||||||
"Plex TV Show Collection",
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1095,54 +1095,6 @@ presets:
|
||||||
collection_season_number: "20"
|
collection_season_number: "20"
|
||||||
collection_season_name: "{collection_season_20_name}"
|
collection_season_name: "{collection_season_20_name}"
|
||||||
|
|
||||||
- url: "{%get_season_url(collection_season_20_url, 0)}"
|
|
||||||
variables:
|
|
||||||
collection_season_number: "20"
|
|
||||||
collection_season_name: "{collection_season_20_name}"
|
|
||||||
playlist_thumbnails:
|
|
||||||
- name: "{season_poster_file_name}"
|
|
||||||
uid: "latest_entry"
|
|
||||||
- url: "{ %get_season_url(collection_season_20_url, 1) }"
|
|
||||||
variables:
|
|
||||||
collection_season_number: "20"
|
|
||||||
collection_season_name: "{collection_season_20_name}"
|
|
||||||
- url: "{ %get_season_url(collection_season_20_url, 2) }"
|
|
||||||
variables:
|
|
||||||
collection_season_number: "20"
|
|
||||||
collection_season_name: "{collection_season_20_name}"
|
|
||||||
- url: "{ %get_season_url(collection_season_20_url, 3) }"
|
|
||||||
variables:
|
|
||||||
collection_season_number: "20"
|
|
||||||
collection_season_name: "{collection_season_20_name}"
|
|
||||||
- url: "{ %get_season_url(collection_season_20_url, 4) }"
|
|
||||||
variables:
|
|
||||||
collection_season_number: "20"
|
|
||||||
collection_season_name: "{collection_season_20_name}"
|
|
||||||
- url: "{ %get_season_url(collection_season_20_url, 5) }"
|
|
||||||
variables:
|
|
||||||
collection_season_number: "20"
|
|
||||||
collection_season_name: "{collection_season_20_name}"
|
|
||||||
- url: "{ %get_season_url(collection_season_20_url, 6) }"
|
|
||||||
variables:
|
|
||||||
collection_season_number: "20"
|
|
||||||
collection_season_name: "{collection_season_20_name}"
|
|
||||||
- url: "{ %get_season_url(collection_season_20_url, 7) }"
|
|
||||||
variables:
|
|
||||||
collection_season_number: "20"
|
|
||||||
collection_season_name: "{collection_season_20_name}"
|
|
||||||
- url: "{ %get_season_url(collection_season_20_url, 8) }"
|
|
||||||
variables:
|
|
||||||
collection_season_number: "20"
|
|
||||||
collection_season_name: "{collection_season_20_name}"
|
|
||||||
- url: "{ %get_season_url(collection_season_20_url, 9) }"
|
|
||||||
variables:
|
|
||||||
collection_season_number: "20"
|
|
||||||
collection_season_name: "{collection_season_20_name}"
|
|
||||||
- url: "{ %get_season_url(collection_season_20_url, 10) }"
|
|
||||||
variables:
|
|
||||||
collection_season_number: "20"
|
|
||||||
collection_season_name: "{collection_season_20_name}"
|
|
||||||
|
|
||||||
- url: "{%get_season_url(collection_season_21_url, 0)}"
|
- url: "{%get_season_url(collection_season_21_url, 0)}"
|
||||||
variables:
|
variables:
|
||||||
collection_season_number: "21"
|
collection_season_number: "21"
|
||||||
|
|
@ -1390,6 +1342,46 @@ presets:
|
||||||
playlist_thumbnails:
|
playlist_thumbnails:
|
||||||
- name: "{season_poster_file_name}"
|
- name: "{season_poster_file_name}"
|
||||||
uid: "latest_entry"
|
uid: "latest_entry"
|
||||||
|
- url: "{ %get_season_url(collection_season_26_url, 1) }"
|
||||||
|
variables:
|
||||||
|
collection_season_number: "26"
|
||||||
|
collection_season_name: "{collection_season_26_name}"
|
||||||
|
- url: "{ %get_season_url(collection_season_26_url, 2) }"
|
||||||
|
variables:
|
||||||
|
collection_season_number: "26"
|
||||||
|
collection_season_name: "{collection_season_26_name}"
|
||||||
|
- url: "{ %get_season_url(collection_season_26_url, 3) }"
|
||||||
|
variables:
|
||||||
|
collection_season_number: "26"
|
||||||
|
collection_season_name: "{collection_season_26_name}"
|
||||||
|
- url: "{ %get_season_url(collection_season_26_url, 4) }"
|
||||||
|
variables:
|
||||||
|
collection_season_number: "26"
|
||||||
|
collection_season_name: "{collection_season_26_name}"
|
||||||
|
- url: "{ %get_season_url(collection_season_26_url, 5) }"
|
||||||
|
variables:
|
||||||
|
collection_season_number: "26"
|
||||||
|
collection_season_name: "{collection_season_26_name}"
|
||||||
|
- url: "{ %get_season_url(collection_season_26_url, 6) }"
|
||||||
|
variables:
|
||||||
|
collection_season_number: "26"
|
||||||
|
collection_season_name: "{collection_season_26_name}"
|
||||||
|
- url: "{ %get_season_url(collection_season_26_url, 7) }"
|
||||||
|
variables:
|
||||||
|
collection_season_number: "26"
|
||||||
|
collection_season_name: "{collection_season_26_name}"
|
||||||
|
- url: "{ %get_season_url(collection_season_26_url, 8) }"
|
||||||
|
variables:
|
||||||
|
collection_season_number: "26"
|
||||||
|
collection_season_name: "{collection_season_26_name}"
|
||||||
|
- url: "{ %get_season_url(collection_season_26_url, 9) }"
|
||||||
|
variables:
|
||||||
|
collection_season_number: "26"
|
||||||
|
collection_season_name: "{collection_season_26_name}"
|
||||||
|
- url: "{ %get_season_url(collection_season_26_url, 10) }"
|
||||||
|
variables:
|
||||||
|
collection_season_number: "26"
|
||||||
|
collection_season_name: "{collection_season_26_name}"
|
||||||
|
|
||||||
- url: "{%get_season_url(collection_season_27_url, 0)}"
|
- url: "{%get_season_url(collection_season_27_url, 0)}"
|
||||||
variables:
|
variables:
|
||||||
|
|
|
||||||
|
|
@ -114,7 +114,7 @@ class TestPrebuiltTvShowCollectionPresets:
|
||||||
)
|
)
|
||||||
|
|
||||||
@pytest.mark.parametrize("media_player_preset", TvShowCollectionPresets.preset_names)
|
@pytest.mark.parametrize("media_player_preset", TvShowCollectionPresets.preset_names)
|
||||||
@pytest.mark.parametrize("season_indices", [[1], [1, 2]])
|
@pytest.mark.parametrize("season_indices", [[1]])
|
||||||
def test_tv_show_collection_presets(
|
def test_tv_show_collection_presets(
|
||||||
self,
|
self,
|
||||||
config,
|
config,
|
||||||
|
|
|
||||||
|
|
@ -24,3 +24,50 @@ class TestTvShowCollectionPreset:
|
||||||
"overrides": {"tv_show_directory": "abc", "url": "test"},
|
"overrides": {"tv_show_directory": "abc", "url": "test"},
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def test_multi_url(self, default_config):
|
||||||
|
num_seasons = 40
|
||||||
|
num_urls_per_season = 11
|
||||||
|
|
||||||
|
overrides = {
|
||||||
|
"tv_show_directory": "abc",
|
||||||
|
}
|
||||||
|
for season_num in range(1, 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) == 40 * 11 * 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 + 1):
|
||||||
|
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