[REFACTOR] Support simple download (#671)

* [REFACTOR] Support simple `download`

* fix test

* asdfas
This commit is contained in:
Jesse Bannon 2023-07-26 09:00:00 -07:00 committed by GitHub
parent 598b1da8a4
commit a9e6a80111
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
20 changed files with 385 additions and 423 deletions

View file

@ -13,6 +13,5 @@
#
rammstein_music_videos:
preset: "video"
download:
url: "https://youtube.com/playlist?list=PLVTLbc6i-h_iuhdwUfuPDLFLXG2QQnz-x"
download: "https://youtube.com/playlist?list=PLVTLbc6i-h_iuhdwUfuPDLFLXG2QQnz-x"

View file

@ -165,26 +165,25 @@ presets:
# Download using the multi_url strategy
download:
urls:
# The first URL will be all the artist's tracks.
# Treat these as singles - an album with a single track
- url: "{sc_artist_url}/tracks"
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: "{sc_artist_url}/albums"
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}"
# The first URL will be all the artist's tracks.
# Treat these as singles - an album with a single track
- url: "{sc_artist_url}/tracks"
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: "{sc_artist_url}/albums"
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:

View file

@ -18,11 +18,10 @@ configuration:
presets:
music_video:
# Set the download details
# We will only use a single URL to download music video(s).
# Make {url} an override variable to set later.
download:
# We will only use a single URL to download music video(s).
# Make {url} an override variable to set later.
url: "{url}"
- "{url}"
# For advanced YTDL users only; any YTDL parameter can be set here.
# To download age-restricted videos, you will need to set your cookie

View file

@ -146,8 +146,27 @@ class UrlValidator(StrictDictValidator):
return self._download_reverse.value
class UrlListValidator(ListValidator[UrlValidator]):
_inner_list_type = UrlValidator
class UrlStringOrDictValidator(UrlValidator):
"""
URL validator that supports a single string like:
download:
- "https://"
or
download:
- url: "https://"
"""
_expected_value_type = (dict, str)
def __init__(self, name, value):
super().__init__(name, {"url": value} if isinstance(value, str) else value)
class UrlListValidator(ListValidator[UrlStringOrDictValidator]):
_inner_list_type = UrlStringOrDictValidator
_expected_value_type_name = "collection url list"
def __init__(self, name, value):
@ -197,17 +216,11 @@ class MultiUrlValidator(OptionsValidator):
# Pop old required field in case it's still there
value_copy.pop("download_strategy", None)
if "urls" in value_copy:
self._urls = UrlListValidator(name=name, value=value_copy["urls"])
else:
# Validate using a single URL validator first
_ = UrlValidator(name=name, value=value_copy)
self._urls = UrlListValidator(name=name, value=[value_copy])
# Deal with old multi-url download strategy
if isinstance(value, dict) and "urls" in value_copy:
self._urls = UrlListValidator(name=name, value=value_copy["urls"])
else:
# Should error here. TODO: Add simplifications download here (string, list)
self._urls = UrlListValidator(
name=name, value=UrlValidator(name=name, value=value_copy)
)
self._urls = UrlListValidator(name=name, value=value_copy)
@property
def urls(self) -> UrlListValidator:

View file

@ -1,8 +1,7 @@
presets:
_view:
download:
url: "{url}"
download: "{url}"
output_options:
output_directory: "/tmp/ytdl-sub-view"
file_name: "{uid}.{ext}"

View file

@ -2,7 +2,7 @@ presets:
# TODO: Update this
kodi_music_video:
download:
url: "{music_video_url}"
- "{music_video_url}"
output_options:
output_directory: "{music_video_directory}"

View file

@ -34,32 +34,31 @@ presets:
# TV show from one or more sources. Uses {url}'s avatar and banner as poster and fanart
_tv_show_by_date:
download:
urls:
- url: "{url}"
playlist_thumbnails:
- name: "{tv_show_poster_file_name}"
uid: "avatar_uncropped"
- name: "{tv_show_fanart_file_name}"
uid: "banner_uncropped"
- url: "{url2}"
- url: "{url3}"
- url: "{url4}"
- url: "{url5}"
- url: "{url6}"
- url: "{url7}"
- url: "{url8}"
- url: "{url9}"
- url: "{url10}"
- url: "{url11}"
- url: "{url12}"
- url: "{url13}"
- url: "{url14}"
- url: "{url15}"
- url: "{url16}"
- url: "{url17}"
- url: "{url18}"
- url: "{url19}"
- url: "{url20}"
- url: "{url}"
playlist_thumbnails:
- name: "{tv_show_poster_file_name}"
uid: "avatar_uncropped"
- name: "{tv_show_fanart_file_name}"
uid: "banner_uncropped"
- url: "{url2}"
- url: "{url3}"
- url: "{url4}"
- url: "{url5}"
- url: "{url6}"
- url: "{url7}"
- url: "{url8}"
- url: "{url9}"
- url: "{url10}"
- url: "{url11}"
- url: "{url12}"
- url: "{url13}"
- url: "{url14}"
- url: "{url15}"
- url: "{url16}"
- url: "{url17}"
- url: "{url18}"
- url: "{url19}"
- url: "{url20}"
overrides:
url2: ""
url3: ""

View file

@ -21,20 +21,19 @@ presets:
collection_season_1:
download:
urls:
- url: "{collection_season_1_url}"
variables:
collection_season_number: "1"
collection_season_number_padded: "01"
playlist_thumbnails:
# Use latest_entry first, then see if YT channel artwork exists
# ONLY FOR SEASON 1! The channel artwork will be the show's artwork.
- name: "{season_poster_file_name}"
uid: "latest_entry"
- name: "{tv_show_poster_file_name}"
uid: "avatar_uncropped"
- name: "{tv_show_fanart_file_name}"
uid: "banner_uncropped"
- url: "{collection_season_1_url}"
variables:
collection_season_number: "1"
collection_season_number_padded: "01"
playlist_thumbnails:
# Use latest_entry first, then see if YT channel artwork exists
# ONLY FOR SEASON 1! The channel artwork will be the show's artwork.
- name: "{season_poster_file_name}"
uid: "latest_entry"
- name: "{tv_show_poster_file_name}"
uid: "avatar_uncropped"
- name: "{tv_show_fanart_file_name}"
uid: "banner_uncropped"
output_directory_nfo_tags:
tags:
@ -45,14 +44,13 @@ presets:
collection_season_2:
download:
urls:
- url: "{collection_season_2_url}"
variables:
collection_season_number: "2"
collection_season_number_padded: "02"
playlist_thumbnails:
- name: "{season_poster_file_name}"
uid: "latest_entry"
- url: "{collection_season_2_url}"
variables:
collection_season_number: "2"
collection_season_number_padded: "02"
playlist_thumbnails:
- name: "{season_poster_file_name}"
uid: "latest_entry"
output_directory_nfo_tags:
tags:
@ -63,14 +61,13 @@ presets:
collection_season_3:
download:
urls:
- url: "{collection_season_3_url}"
variables:
collection_season_number: "3"
collection_season_number_padded: "03"
playlist_thumbnails:
- name: "{season_poster_file_name}"
uid: "latest_entry"
- url: "{collection_season_3_url}"
variables:
collection_season_number: "3"
collection_season_number_padded: "03"
playlist_thumbnails:
- name: "{season_poster_file_name}"
uid: "latest_entry"
output_directory_nfo_tags:
tags:
@ -81,14 +78,13 @@ presets:
collection_season_4:
download:
urls:
- url: "{collection_season_4_url}"
variables:
collection_season_number: "4"
collection_season_number_padded: "04"
playlist_thumbnails:
- name: "{season_poster_file_name}"
uid: "latest_entry"
- url: "{collection_season_4_url}"
variables:
collection_season_number: "4"
collection_season_number_padded: "04"
playlist_thumbnails:
- name: "{season_poster_file_name}"
uid: "latest_entry"
output_directory_nfo_tags:
tags:
@ -99,14 +95,13 @@ presets:
collection_season_5:
download:
urls:
- url: "{collection_season_5_url}"
variables:
collection_season_number: "5"
collection_season_number_padded: "05"
playlist_thumbnails:
- name: "{season_poster_file_name}"
uid: "latest_entry"
- url: "{collection_season_5_url}"
variables:
collection_season_number: "5"
collection_season_number_padded: "05"
playlist_thumbnails:
- name: "{season_poster_file_name}"
uid: "latest_entry"
output_directory_nfo_tags:
tags:
@ -117,14 +112,13 @@ presets:
collection_season_6:
download:
urls:
- url: "{collection_season_6_url}"
variables:
collection_season_number: "6"
collection_season_number_padded: "06"
playlist_thumbnails:
- name: "{season_poster_file_name}"
uid: "latest_entry"
- url: "{collection_season_6_url}"
variables:
collection_season_number: "6"
collection_season_number_padded: "06"
playlist_thumbnails:
- name: "{season_poster_file_name}"
uid: "latest_entry"
output_directory_nfo_tags:
tags:
@ -135,14 +129,13 @@ presets:
collection_season_7:
download:
urls:
- url: "{collection_season_7_url}"
variables:
collection_season_number: "7"
collection_season_number_padded: "07"
playlist_thumbnails:
- name: "{season_poster_file_name}"
uid: "latest_entry"
- url: "{collection_season_7_url}"
variables:
collection_season_number: "7"
collection_season_number_padded: "07"
playlist_thumbnails:
- name: "{season_poster_file_name}"
uid: "latest_entry"
output_directory_nfo_tags:
tags:
@ -153,14 +146,13 @@ presets:
collection_season_8:
download:
urls:
- url: "{collection_season_8_url}"
variables:
collection_season_number: "8"
collection_season_number_padded: "08"
playlist_thumbnails:
- name: "{season_poster_file_name}"
uid: "latest_entry"
- url: "{collection_season_8_url}"
variables:
collection_season_number: "8"
collection_season_number_padded: "08"
playlist_thumbnails:
- name: "{season_poster_file_name}"
uid: "latest_entry"
output_directory_nfo_tags:
tags:
@ -171,14 +163,13 @@ presets:
collection_season_9:
download:
urls:
- url: "{collection_season_9_url}"
variables:
collection_season_number: "9"
collection_season_number_padded: "09"
playlist_thumbnails:
- name: "{season_poster_file_name}"
uid: "latest_entry"
- url: "{collection_season_9_url}"
variables:
collection_season_number: "9"
collection_season_number_padded: "09"
playlist_thumbnails:
- name: "{season_poster_file_name}"
uid: "latest_entry"
output_directory_nfo_tags:
tags:
@ -189,14 +180,13 @@ presets:
collection_season_10:
download:
urls:
- url: "{collection_season_10_url}"
variables:
collection_season_number: "10"
collection_season_number_padded: "10"
playlist_thumbnails:
- name: "{season_poster_file_name}"
uid: "latest_entry"
- url: "{collection_season_10_url}"
variables:
collection_season_number: "10"
collection_season_number_padded: "10"
playlist_thumbnails:
- name: "{season_poster_file_name}"
uid: "latest_entry"
output_directory_nfo_tags:
tags:
@ -207,14 +197,13 @@ presets:
collection_season_11:
download:
urls:
- url: "{collection_season_11_url}"
variables:
collection_season_number: "11"
collection_season_number_padded: "11"
playlist_thumbnails:
- name: "{season_poster_file_name}"
uid: "latest_entry"
- url: "{collection_season_11_url}"
variables:
collection_season_number: "11"
collection_season_number_padded: "11"
playlist_thumbnails:
- name: "{season_poster_file_name}"
uid: "latest_entry"
output_directory_nfo_tags:
tags:
@ -225,14 +214,13 @@ presets:
collection_season_12:
download:
urls:
- url: "{collection_season_12_url}"
variables:
collection_season_number: "12"
collection_season_number_padded: "12"
playlist_thumbnails:
- name: "{season_poster_file_name}"
uid: "latest_entry"
- url: "{collection_season_12_url}"
variables:
collection_season_number: "12"
collection_season_number_padded: "12"
playlist_thumbnails:
- name: "{season_poster_file_name}"
uid: "latest_entry"
output_directory_nfo_tags:
tags:
@ -243,14 +231,13 @@ presets:
collection_season_13:
download:
urls:
- url: "{collection_season_13_url}"
variables:
collection_season_number: "13"
collection_season_number_padded: "13"
playlist_thumbnails:
- name: "{season_poster_file_name}"
uid: "latest_entry"
- url: "{collection_season_13_url}"
variables:
collection_season_number: "13"
collection_season_number_padded: "13"
playlist_thumbnails:
- name: "{season_poster_file_name}"
uid: "latest_entry"
output_directory_nfo_tags:
tags:
@ -261,14 +248,13 @@ presets:
collection_season_14:
download:
urls:
- url: "{collection_season_14_url}"
variables:
collection_season_number: "14"
collection_season_number_padded: "14"
playlist_thumbnails:
- name: "{season_poster_file_name}"
uid: "latest_entry"
- url: "{collection_season_14_url}"
variables:
collection_season_number: "14"
collection_season_number_padded: "14"
playlist_thumbnails:
- name: "{season_poster_file_name}"
uid: "latest_entry"
output_directory_nfo_tags:
tags:
@ -279,14 +265,13 @@ presets:
collection_season_15:
download:
urls:
- url: "{collection_season_15_url}"
variables:
collection_season_number: "15"
collection_season_number_padded: "15"
playlist_thumbnails:
- name: "{season_poster_file_name}"
uid: "latest_entry"
- url: "{collection_season_15_url}"
variables:
collection_season_number: "15"
collection_season_number_padded: "15"
playlist_thumbnails:
- name: "{season_poster_file_name}"
uid: "latest_entry"
output_directory_nfo_tags:
tags:
@ -297,14 +282,13 @@ presets:
collection_season_16:
download:
urls:
- url: "{collection_season_16_url}"
variables:
collection_season_number: "16"
collection_season_number_padded: "16"
playlist_thumbnails:
- name: "{season_poster_file_name}"
uid: "latest_entry"
- url: "{collection_season_16_url}"
variables:
collection_season_number: "16"
collection_season_number_padded: "16"
playlist_thumbnails:
- name: "{season_poster_file_name}"
uid: "latest_entry"
output_directory_nfo_tags:
tags:
@ -315,14 +299,13 @@ presets:
collection_season_17:
download:
urls:
- url: "{collection_season_17_url}"
variables:
collection_season_number: "17"
collection_season_number_padded: "17"
playlist_thumbnails:
- name: "{season_poster_file_name}"
uid: "latest_entry"
- url: "{collection_season_17_url}"
variables:
collection_season_number: "17"
collection_season_number_padded: "17"
playlist_thumbnails:
- name: "{season_poster_file_name}"
uid: "latest_entry"
output_directory_nfo_tags:
tags:
@ -333,14 +316,13 @@ presets:
collection_season_18:
download:
urls:
- url: "{collection_season_18_url}"
variables:
collection_season_number: "18"
collection_season_number_padded: "18"
playlist_thumbnails:
- name: "{season_poster_file_name}"
uid: "latest_entry"
- url: "{collection_season_18_url}"
variables:
collection_season_number: "18"
collection_season_number_padded: "18"
playlist_thumbnails:
- name: "{season_poster_file_name}"
uid: "latest_entry"
output_directory_nfo_tags:
tags:
@ -351,14 +333,13 @@ presets:
collection_season_19:
download:
urls:
- url: "{collection_season_19_url}"
variables:
collection_season_number: "19"
collection_season_number_padded: "19"
playlist_thumbnails:
- name: "{season_poster_file_name}"
uid: "latest_entry"
- url: "{collection_season_19_url}"
variables:
collection_season_number: "19"
collection_season_number_padded: "19"
playlist_thumbnails:
- name: "{season_poster_file_name}"
uid: "latest_entry"
output_directory_nfo_tags:
tags:
@ -369,14 +350,13 @@ presets:
collection_season_20:
download:
urls:
- url: "{collection_season_20_url}"
variables:
collection_season_number: "20"
collection_season_number_padded: "20"
playlist_thumbnails:
- name: "{season_poster_file_name}"
uid: "latest_entry"
- url: "{collection_season_20_url}"
variables:
collection_season_number: "20"
collection_season_number_padded: "20"
playlist_thumbnails:
- name: "{season_poster_file_name}"
uid: "latest_entry"
output_directory_nfo_tags:
tags:
@ -387,14 +367,13 @@ presets:
collection_season_21:
download:
urls:
- url: "{collection_season_21_url}"
variables:
collection_season_number: "21"
collection_season_number_padded: "21"
playlist_thumbnails:
- name: "{season_poster_file_name}"
uid: "latest_entry"
- url: "{collection_season_21_url}"
variables:
collection_season_number: "21"
collection_season_number_padded: "21"
playlist_thumbnails:
- name: "{season_poster_file_name}"
uid: "latest_entry"
output_directory_nfo_tags:
tags:
@ -405,14 +384,13 @@ presets:
collection_season_22:
download:
urls:
- url: "{collection_season_22_url}"
variables:
collection_season_number: "22"
collection_season_number_padded: "22"
playlist_thumbnails:
- name: "{season_poster_file_name}"
uid: "latest_entry"
- url: "{collection_season_22_url}"
variables:
collection_season_number: "22"
collection_season_number_padded: "22"
playlist_thumbnails:
- name: "{season_poster_file_name}"
uid: "latest_entry"
output_directory_nfo_tags:
tags:
@ -423,14 +401,13 @@ presets:
collection_season_23:
download:
urls:
- url: "{collection_season_23_url}"
variables:
collection_season_number: "23"
collection_season_number_padded: "23"
playlist_thumbnails:
- name: "{season_poster_file_name}"
uid: "latest_entry"
- url: "{collection_season_23_url}"
variables:
collection_season_number: "23"
collection_season_number_padded: "23"
playlist_thumbnails:
- name: "{season_poster_file_name}"
uid: "latest_entry"
output_directory_nfo_tags:
tags:
@ -441,14 +418,13 @@ presets:
collection_season_24:
download:
urls:
- url: "{collection_season_24_url}"
variables:
collection_season_number: "24"
collection_season_number_padded: "24"
playlist_thumbnails:
- name: "{season_poster_file_name}"
uid: "latest_entry"
- url: "{collection_season_24_url}"
variables:
collection_season_number: "24"
collection_season_number_padded: "24"
playlist_thumbnails:
- name: "{season_poster_file_name}"
uid: "latest_entry"
output_directory_nfo_tags:
tags:
@ -459,14 +435,13 @@ presets:
collection_season_25:
download:
urls:
- url: "{collection_season_25_url}"
variables:
collection_season_number: "25"
collection_season_number_padded: "25"
playlist_thumbnails:
- name: "{season_poster_file_name}"
uid: "latest_entry"
- url: "{collection_season_25_url}"
variables:
collection_season_number: "25"
collection_season_number_padded: "25"
playlist_thumbnails:
- name: "{season_poster_file_name}"
uid: "latest_entry"
output_directory_nfo_tags:
tags:
@ -477,14 +452,13 @@ presets:
collection_season_26:
download:
urls:
- url: "{collection_season_26_url}"
variables:
collection_season_number: "26"
collection_season_number_padded: "26"
playlist_thumbnails:
- name: "{season_poster_file_name}"
uid: "latest_entry"
- url: "{collection_season_26_url}"
variables:
collection_season_number: "26"
collection_season_number_padded: "26"
playlist_thumbnails:
- name: "{season_poster_file_name}"
uid: "latest_entry"
output_directory_nfo_tags:
tags:
@ -495,14 +469,13 @@ presets:
collection_season_27:
download:
urls:
- url: "{collection_season_27_url}"
variables:
collection_season_number: "27"
collection_season_number_padded: "27"
playlist_thumbnails:
- name: "{season_poster_file_name}"
uid: "latest_entry"
- url: "{collection_season_27_url}"
variables:
collection_season_number: "27"
collection_season_number_padded: "27"
playlist_thumbnails:
- name: "{season_poster_file_name}"
uid: "latest_entry"
output_directory_nfo_tags:
tags:
@ -513,14 +486,13 @@ presets:
collection_season_28:
download:
urls:
- url: "{collection_season_28_url}"
variables:
collection_season_number: "28"
collection_season_number_padded: "28"
playlist_thumbnails:
- name: "{season_poster_file_name}"
uid: "latest_entry"
- url: "{collection_season_28_url}"
variables:
collection_season_number: "28"
collection_season_number_padded: "28"
playlist_thumbnails:
- name: "{season_poster_file_name}"
uid: "latest_entry"
output_directory_nfo_tags:
tags:
@ -531,14 +503,13 @@ presets:
collection_season_29:
download:
urls:
- url: "{collection_season_29_url}"
variables:
collection_season_number: "29"
collection_season_number_padded: "29"
playlist_thumbnails:
- name: "{season_poster_file_name}"
uid: "latest_entry"
- url: "{collection_season_29_url}"
variables:
collection_season_number: "29"
collection_season_number_padded: "29"
playlist_thumbnails:
- name: "{season_poster_file_name}"
uid: "latest_entry"
output_directory_nfo_tags:
tags:
@ -549,14 +520,13 @@ presets:
collection_season_30:
download:
urls:
- url: "{collection_season_30_url}"
variables:
collection_season_number: "30"
collection_season_number_padded: "30"
playlist_thumbnails:
- name: "{season_poster_file_name}"
uid: "latest_entry"
- url: "{collection_season_30_url}"
variables:
collection_season_number: "30"
collection_season_number_padded: "30"
playlist_thumbnails:
- name: "{season_poster_file_name}"
uid: "latest_entry"
output_directory_nfo_tags:
tags:
@ -567,14 +537,13 @@ presets:
collection_season_31:
download:
urls:
- url: "{collection_season_31_url}"
variables:
collection_season_number: "31"
collection_season_number_padded: "31"
playlist_thumbnails:
- name: "{season_poster_file_name}"
uid: "latest_entry"
- url: "{collection_season_31_url}"
variables:
collection_season_number: "31"
collection_season_number_padded: "31"
playlist_thumbnails:
- name: "{season_poster_file_name}"
uid: "latest_entry"
output_directory_nfo_tags:
tags:
@ -585,14 +554,13 @@ presets:
collection_season_32:
download:
urls:
- url: "{collection_season_32_url}"
variables:
collection_season_number: "32"
collection_season_number_padded: "32"
playlist_thumbnails:
- name: "{season_poster_file_name}"
uid: "latest_entry"
- url: "{collection_season_32_url}"
variables:
collection_season_number: "32"
collection_season_number_padded: "32"
playlist_thumbnails:
- name: "{season_poster_file_name}"
uid: "latest_entry"
output_directory_nfo_tags:
tags:
@ -603,14 +571,13 @@ presets:
collection_season_33:
download:
urls:
- url: "{collection_season_33_url}"
variables:
collection_season_number: "33"
collection_season_number_padded: "33"
playlist_thumbnails:
- name: "{season_poster_file_name}"
uid: "latest_entry"
- url: "{collection_season_33_url}"
variables:
collection_season_number: "33"
collection_season_number_padded: "33"
playlist_thumbnails:
- name: "{season_poster_file_name}"
uid: "latest_entry"
output_directory_nfo_tags:
tags:
@ -621,14 +588,13 @@ presets:
collection_season_34:
download:
urls:
- url: "{collection_season_34_url}"
variables:
collection_season_number: "34"
collection_season_number_padded: "34"
playlist_thumbnails:
- name: "{season_poster_file_name}"
uid: "latest_entry"
- url: "{collection_season_34_url}"
variables:
collection_season_number: "34"
collection_season_number_padded: "34"
playlist_thumbnails:
- name: "{season_poster_file_name}"
uid: "latest_entry"
output_directory_nfo_tags:
tags:
@ -639,14 +605,13 @@ presets:
collection_season_35:
download:
urls:
- url: "{collection_season_35_url}"
variables:
collection_season_number: "35"
collection_season_number_padded: "35"
playlist_thumbnails:
- name: "{season_poster_file_name}"
uid: "latest_entry"
- url: "{collection_season_35_url}"
variables:
collection_season_number: "35"
collection_season_number_padded: "35"
playlist_thumbnails:
- name: "{season_poster_file_name}"
uid: "latest_entry"
output_directory_nfo_tags:
tags:
@ -657,14 +622,13 @@ presets:
collection_season_36:
download:
urls:
- url: "{collection_season_36_url}"
variables:
collection_season_number: "36"
collection_season_number_padded: "36"
playlist_thumbnails:
- name: "{season_poster_file_name}"
uid: "latest_entry"
- url: "{collection_season_36_url}"
variables:
collection_season_number: "36"
collection_season_number_padded: "36"
playlist_thumbnails:
- name: "{season_poster_file_name}"
uid: "latest_entry"
output_directory_nfo_tags:
tags:
@ -675,14 +639,13 @@ presets:
collection_season_37:
download:
urls:
- url: "{collection_season_37_url}"
variables:
collection_season_number: "37"
collection_season_number_padded: "37"
playlist_thumbnails:
- name: "{season_poster_file_name}"
uid: "latest_entry"
- url: "{collection_season_37_url}"
variables:
collection_season_number: "37"
collection_season_number_padded: "37"
playlist_thumbnails:
- name: "{season_poster_file_name}"
uid: "latest_entry"
output_directory_nfo_tags:
tags:
@ -693,14 +656,13 @@ presets:
collection_season_38:
download:
urls:
- url: "{collection_season_38_url}"
variables:
collection_season_number: "38"
collection_season_number_padded: "38"
playlist_thumbnails:
- name: "{season_poster_file_name}"
uid: "latest_entry"
- url: "{collection_season_38_url}"
variables:
collection_season_number: "38"
collection_season_number_padded: "38"
playlist_thumbnails:
- name: "{season_poster_file_name}"
uid: "latest_entry"
output_directory_nfo_tags:
tags:
@ -711,14 +673,13 @@ presets:
collection_season_39:
download:
urls:
- url: "{collection_season_39_url}"
variables:
collection_season_number: "39"
collection_season_number_padded: "39"
playlist_thumbnails:
- name: "{season_poster_file_name}"
uid: "latest_entry"
- url: "{collection_season_39_url}"
variables:
collection_season_number: "39"
collection_season_number_padded: "39"
playlist_thumbnails:
- name: "{season_poster_file_name}"
uid: "latest_entry"
output_directory_nfo_tags:
tags:
@ -729,14 +690,13 @@ presets:
collection_season_40:
download:
urls:
- url: "{collection_season_40_url}"
variables:
collection_season_number: "40"
collection_season_number_padded: "40"
playlist_thumbnails:
- name: "{season_poster_file_name}"
uid: "latest_entry"
- url: "{collection_season_40_url}"
variables:
collection_season_number: "40"
collection_season_number_padded: "40"
playlist_thumbnails:
- name: "{season_poster_file_name}"
uid: "latest_entry"
output_directory_nfo_tags:
tags:

View file

@ -11,7 +11,7 @@ from ytdl_sub.subscriptions.subscription import Subscription
def sponsorblock_and_subs_preset_dict(output_directory) -> Dict:
return {
"preset": "music_video",
"download": {"url": "https://www.youtube.com/watch?v=-wJOUAuKZm8"},
"download": "https://www.youtube.com/watch?v=-wJOUAuKZm8",
# override the output directory with our fixture-generated dir
"output_options": {"output_directory": output_directory},
"subtitles": {
@ -46,9 +46,7 @@ def sponsorblock_and_subs_preset_dict(output_directory) -> Dict:
@pytest.fixture
def chapters_from_comments_preset_dict(sponsorblock_and_subs_preset_dict: Dict) -> Dict:
sponsorblock_and_subs_preset_dict["download"][
"url"
] = "https://www.youtube.com/watch?v=MO5AWAqe01Y"
sponsorblock_and_subs_preset_dict["download"] = "https://www.youtube.com/watch?v=MO5AWAqe01Y"
sponsorblock_and_subs_preset_dict["chapters"] = {
"embed_chapters": True,
"allow_chapters_from_comments": True,

View file

@ -10,7 +10,7 @@ from ytdl_sub.subscriptions.subscription import Subscription
def preset_dict(output_directory):
return {
"preset": "music_video",
"download": {"url": "https://www.youtube.com/watch?v=2zYF9JLHDmA"},
"download": "https://www.youtube.com/watch?v=2zYF9JLHDmA",
"output_options": {"output_directory": output_directory},
# download the worst format so it is fast
"ytdl_options": {

View file

@ -9,7 +9,7 @@ from ytdl_sub.subscriptions.subscription import Subscription
def preset_dict(output_directory):
return {
"preset": "music_video",
"download": {"url": "https://www.youtube.com/watch?v=2zYF9JLHDmA"},
"download": "https://www.youtube.com/watch?v=2zYF9JLHDmA",
"output_options": {"output_directory": output_directory},
# download the worst format so it is fast
"ytdl_options": {
@ -23,7 +23,7 @@ def preset_dict(output_directory):
def playlist_preset_dict(output_directory):
return {
"preset": "music_video",
"download": {"url": "https://www.youtube.com/playlist?list=PL5BC0FC26BECA5A35"},
"download": "https://www.youtube.com/playlist?list=PL5BC0FC26BECA5A35",
"output_options": {"output_directory": output_directory},
# download the worst format so it is fast
"ytdl_options": {

View file

@ -9,9 +9,7 @@ from ytdl_sub.utils.exceptions import ValidationException
@pytest.fixture
def single_song_video_dict(output_directory):
return {
"download": {
"url": "https://www.youtube.com/watch?v=2lAe1cqCOXo",
},
"download": "https://www.youtube.com/watch?v=2lAe1cqCOXo",
"output_options": {"output_directory": output_directory, "file_name": "will_error.mp4"},
# test multi-tags
"music_tags": {"genres": ["multi_tag_1", "multi_tag_2"]},

View file

@ -8,7 +8,7 @@ from ytdl_sub.subscriptions.subscription import Subscription
def subscription_dict(output_directory):
return {
"preset": "music_video",
"download": {"url": "https://www.youtube.com/shorts/ucYmEqmlhFw"},
"download": "https://www.youtube.com/shorts/ucYmEqmlhFw",
# override the output directory with our fixture-generated dir
"output_options": {"output_directory": output_directory},
# download the worst format so it is fast

View file

@ -17,7 +17,7 @@ from ytdl_sub.utils.exceptions import ValidationException
def regex_subscription_dict_base(output_directory):
return {
"preset": "music_video",
"download": {"url": "https://youtube.com/playlist?list=PL5BC0FC26BECA5A35"},
"download": "https://youtube.com/playlist?list=PL5BC0FC26BECA5A35",
# override the output directory with our fixture-generated dir
"output_options": {"output_directory": output_directory},
# download the worst format so it is fast

View file

@ -136,7 +136,7 @@ class TestSplitByChapters:
mergedeep.merge(
yt_album_as_chapters_with_regex_preset_dict,
{
"download": {"url": "https://youtube.com/watch?v=HKTNxEqsN3Q"},
"download": "https://youtube.com/watch?v=HKTNxEqsN3Q",
"split_by_chapters": {"when_no_chapters": when_no_chapters},
},
)

View file

@ -10,7 +10,7 @@ from ytdl_sub.subscriptions.subscription import Subscription
def single_video_subs_embed_preset_dict(output_directory):
return {
"preset": "music_video",
"download": {"url": "https://www.youtube.com/watch?v=2lAe1cqCOXo"},
"download": "https://www.youtube.com/watch?v=2lAe1cqCOXo",
# override the output directory with our fixture-generated dir
"output_options": {"output_directory": output_directory},
"subtitles": {

View file

@ -11,7 +11,7 @@ from ytdl_sub.subscriptions.subscription import Subscription
def single_video_preset_dict_old_video_tags_format(output_directory):
return {
"preset": "music_video",
"download": {"url": "https://youtube.com/watch?v=HKTNxEqsN3Q"},
"download": "https://youtube.com/watch?v=HKTNxEqsN3Q",
# override the output directory with our fixture-generated dir
"output_options": {
"output_directory": output_directory,
@ -37,7 +37,7 @@ def single_video_preset_dict_old_video_tags_format(output_directory):
def single_video_preset_dict(output_directory):
return {
"preset": "music_video",
"download": {"url": "https://youtube.com/watch?v=HKTNxEqsN3Q"},
"download": "https://youtube.com/watch?v=HKTNxEqsN3Q",
# override the output directory with our fixture-generated dir
"output_options": {
"output_directory": output_directory,

View file

@ -67,8 +67,8 @@ class TestConfigFilePartiallyValidatesPresets:
def test_error__download_args(self):
self._partial_validate(
preset_dict={"download": {"bad_key": "nope"}},
expected_error_message="Validation error in partial_preset.download: "
"'partial_preset.download' contains the field 'bad_key' which is not allowed. "
expected_error_message="Validation error in partial_preset.download.1: "
"'partial_preset.download.1' contains the field 'bad_key' which is not allowed. "
"Allowed fields: download_reverse, playlist_thumbnails, source_thumbnails, url, "
"variables",
)
@ -77,7 +77,7 @@ class TestConfigFilePartiallyValidatesPresets:
"preset_dict",
[
{"nfo_tags": {"tags": {"key-1": {"attributes": {"test": "2"}}}}},
{"download": {"urls": [{"variables_to_set": {"name": "value"}}]}},
{"download": [{"variables_to_set": {"name": "value"}}]},
],
)
def test_partial_validate__incomplete_list_item(self, preset_dict):

View file

@ -12,10 +12,12 @@ class TestPreset:
@pytest.mark.parametrize(
"download_value",
[
{"url": "youtube.com/watch?v=123abc"},
{"urls": [{"url": "youtube.com/watch?v=123abc"}]},
###########################################################
##### OLD download_strategy format
{"url": "youtube.com/watch?v=123abc"}, # url download strategy
{"urls": [{"url": "youtube.com/watch?v=123abc"}]}, # multi-url download strategy
"youtube.com/watch?v=123abc", # single string
["youtube.com/watch?v=123abc", "youtube.com/watch?v=123xyz"], # list of strings
[{"url": "youtube.com/watch?v=123abc"}, "youtube.com/watch?v=123abc"], # dict and str
# OLD download_strategy format
{"download_strategy": "url", "url": "youtube.com/watch?v=123abc"},
{"download_strategy": "multi-url", "urls": [{"url": "youtube.com/watch?v=123abc"}]},
],
@ -201,9 +203,7 @@ class TestPreset:
config=config_file,
name="test",
value={
"download": {
"urls": [{"url": "non-empty url"}, {"url": ""}], # empty url
},
"download": [{"url": "non-empty url"}, {"url": ""}], # empty url
"output_options": output_options,
},
)
@ -222,9 +222,7 @@ class TestPreset:
config=config_file,
name="test",
value={
"download": {
"urls": [{"url": "{url}"}, {"url": "{url2}"}],
},
"download": [{"url": "{url}"}, {"url": "{url2}"}],
"output_options": output_options,
"overrides": {"url": "", "url2": ""},
},

View file

@ -52,7 +52,7 @@ class TestPrebuiltTVShowPresets:
preset_name="preset_test",
preset_dict={
"preset": parent_presets,
"download": {"urls": [{"url": "https://second.url"}]},
"download": "https://second.url",
"overrides": {
"url": "https://your.name.here",
"tv_show_name": "test-compile",