track no longer used in example
This commit is contained in:
parent
b88f9d0b26
commit
a3509d50c4
4 changed files with 26 additions and 19 deletions
|
|
@ -47,7 +47,7 @@ presets:
|
||||||
nfo_root: "musicvideo"
|
nfo_root: "musicvideo"
|
||||||
tags:
|
tags:
|
||||||
artist: "{artist}"
|
artist: "{artist}"
|
||||||
title: "{track_title}"
|
title: "{title}"
|
||||||
album: "Music Videos"
|
album: "Music Videos"
|
||||||
year: "{upload_year}"
|
year: "{upload_year}"
|
||||||
|
|
||||||
|
|
@ -56,7 +56,7 @@ presets:
|
||||||
# here, which gets reused above for the video, thumbnail, and NFO file.
|
# here, which gets reused above for the video, thumbnail, and NFO file.
|
||||||
overrides:
|
overrides:
|
||||||
music_video_directory: "path/to/Music Videos"
|
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.
|
# 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
|
# Maybe you only like one song of theirs. We can reuse our preset above
|
||||||
|
|
|
||||||
|
|
@ -2,15 +2,18 @@ import hashlib
|
||||||
import os.path
|
import os.path
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Dict
|
from typing import Dict
|
||||||
|
from typing import Optional
|
||||||
|
|
||||||
|
|
||||||
class ExpectedDownload:
|
class ExpectedDownload:
|
||||||
"""
|
"""
|
||||||
To test ytdl-sub downloads work, we compare each downloaded file's md5 hash to an
|
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
|
self.expected_md5_file_hashes = expected_md5_file_hashes
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
|
@ -39,9 +42,13 @@ class ExpectedDownload:
|
||||||
full_path
|
full_path
|
||||||
), f"Expected {str(relative_path)} to be a file but it is not"
|
), 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:
|
with open(full_path, "rb") as file:
|
||||||
md5_hash = hashlib.md5(file.read()).hexdigest()
|
md5_hash = hashlib.md5(file.read()).hexdigest()
|
||||||
|
|
||||||
assert (
|
assert md5_hash == expected_md5_hash, (
|
||||||
md5_hash == expected_md5_hash
|
f"MD5 hash for {str(relative_path)} does not match: "
|
||||||
), f"MD5 hash for {str(relative_path)} does not match"
|
f"{md5_hash} != {expected_md5_hash}"
|
||||||
|
)
|
||||||
|
|
|
||||||
|
|
@ -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].mp4"): "e66287b9832277b6a4d1554e29d9fdcc",
|
||||||
Path("pz/Season 2011/s2011.e0201 - Jesse's Minecraft Server [Trailer - Feb.1].nfo"): "f7c0de89038f8c491bded8a3968720a2",
|
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].mp4"): "04ab5cb3cc12325d0c96a7cd04a8b91d",
|
||||||
Path("pz/Season 2011/s2011.e0227 - Jesse's Minecraft Server [Trailer - Feb.27].nfo"): "ee1eda78fa0980bc703e602b5012dd1f",
|
Path("pz/Season 2011/s2011.e0227 - Jesse's Minecraft Server [Trailer - Feb.27].nfo"): "ee1eda78fa0980bc703e602b5012dd1f",
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -66,20 +66,20 @@ def expected_playlist_download():
|
||||||
return ExpectedDownload(
|
return ExpectedDownload(
|
||||||
expected_md5_file_hashes={
|
expected_md5_file_hashes={
|
||||||
# Download mapping
|
# Download mapping
|
||||||
Path(".ytdl-sub-jmc-download-archive.json"): "7541aa75606b86bff5ff276895520cf0",
|
Path(".ytdl-sub-jmc-download-archive.json"): "d8e784353c7c3006cb755a034c965160",
|
||||||
|
|
||||||
# Entry files
|
# 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].mp4"): "e66287b9832277b6a4d1554e29d9fdcc",
|
||||||
Path("JMC - Jesse's Minecraft Server [Trailer - Feb.1].nfo"): "3d272fe58487b6011ad049b6000b046f",
|
Path("JMC - Jesse's Minecraft Server [Trailer - Feb.1].nfo"): "3d272fe58487b6011ad049b6000b046f",
|
||||||
|
|
||||||
Path("JMC - Given to Fly.jpg"): "2e58e4d5f06ce5d1c3336fa493470135",
|
Path("JMC - Jesse's Minecraft Server [Trailer - Feb.27].jpg"): None,
|
||||||
Path("JMC - Given to Fly.mp4"): "04ab5cb3cc12325d0c96a7cd04a8b91d",
|
Path("JMC - Jesse's Minecraft Server [Trailer - Feb.27].mp4"): "04ab5cb3cc12325d0c96a7cd04a8b91d",
|
||||||
Path("JMC - Given to Fly.nfo"): "0dc578bf5f1ceb6e069a57d329894f35",
|
Path("JMC - Jesse's Minecraft Server [Trailer - Feb.27].nfo"): "6f99af10bef67276a507d1d9770c5e92",
|
||||||
|
|
||||||
Path("JMC - Indifference (Remastered).jpg"): "9baaddc6b62f5b9ae3781eb4eef0e3b3",
|
Path("JMC - Jesse's Minecraft Server [Trailer - Mar.21].jpg"): None,
|
||||||
Path("JMC - Indifference (Remastered).mp4"): "025de6099a5c98e6397153c7a62d517d",
|
Path("JMC - Jesse's Minecraft Server [Trailer - Mar.21].mp4"): "025de6099a5c98e6397153c7a62d517d",
|
||||||
Path("JMC - Indifference (Remastered).nfo"): "061b86d9dc8fb39d39feab3292dafeb0",
|
Path("JMC - Jesse's Minecraft Server [Trailer - Mar.21].nfo"): "beec3c1326654bd8c858cecf4e40977a",
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
# fmt: on
|
# fmt: on
|
||||||
|
|
@ -120,9 +120,9 @@ def expected_single_video_download():
|
||||||
# fmt: off
|
# fmt: off
|
||||||
return ExpectedDownload(
|
return ExpectedDownload(
|
||||||
expected_md5_file_hashes={
|
expected_md5_file_hashes={
|
||||||
Path("JMC - Whale & Wasp.jpg"): "b58377dfe7c39527e1990a24b36bbd77",
|
Path("JMC - Oblivion Mod 'Falcor' p.1.jpg"): None,
|
||||||
Path("JMC - Whale & Wasp.mp4"): "931a705864c57d21d6fedebed4af6bbc",
|
Path("JMC - Oblivion Mod 'Falcor' p.1.mp4"): "931a705864c57d21d6fedebed4af6bbc",
|
||||||
Path("JMC - Whale & Wasp.nfo"): "6c2f085adb847c1dcc47c19514c454d8",
|
Path("JMC - Oblivion Mod 'Falcor' p.1.nfo"): "89f509a8a3d9003e22a9091abeeae5dc",
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
# fmt: on
|
# fmt: on
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue