music video test, need to update no config

This commit is contained in:
Jesse Bannon 2023-10-26 23:54:59 -07:00
parent abbf9d2068
commit ed27c84853
12 changed files with 71 additions and 124 deletions

View file

@ -10,7 +10,7 @@
# 02 - Another Track.mp3
# folder.jpg
# Overrides to the prebuilt presets
# Override variables globally for all subscriptions
__preset__:
overrides:
music_directory: "/music"

View file

@ -0,0 +1,25 @@
# Files will be stored in the form of:
#
# music_videos/
# Elton John/
# Elton John - Rocketman.jpg
# Elton John - Rocketman.mp4
# System of a Down/
# System of a Down - Chop Suey.jpg
# System of a Down - Chop Suey.mp4
# ...
# Override variables globally for all subscriptions
__preset__:
overrides:
music_video_directory: "/music_videos"
# Choose between Jellyfin/Kodi/Plex Music Videos
# "Jellyfin Music Videos":
# "Kodi Music Videos":
"Plex Music Videos":
= Pop: # Sets genre tag to "Pop"
"Rick Astley": "https://www.youtube.com/playlist?list=PLlaN88a7y2_plecYoJxvRFTLHVbIVAOoc"
"Michael Jackson": "https://www.youtube.com/playlist?list=OLAK5uy_mnY03zP6abNWH929q2XhGzWD_2uKJ_n8E"
= Blues:
"Eric Clapton": "https://www.youtube.com/playlist?list=PLABGggHhsbEeaRtdzqnxYoEINsJE_4GF4"

View file

@ -1,65 +0,0 @@
# This example shows how to download and format a music video OR playlist
# of music videos to display in Kodi as a music video. The format will
# look like:
#
# /path/to/Music Videos
# Elton John/
# Elton John - Rocketman-thumb.jpg
# Elton John - Rocketman.mp4
# Elton John - Rocketman.nfo
# System of a Down/
# System of a Down - Chop Suey-thumb.jpg
# System of a Down - Chop Suey.mp4
# System of a Down - Chop Suey.nfo
# ...
#
configuration:
working_directory: '.ytdl-sub-downloads'
presets:
music_video:
# We will only use a single URL to download music video(s).
# Make {url} an override variable to set later.
download:
- "{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
# file here as a ytdl parameter. For more info, see
# https://ytdl-sub.readthedocs.io/en/latest/faq.html#download-age-restricted-youtube-videos
ytdl_options:
# cookiefile: "path/to/cookie_file.txt
break_on_existing: True # Stop downloads if it already exists
# For each video downloaded, set the file and thumbnail name here.
# We set both with {music_video_name}, which is a variable we define in
# the overrides section further below to represent consistent naming format.
output_options:
output_directory: "{music_video_directory}"
file_name: "{music_video_name}.{ext}"
thumbnail_name: "{music_video_name}-thumb.jpg"
info_json_name: "{music_video_name}.{info_json_ext}"
maintain_download_archive: True
# For each video downloaded, add a music video NFO file for it. Populate it
# with tags that Kodi will read and use to display it in the music or music
# videos section.
nfo_tags:
nfo_name: "{music_video_name}.nfo"
nfo_root: "musicvideo"
tags:
artist: "{artist}"
title: "{title}"
album: "Music Videos"
year: "{upload_year}"
# Overrides is a section where we can define our own variables, and use them in
# any other section. We define our music video directory and episode file name
# here, which gets reused above for the video, thumbnail, and NFO file.
# Recommended to override the artist variable since {channel} is not always
# the artist's exact name.
overrides:
music_video_directory: "path/to/Music Videos"
music_video_name: "{artist_sanitized}/{artist_sanitized} - {title_sanitized}"
artist: "{channel}"

View file

@ -1,24 +0,0 @@
###############################################################################
# DOWNLOAD MUSIC VIDEO PLAYLIST
john_smith:
preset: "music_video"
overrides:
url: "https://youtube.com/playlist?list=UCsvn_Po0SmunchJYtttWpOxMg"
artist: "John Smith and the Instrument Players"
###############################################################################
# DOWNLOAD SINGLE MUSIC VIDEO VIA CLI
# It is not always ideal to download all of an artist's music videos.
# Maybe you only like one song of theirs. We can reuse our preset
# to download a single video instead.
#
# Of course, defining yaml configuration to download a single video once
# and never again seems weird. Instead, we can perform this download via
# command-line:
#
# ytdl-sub dl \
# --preset "music_video" \
# --overrides.url "https://youtube.com/watch?v=QhY6r6oAErg" \
# --overrides.artist "John Smith and the Instrument Players"
#

View file

@ -7,6 +7,10 @@ presets:
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:

View file

@ -157,19 +157,9 @@ def _load_config(config_path: Path, working_directory: str) -> ConfigFile:
return ConfigFile.from_dict(config_dict)
@pytest.fixture()
def music_video_config_path() -> Path:
return Path("examples/music_videos_config.yaml")
@pytest.fixture()
def music_video_config(music_video_config_path, working_directory) -> ConfigFile:
return _load_config(music_video_config_path, working_directory)
@pytest.fixture()
def music_video_subscription_path() -> Path:
return Path("examples/music_videos_subscriptions.yaml")
return Path("examples/music_video_subscriptions.yaml")
@pytest.fixture()
@ -185,7 +175,7 @@ def tv_show_subscriptions_path() -> Path:
@pytest.fixture()
def music_audio_config(working_directory) -> ConfigFile:
def default_config(working_directory) -> ConfigFile:
return ConfigFile.from_dict({"configuration": {"working_directory": working_directory}})

View file

@ -29,14 +29,14 @@ class TestBandcamp:
def test_prebuilt_preset_download(
self,
subscription_dict,
music_audio_config,
default_config,
output_directory,
dry_run,
):
discography_subscription = Subscription.from_dict(
preset_dict=subscription_dict,
preset_name="Sithu Aye",
config=music_audio_config,
config=default_config,
)
transaction_log = discography_subscription.download(dry_run=dry_run)
assert_transaction_log_matches(

View file

@ -71,13 +71,13 @@ class TestAudioExtract:
@pytest.mark.parametrize("dry_run", [True, False])
def test_audio_extract_single_song_old_format(
self,
music_audio_config,
default_config,
single_preset_dict_old_format,
output_directory,
dry_run,
):
subscription = Subscription.from_dict(
config=music_audio_config,
config=default_config,
preset_name="single_song_test",
preset_dict=single_preset_dict_old_format,
)
@ -97,13 +97,13 @@ class TestAudioExtract:
@pytest.mark.parametrize("dry_run", [False])
def test_audio_extract_single_song(
self,
music_audio_config,
default_config,
single_preset_dict,
output_directory,
dry_run,
):
subscription = Subscription.from_dict(
config=music_audio_config,
config=default_config,
preset_name="single_song_test",
preset_dict=single_preset_dict,
)
@ -123,13 +123,13 @@ class TestAudioExtract:
@pytest.mark.parametrize("dry_run", [True, False])
def test_audio_extract_single_song_best_format(
self,
music_audio_config,
default_config,
single_best_format_preset_dict,
output_directory,
dry_run,
):
subscription = Subscription.from_dict(
config=music_audio_config,
config=default_config,
preset_name="single_song_best_test",
preset_dict=single_best_format_preset_dict,
)
@ -149,13 +149,13 @@ class TestAudioExtract:
@pytest.mark.parametrize("dry_run", [True, False])
def test_audio_extract_multiple_songs(
self,
music_audio_config,
default_config,
youtube_release_preset_dict,
output_directory,
dry_run,
):
subscription = Subscription.from_dict(
config=music_audio_config,
config=default_config,
preset_name="multiple_songs_test",
preset_dict=youtube_release_preset_dict,
)

View file

@ -23,12 +23,12 @@ def single_song_video_dict(output_directory):
class TestMusicTags:
def test_music_tags_errors_on_video(
self,
music_audio_config,
default_config,
single_song_video_dict,
output_directory,
):
subscription = Subscription.from_dict(
config=music_audio_config,
config=default_config,
preset_name="single_song_test",
preset_dict=single_song_video_dict,
)

View file

@ -70,13 +70,13 @@ class TestSplitByChapters:
@pytest.mark.parametrize("dry_run", [True, False])
def test_video_with_chapters(
self,
music_audio_config,
default_config,
yt_album_as_chapters_preset_dict,
output_directory,
dry_run,
):
subscription = Subscription.from_dict(
config=music_audio_config,
config=default_config,
preset_name="Proved Records",
preset_dict=yt_album_as_chapters_preset_dict,
)
@ -100,13 +100,13 @@ class TestSplitByChapters:
@pytest.mark.parametrize("dry_run", [True, False])
def test_video_with_chapters_and_regex(
self,
music_audio_config,
default_config,
yt_album_as_chapters_with_regex_preset_dict,
output_directory,
dry_run,
):
subscription = Subscription.from_dict(
config=music_audio_config,
config=default_config,
preset_name="split_by_chapters_with_regex_video_preset",
preset_dict=yt_album_as_chapters_with_regex_preset_dict,
)
@ -127,7 +127,7 @@ class TestSplitByChapters:
@pytest.mark.parametrize("when_no_chapters", ["pass", "drop", "error"])
def test_video_with_no_chapters_and_regex(
self,
music_audio_config,
default_config,
yt_album_as_chapters_with_regex_preset_dict,
output_directory,
dry_run,
@ -142,7 +142,7 @@ class TestSplitByChapters:
)
subscription = Subscription.from_dict(
config=music_audio_config,
config=default_config,
preset_name="split_by_chapters_with_regex_video_no_chapters",
preset_dict=yt_album_as_chapters_with_regex_preset_dict,
)

View file

@ -28,14 +28,14 @@ class TestSoundcloudDiscography:
def test_discography_download(
self,
subscription_dict,
music_audio_config,
default_config,
output_directory,
dry_run,
):
discography_subscription = Subscription.from_dict(
preset_dict=subscription_dict,
preset_name="j_b",
config=music_audio_config,
config=default_config,
)
transaction_log = discography_subscription.download(dry_run=dry_run)
assert_transaction_log_matches(

View file

@ -368,9 +368,9 @@ def test_tv_show_subscriptions(
assert jake_train_overrides["subscription_indent_2"] == "TV-Y"
def test_music_subscriptions(music_audio_config: ConfigFile, music_subscriptions_path: Path):
def test_music_subscriptions(default_config: ConfigFile, music_subscriptions_path: Path):
subs = Subscription.from_file_path(
config=music_audio_config, subscription_path=music_subscriptions_path
config=default_config, subscription_path=music_subscriptions_path
)
assert len(subs) == 14
@ -380,3 +380,20 @@ def test_music_subscriptions(music_audio_config: ConfigFile, music_subscriptions
assert monk["subscription_name"] == "Stan Getz"
assert monk["subscription_value"] == "https://www.youtube.com/@stangetzofficial/releases"
assert monk["subscription_indent_1"] == "Jazz"
def test_music_video_subscriptions(default_config: ConfigFile, music_video_subscription_path: Path):
subs = Subscription.from_file_path(
config=default_config, subscription_path=music_video_subscription_path
)
assert len(subs) == 3
assert subs[1].name == "Michael Jackson"
monk = subs[1].overrides.dict_with_format_strings
assert monk["subscription_name"] == "Michael Jackson"
assert (
monk["subscription_value"]
== "https://www.youtube.com/playlist?list=OLAK5uy_mnY03zP6abNWH929q2XhGzWD_2uKJ_n8E"
)
assert monk["subscription_indent_1"] == "Pop"