From a3509d50c4136dfdfa8f887066c33727cba7ca66 Mon Sep 17 00:00:00 2001 From: jbannon Date: Sun, 26 Jun 2022 21:55:23 +0000 Subject: [PATCH] track no longer used in example --- examples/kodi_music_videos_config.yaml | 4 ++-- tests/e2e/expected_download.py | 17 +++++++++----- .../youtube/test_channel_as_kodi_tv_show.py | 2 +- .../test_playlist_as_kodi_music_videos.py | 22 +++++++++---------- 4 files changed, 26 insertions(+), 19 deletions(-) diff --git a/examples/kodi_music_videos_config.yaml b/examples/kodi_music_videos_config.yaml index 1f16ca55..b5a8b70b 100644 --- a/examples/kodi_music_videos_config.yaml +++ b/examples/kodi_music_videos_config.yaml @@ -47,7 +47,7 @@ presets: nfo_root: "musicvideo" tags: artist: "{artist}" - title: "{track_title}" + title: "{title}" album: "Music Videos" year: "{upload_year}" @@ -56,7 +56,7 @@ presets: # here, which gets reused above for the video, thumbnail, and NFO file. overrides: music_video_directory: "path/to/Music Videos" - music_video_name: "{artist_sanitized} - {track_title_sanitized}" + music_video_name: "{artist_sanitized} - {title_sanitized}" # 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 above diff --git a/tests/e2e/expected_download.py b/tests/e2e/expected_download.py index 7028c6b2..a4f67ea6 100644 --- a/tests/e2e/expected_download.py +++ b/tests/e2e/expected_download.py @@ -2,15 +2,18 @@ import hashlib import os.path from pathlib import Path from typing import Dict +from typing import Optional class ExpectedDownload: """ To test ytdl-sub downloads work, we compare each downloaded file's md5 hash to an - expected md5 hash defined in this class + expected md5 hash defined in this class. + + If the hash value is None, only assert the file exists """ - def __init__(self, expected_md5_file_hashes: Dict[Path, str]): + def __init__(self, expected_md5_file_hashes: Dict[Path, Optional[str]]): self.expected_md5_file_hashes = expected_md5_file_hashes @property @@ -39,9 +42,13 @@ class ExpectedDownload: full_path ), f"Expected {str(relative_path)} to be a file but it is not" + if expected_md5_hash is None: + continue + with open(full_path, "rb") as file: md5_hash = hashlib.md5(file.read()).hexdigest() - assert ( - md5_hash == expected_md5_hash - ), f"MD5 hash for {str(relative_path)} does not match" + assert md5_hash == expected_md5_hash, ( + f"MD5 hash for {str(relative_path)} does not match: " + f"{md5_hash} != {expected_md5_hash}" + ) diff --git a/tests/e2e/youtube/test_channel_as_kodi_tv_show.py b/tests/e2e/youtube/test_channel_as_kodi_tv_show.py index 419937fd..cc722095 100644 --- a/tests/e2e/youtube/test_channel_as_kodi_tv_show.py +++ b/tests/e2e/youtube/test_channel_as_kodi_tv_show.py @@ -88,7 +88,7 @@ def expected_full_channel_download(): Path("pz/Season 2011/s2011.e0201 - Jesse's Minecraft Server [Trailer - Feb.1].mp4"): "e66287b9832277b6a4d1554e29d9fdcc", Path("pz/Season 2011/s2011.e0201 - Jesse's Minecraft Server [Trailer - Feb.1].nfo"): "f7c0de89038f8c491bded8a3968720a2", - Path("pz/Season 2011/s2011.e0227 - Jesse's Minecraft Server [Trailer - Feb.27].jpg"): "2e58e4d5f06ce5d1c3336fa493470135", + Path("pz/Season 2011/s2011.e0227 - Jesse's Minecraft Server [Trailer - Feb.27].jpg"): None, Path("pz/Season 2011/s2011.e0227 - Jesse's Minecraft Server [Trailer - Feb.27].mp4"): "04ab5cb3cc12325d0c96a7cd04a8b91d", Path("pz/Season 2011/s2011.e0227 - Jesse's Minecraft Server [Trailer - Feb.27].nfo"): "ee1eda78fa0980bc703e602b5012dd1f", diff --git a/tests/e2e/youtube/test_playlist_as_kodi_music_videos.py b/tests/e2e/youtube/test_playlist_as_kodi_music_videos.py index a31e39de..39e64400 100644 --- a/tests/e2e/youtube/test_playlist_as_kodi_music_videos.py +++ b/tests/e2e/youtube/test_playlist_as_kodi_music_videos.py @@ -66,20 +66,20 @@ def expected_playlist_download(): return ExpectedDownload( expected_md5_file_hashes={ # Download mapping - Path(".ytdl-sub-jmc-download-archive.json"): "7541aa75606b86bff5ff276895520cf0", + Path(".ytdl-sub-jmc-download-archive.json"): "d8e784353c7c3006cb755a034c965160", # Entry files - Path("JMC - Jesse's Minecraft Server [Trailer - Feb.1].jpg"): "048a19cf0f674437351872c3f312ebf1", + Path("JMC - Jesse's Minecraft Server [Trailer - Feb.1].jpg"): None, Path("JMC - Jesse's Minecraft Server [Trailer - Feb.1].mp4"): "e66287b9832277b6a4d1554e29d9fdcc", Path("JMC - Jesse's Minecraft Server [Trailer - Feb.1].nfo"): "3d272fe58487b6011ad049b6000b046f", - Path("JMC - Given to Fly.jpg"): "2e58e4d5f06ce5d1c3336fa493470135", - Path("JMC - Given to Fly.mp4"): "04ab5cb3cc12325d0c96a7cd04a8b91d", - Path("JMC - Given to Fly.nfo"): "0dc578bf5f1ceb6e069a57d329894f35", + Path("JMC - Jesse's Minecraft Server [Trailer - Feb.27].jpg"): None, + Path("JMC - Jesse's Minecraft Server [Trailer - Feb.27].mp4"): "04ab5cb3cc12325d0c96a7cd04a8b91d", + Path("JMC - Jesse's Minecraft Server [Trailer - Feb.27].nfo"): "6f99af10bef67276a507d1d9770c5e92", - Path("JMC - Indifference (Remastered).jpg"): "9baaddc6b62f5b9ae3781eb4eef0e3b3", - Path("JMC - Indifference (Remastered).mp4"): "025de6099a5c98e6397153c7a62d517d", - Path("JMC - Indifference (Remastered).nfo"): "061b86d9dc8fb39d39feab3292dafeb0", + Path("JMC - Jesse's Minecraft Server [Trailer - Mar.21].jpg"): None, + Path("JMC - Jesse's Minecraft Server [Trailer - Mar.21].mp4"): "025de6099a5c98e6397153c7a62d517d", + Path("JMC - Jesse's Minecraft Server [Trailer - Mar.21].nfo"): "beec3c1326654bd8c858cecf4e40977a", } ) # fmt: on @@ -120,9 +120,9 @@ def expected_single_video_download(): # fmt: off return ExpectedDownload( expected_md5_file_hashes={ - Path("JMC - Whale & Wasp.jpg"): "b58377dfe7c39527e1990a24b36bbd77", - Path("JMC - Whale & Wasp.mp4"): "931a705864c57d21d6fedebed4af6bbc", - Path("JMC - Whale & Wasp.nfo"): "6c2f085adb847c1dcc47c19514c454d8", + Path("JMC - Oblivion Mod 'Falcor' p.1.jpg"): None, + Path("JMC - Oblivion Mod 'Falcor' p.1.mp4"): "931a705864c57d21d6fedebed4af6bbc", + Path("JMC - Oblivion Mod 'Falcor' p.1.nfo"): "89f509a8a3d9003e22a9091abeeae5dc", } ) # fmt: on