almost fixed
This commit is contained in:
parent
6c4af85032
commit
a1869b0b9e
15 changed files with 71 additions and 55 deletions
|
|
@ -127,6 +127,12 @@ class FileHandlerTransactionLog:
|
|||
The output message to show users what was recorded in the transaction log
|
||||
"""
|
||||
lines: List[str] = []
|
||||
|
||||
def _indent_metadata_line(line: str) -> str:
|
||||
# Do not indent empty lines
|
||||
rstrip_line = line.rstrip()
|
||||
return f" {rstrip_line}" if rstrip_line else ""
|
||||
|
||||
if self.files_created:
|
||||
created_line = f"Files created in '{output_directory}'"
|
||||
created_line_dash = "-" * 40
|
||||
|
|
@ -134,9 +140,7 @@ class FileHandlerTransactionLog:
|
|||
for file_path, file_metadata in sorted(self.files_created.items()):
|
||||
lines.append(file_path)
|
||||
if file_metadata:
|
||||
lines.extend(
|
||||
[f" {metadata_line.strip()}" for metadata_line in file_metadata.metadata]
|
||||
)
|
||||
lines.extend([_indent_metadata_line(line) for line in file_metadata.metadata])
|
||||
|
||||
if self.files_removed:
|
||||
removed_line = f"Files removed from '{output_directory}'"
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ def assert_transaction_log_matches(
|
|||
output_directory: str,
|
||||
transaction_log: FileHandlerTransactionLog,
|
||||
transaction_log_summary_file_name: str,
|
||||
regenerate_transaction_log: bool = False,
|
||||
):
|
||||
"""
|
||||
Parameters
|
||||
|
|
@ -21,12 +22,21 @@ def assert_transaction_log_matches(
|
|||
transaction_log_summary_file_name
|
||||
Name if the transaction log summary to compare.
|
||||
Lives in tests/e2e/resources/transaction_log_summaries
|
||||
regenerate_transaction_log
|
||||
USE WITH CAUTION
|
||||
Updates the file with the input transaction log. Should only be used to update
|
||||
tests after an expected change is made.
|
||||
"""
|
||||
# Read the expected summary file
|
||||
with open(
|
||||
_TRANSACTION_LOG_SUMMARY_PATH / transaction_log_summary_file_name, "r", encoding="utf-8"
|
||||
) as summary_file:
|
||||
transaction_log_path = _TRANSACTION_LOG_SUMMARY_PATH / transaction_log_summary_file_name
|
||||
summary = transaction_log.to_output_message(output_directory=output_directory)
|
||||
|
||||
# Write the expected summary file if regenerate is True
|
||||
if regenerate_transaction_log:
|
||||
with open(transaction_log_path, "w", encoding="utf-8") as summary_file:
|
||||
summary_file.write(summary)
|
||||
|
||||
# Read the expected summary file
|
||||
with open(transaction_log_path, "r", encoding="utf-8") as summary_file:
|
||||
expected_summary = summary_file.read().format(output_directory=output_directory)
|
||||
|
||||
# Split, ensure there are the same number of new lines
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
Files created in 'FILL_IN'
|
||||
Files created in '{output_directory}'
|
||||
----------------------------------------
|
||||
.ytdl-sub-jb-download-archive.json
|
||||
j_b/[2021] Baby Santana's Dorian Groove/01 - Baby Santana's Dorian Groove.mp3
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
Files created in '{output_directory}'
|
||||
----------------------------------------
|
||||
.ytdl-sub-pz-download-archive.json
|
||||
Season 2010/s2010.e0813 - Oblivion Mod 'Falcor' p.1.jpg
|
||||
Season 2010/s2010.e0813 - Oblivion Mod 'Falcor' p.1-thumb.jpg
|
||||
Season 2010/s2010.e0813 - Oblivion Mod 'Falcor' p.1.mp4
|
||||
Season 2010/s2010.e0813 - Oblivion Mod 'Falcor' p.1.nfo
|
||||
NFO tags:
|
||||
|
|
@ -18,7 +18,7 @@ Season 2010/s2010.e0813 - Oblivion Mod 'Falcor' p.1.nfo
|
|||
season: 2010
|
||||
title: Oblivion Mod "Falcor" p.1
|
||||
year: 2010
|
||||
Season 2010/s2010.e1202 - Oblivion Mod 'Falcor' p.2.jpg
|
||||
Season 2010/s2010.e1202 - Oblivion Mod 'Falcor' p.2-thumb.jpg
|
||||
Season 2010/s2010.e1202 - Oblivion Mod 'Falcor' p.2.mp4
|
||||
Season 2010/s2010.e1202 - Oblivion Mod 'Falcor' p.2.nfo
|
||||
NFO tags:
|
||||
|
|
@ -35,7 +35,7 @@ Season 2010/s2010.e1202 - Oblivion Mod 'Falcor' p.2.nfo
|
|||
season: 2010
|
||||
title: Oblivion Mod "Falcor" p.2
|
||||
year: 2010
|
||||
Season 2011/s2011.e0201 - Jesse's Minecraft Server [Trailer - Feb.1].jpg
|
||||
Season 2011/s2011.e0201 - Jesse's Minecraft Server [Trailer - Feb.1]-thumb.jpg
|
||||
Season 2011/s2011.e0201 - Jesse's Minecraft Server [Trailer - Feb.1].mp4
|
||||
Season 2011/s2011.e0201 - Jesse's Minecraft Server [Trailer - Feb.1].nfo
|
||||
NFO tags:
|
||||
|
|
@ -53,7 +53,7 @@ Season 2011/s2011.e0201 - Jesse's Minecraft Server [Trailer - Feb.1].nfo
|
|||
season: 2011
|
||||
title: Jesse's Minecraft Server [Trailer - Feb.1]
|
||||
year: 2011
|
||||
Season 2011/s2011.e0227 - Jesse's Minecraft Server [Trailer - Feb.27].jpg
|
||||
Season 2011/s2011.e0227 - Jesse's Minecraft Server [Trailer - Feb.27]-thumb.jpg
|
||||
Season 2011/s2011.e0227 - Jesse's Minecraft Server [Trailer - Feb.27].mp4
|
||||
Season 2011/s2011.e0227 - Jesse's Minecraft Server [Trailer - Feb.27].nfo
|
||||
NFO tags:
|
||||
|
|
@ -90,7 +90,7 @@ Season 2011/s2011.e0227 - Jesse's Minecraft Server [Trailer - Feb.27].nfo
|
|||
season: 2011
|
||||
title: Jesse's Minecraft Server [Trailer - Feb.27]
|
||||
year: 2011
|
||||
Season 2011/s2011.e0321 - Jesse's Minecraft Server [Trailer - Mar.21].jpg
|
||||
Season 2011/s2011.e0321 - Jesse's Minecraft Server [Trailer - Mar.21]-thumb.jpg
|
||||
Season 2011/s2011.e0321 - Jesse's Minecraft Server [Trailer - Mar.21].mp4
|
||||
Season 2011/s2011.e0321 - Jesse's Minecraft Server [Trailer - Mar.21].nfo
|
||||
NFO tags:
|
||||
|
|
@ -127,7 +127,7 @@ Season 2011/s2011.e0321 - Jesse's Minecraft Server [Trailer - Mar.21].nfo
|
|||
season: 2011
|
||||
title: Jesse's Minecraft Server [Trailer - Mar.21]
|
||||
year: 2011
|
||||
Season 2011/s2011.e0529 - Project Zombie _Official Trailer_ (IP - mc.projectzombie.beastnode.net).jpg
|
||||
Season 2011/s2011.e0529 - Project Zombie _Official Trailer_ (IP - mc.projectzombie.beastnode.net)-thumb.jpg
|
||||
Season 2011/s2011.e0529 - Project Zombie _Official Trailer_ (IP - mc.projectzombie.beastnode.net).mp4
|
||||
Season 2011/s2011.e0529 - Project Zombie _Official Trailer_ (IP - mc.projectzombie.beastnode.net).nfo
|
||||
NFO tags:
|
||||
|
|
@ -154,7 +154,7 @@ Season 2011/s2011.e0529 - Project Zombie _Official Trailer_ (IP - mc.projectzomb
|
|||
season: 2011
|
||||
title: Project Zombie |Official Trailer| (IP: mc.projectzombie.beastnode.net)
|
||||
year: 2011
|
||||
Season 2011/s2011.e0630 - Project Zombie _Fin.jpg
|
||||
Season 2011/s2011.e0630 - Project Zombie _Fin-thumb.jpg
|
||||
Season 2011/s2011.e0630 - Project Zombie _Fin.mp4
|
||||
Season 2011/s2011.e0630 - Project Zombie _Fin.nfo
|
||||
NFO tags:
|
||||
|
|
@ -167,7 +167,7 @@ Season 2011/s2011.e0630 - Project Zombie _Fin.nfo
|
|||
season: 2011
|
||||
title: Project Zombie |Fin|
|
||||
year: 2011
|
||||
Season 2011/s2011.e1121 - Skyrim 'Ultra HD w_Mods' [PC].jpg
|
||||
Season 2011/s2011.e1121 - Skyrim 'Ultra HD w_Mods' [PC]-thumb.jpg
|
||||
Season 2011/s2011.e1121 - Skyrim 'Ultra HD w_Mods' [PC].mp4
|
||||
Season 2011/s2011.e1121 - Skyrim 'Ultra HD w_Mods' [PC].nfo
|
||||
NFO tags:
|
||||
|
|
@ -187,7 +187,7 @@ Season 2011/s2011.e1121 - Skyrim 'Ultra HD w_Mods' [PC].nfo
|
|||
season: 2011
|
||||
title: Skyrim 'Ultra HD w/Mods' [PC]
|
||||
year: 2011
|
||||
Season 2012/s2012.e0123 - Project Zombie _Map Trailer.jpg
|
||||
Season 2012/s2012.e0123 - Project Zombie _Map Trailer-thumb.jpg
|
||||
Season 2012/s2012.e0123 - Project Zombie _Map Trailer.mp4
|
||||
Season 2012/s2012.e0123 - Project Zombie _Map Trailer.nfo
|
||||
NFO tags:
|
||||
|
|
@ -207,7 +207,7 @@ Season 2012/s2012.e0123 - Project Zombie _Map Trailer.nfo
|
|||
season: 2012
|
||||
title: Project Zombie |Map Trailer|
|
||||
year: 2012
|
||||
Season 2013/s2013.e0719 - Project Zombie Rewind _Trailer.jpg
|
||||
Season 2013/s2013.e0719 - Project Zombie Rewind _Trailer-thumb.jpg
|
||||
Season 2013/s2013.e0719 - Project Zombie Rewind _Trailer.mp4
|
||||
Season 2013/s2013.e0719 - Project Zombie Rewind _Trailer.nfo
|
||||
NFO tags:
|
||||
|
|
@ -222,7 +222,7 @@ Season 2013/s2013.e0719 - Project Zombie Rewind _Trailer.nfo
|
|||
season: 2013
|
||||
title: Project Zombie Rewind |Trailer|
|
||||
year: 2013
|
||||
Season 2018/s2018.e1029 - Jesse's Minecraft Server _ Teaser Trailer.jpg
|
||||
Season 2018/s2018.e1029 - Jesse's Minecraft Server _ Teaser Trailer-thumb.jpg
|
||||
Season 2018/s2018.e1029 - Jesse's Minecraft Server _ Teaser Trailer.mp4
|
||||
Season 2018/s2018.e1029 - Jesse's Minecraft Server _ Teaser Trailer.nfo
|
||||
NFO tags:
|
||||
|
|
@ -242,7 +242,7 @@ Season 2018/s2018.e1029 - Jesse's Minecraft Server _ Teaser Trailer.nfo
|
|||
season: 2018
|
||||
title: Jesse's Minecraft Server | Teaser Trailer
|
||||
year: 2018
|
||||
Season 2018/s2018.e1102 - Jesse's Minecraft Server _ IP mc.jesse.id.jpg
|
||||
Season 2018/s2018.e1102 - Jesse's Minecraft Server _ IP mc.jesse.id-thumb.jpg
|
||||
Season 2018/s2018.e1102 - Jesse's Minecraft Server _ IP mc.jesse.id.mp4
|
||||
Season 2018/s2018.e1102 - Jesse's Minecraft Server _ IP mc.jesse.id.nfo
|
||||
NFO tags:
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
Files created in 'FILL_IN'
|
||||
Files created in '{output_directory}'
|
||||
----------------------------------------
|
||||
.ytdl-sub-pz-download-archive.json
|
||||
fanart.jpg
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
Files created in 'FILL_IN'
|
||||
Files created in '{output_directory}'
|
||||
----------------------------------------
|
||||
.ytdl-sub-pz-download-archive.json
|
||||
Season 2018/s2018.e1029 - Jesse's Minecraft Server _ Teaser Trailer.jpg
|
||||
Season 2018/s2018.e1029 - Jesse's Minecraft Server _ Teaser Trailer-thumb.jpg
|
||||
Season 2018/s2018.e1029 - Jesse's Minecraft Server _ Teaser Trailer.mp4
|
||||
Season 2018/s2018.e1029 - Jesse's Minecraft Server _ Teaser Trailer.nfo
|
||||
NFO tags:
|
||||
|
|
@ -21,7 +21,7 @@ Season 2018/s2018.e1029 - Jesse's Minecraft Server _ Teaser Trailer.nfo
|
|||
season: 2018
|
||||
title: Jesse's Minecraft Server | Teaser Trailer
|
||||
year: 2018
|
||||
Season 2018/s2018.e1102 - Jesse's Minecraft Server _ IP mc.jesse.id.jpg
|
||||
Season 2018/s2018.e1102 - Jesse's Minecraft Server _ IP mc.jesse.id-thumb.jpg
|
||||
Season 2018/s2018.e1102 - Jesse's Minecraft Server _ IP mc.jesse.id.mp4
|
||||
Season 2018/s2018.e1102 - Jesse's Minecraft Server _ IP mc.jesse.id.nfo
|
||||
NFO tags:
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
Files created in 'FILL_IN'
|
||||
Files created in '{output_directory}'
|
||||
----------------------------------------
|
||||
JMC - Jesse's Minecraft Server.jpg
|
||||
JMC - Jesse's Minecraft Server-thumb.jpg
|
||||
JMC - Jesse's Minecraft Server.mkv
|
||||
Timestamps of playlist videos in the merged file:
|
||||
0:00: Jesse's Minecraft Server [Trailer - Feb.1]
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
Files created in 'FILL_IN'
|
||||
Files created in '{output_directory}'
|
||||
----------------------------------------
|
||||
.ytdl-sub-jmc-download-archive.json
|
||||
JMC - Jesse's Minecraft Server [Trailer - Feb.1].jpg
|
||||
JMC - Jesse's Minecraft Server [Trailer - Feb.1]-thumb.jpg
|
||||
JMC - Jesse's Minecraft Server [Trailer - Feb.1].mp4
|
||||
JMC - Jesse's Minecraft Server [Trailer - Feb.1].nfo
|
||||
NFO tags:
|
||||
|
|
@ -10,7 +10,7 @@ JMC - Jesse's Minecraft Server [Trailer - Feb.1].nfo
|
|||
artist: JMC
|
||||
title: Jesse's Minecraft Server [Trailer - Feb.1]
|
||||
year: 2011
|
||||
JMC - Jesse's Minecraft Server [Trailer - Feb.27].jpg
|
||||
JMC - Jesse's Minecraft Server [Trailer - Feb.27]-thumb.jpg
|
||||
JMC - Jesse's Minecraft Server [Trailer - Feb.27].mp4
|
||||
JMC - Jesse's Minecraft Server [Trailer - Feb.27].nfo
|
||||
NFO tags:
|
||||
|
|
@ -19,7 +19,7 @@ JMC - Jesse's Minecraft Server [Trailer - Feb.27].nfo
|
|||
artist: JMC
|
||||
title: Jesse's Minecraft Server [Trailer - Feb.27]
|
||||
year: 2011
|
||||
JMC - Jesse's Minecraft Server [Trailer - Mar.21].jpg
|
||||
JMC - Jesse's Minecraft Server [Trailer - Mar.21]-thumb.jpg
|
||||
JMC - Jesse's Minecraft Server [Trailer - Mar.21].mp4
|
||||
JMC - Jesse's Minecraft Server [Trailer - Mar.21].nfo
|
||||
NFO tags:
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
Files created in 'FILL_IN'
|
||||
Files created in '{output_directory}'
|
||||
----------------------------------------
|
||||
Project Zombie - 1-6.Intro.mp4
|
||||
0:00 - 0:10
|
||||
|
|
@ -12,7 +12,7 @@ Project Zombie - 5-6.Part 4.mp4
|
|||
0:40 - 1:01
|
||||
Project Zombie - 6-6.Part 5.mp4
|
||||
1:01 - 1:28
|
||||
Project Zombie - Intro.jpg
|
||||
Project Zombie - Intro-thumb.jpg
|
||||
Project Zombie - Intro.nfo
|
||||
NFO tags:
|
||||
musicvideo:
|
||||
|
|
@ -20,7 +20,7 @@ Project Zombie - Intro.nfo
|
|||
artist: Project Zombie
|
||||
title: Intro
|
||||
year: 2010
|
||||
Project Zombie - Part 1.jpg
|
||||
Project Zombie - Part 1-thumb.jpg
|
||||
Project Zombie - Part 1.nfo
|
||||
NFO tags:
|
||||
musicvideo:
|
||||
|
|
@ -28,7 +28,7 @@ Project Zombie - Part 1.nfo
|
|||
artist: Project Zombie
|
||||
title: Part 1
|
||||
year: 2010
|
||||
Project Zombie - Part 2.jpg
|
||||
Project Zombie - Part 2-thumb.jpg
|
||||
Project Zombie - Part 2.nfo
|
||||
NFO tags:
|
||||
musicvideo:
|
||||
|
|
@ -36,7 +36,7 @@ Project Zombie - Part 2.nfo
|
|||
artist: Project Zombie
|
||||
title: Part 2
|
||||
year: 2010
|
||||
Project Zombie - Part 3.jpg
|
||||
Project Zombie - Part 3-thumb.jpg
|
||||
Project Zombie - Part 3.nfo
|
||||
NFO tags:
|
||||
musicvideo:
|
||||
|
|
@ -44,7 +44,7 @@ Project Zombie - Part 3.nfo
|
|||
artist: Project Zombie
|
||||
title: Part 3
|
||||
year: 2010
|
||||
Project Zombie - Part 4.jpg
|
||||
Project Zombie - Part 4-thumb.jpg
|
||||
Project Zombie - Part 4.nfo
|
||||
NFO tags:
|
||||
musicvideo:
|
||||
|
|
@ -52,7 +52,7 @@ Project Zombie - Part 4.nfo
|
|||
artist: Project Zombie
|
||||
title: Part 4
|
||||
year: 2010
|
||||
Project Zombie - Part 5.jpg
|
||||
Project Zombie - Part 5-thumb.jpg
|
||||
Project Zombie - Part 5.nfo
|
||||
NFO tags:
|
||||
musicvideo:
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
Files created in 'FILL_IN'
|
||||
Files created in '{output_directory}'
|
||||
----------------------------------------
|
||||
JMC - Oblivion Mod 'Falcor' p.1.jpg
|
||||
JMC - Oblivion Mod 'Falcor' p.1-thumb.jpg
|
||||
JMC - Oblivion Mod 'Falcor' p.1.mp4
|
||||
JMC - Oblivion Mod 'Falcor' p.1.nfo
|
||||
NFO tags:
|
||||
|
|
@ -102,7 +102,7 @@ class TestSoundcloudDiscography:
|
|||
assert_transaction_log_matches(
|
||||
output_directory=output_directory,
|
||||
transaction_log=transaction_log,
|
||||
transaction_log_summary_file_name="test_soundcloud_discography.txt",
|
||||
transaction_log_summary_file_name="soundcloud/test_soundcloud_discography.txt",
|
||||
)
|
||||
if not dry_run:
|
||||
expected_discography_download.assert_files_exist(relative_directory=output_directory)
|
||||
|
|
|
|||
|
|
@ -301,7 +301,7 @@ class TestChannelAsKodiTvShow:
|
|||
assert_transaction_log_matches(
|
||||
output_directory=output_directory,
|
||||
transaction_log=transaction_log,
|
||||
transaction_log_summary_file_name="test_channel_full.txt",
|
||||
transaction_log_summary_file_name="youtube/test_channel_full.txt",
|
||||
)
|
||||
if not dry_run:
|
||||
expected_full_channel_download.assert_files_exist(relative_directory=output_directory)
|
||||
|
|
@ -318,7 +318,7 @@ class TestChannelAsKodiTvShow:
|
|||
assert_transaction_log_matches(
|
||||
output_directory=output_directory,
|
||||
transaction_log=transaction_log,
|
||||
transaction_log_summary_file_name="test_channel_recent.txt",
|
||||
transaction_log_summary_file_name="youtube/test_channel_recent.txt",
|
||||
)
|
||||
if not dry_run:
|
||||
expected_recent_channel_download.assert_files_exist(relative_directory=output_directory)
|
||||
|
|
@ -332,7 +332,9 @@ class TestChannelAsKodiTvShow:
|
|||
assert_transaction_log_matches(
|
||||
output_directory=output_directory,
|
||||
transaction_log=transaction_log,
|
||||
transaction_log_summary_file_name="test_channel_no_additional_downloads.txt",
|
||||
transaction_log_summary_file_name=(
|
||||
"youtube/test_channel_no_additional_downloads.txt"
|
||||
),
|
||||
)
|
||||
expected_recent_channel_download.assert_files_exist(
|
||||
relative_directory=output_directory
|
||||
|
|
@ -352,7 +354,7 @@ class TestChannelAsKodiTvShow:
|
|||
assert_transaction_log_matches(
|
||||
output_directory=output_directory,
|
||||
transaction_log=transaction_log,
|
||||
transaction_log_summary_file_name="test_channel_no_additional_downloads.txt",
|
||||
transaction_log_summary_file_name="youtube/test_channel_no_additional_downloads.txt",
|
||||
)
|
||||
if not dry_run:
|
||||
expected_recent_channel_no_vids_in_range_download.assert_files_exist(
|
||||
|
|
|
|||
|
|
@ -90,7 +90,7 @@ class TestYoutubeMergePlaylist:
|
|||
assert_transaction_log_matches(
|
||||
output_directory=output_directory,
|
||||
transaction_log=transaction_log,
|
||||
transaction_log_summary_file_name="test_merge_playlist.txt",
|
||||
transaction_log_summary_file_name="youtube/test_merge_playlist.txt",
|
||||
)
|
||||
|
||||
if not dry_run:
|
||||
|
|
|
|||
|
|
@ -144,7 +144,7 @@ class TestPlaylistAsKodiMusicVideo:
|
|||
assert_transaction_log_matches(
|
||||
output_directory=output_directory,
|
||||
transaction_log=transaction_log,
|
||||
transaction_log_summary_file_name="test_playlist.txt",
|
||||
transaction_log_summary_file_name="youtube/test_playlist.txt",
|
||||
)
|
||||
|
||||
if not dry_run:
|
||||
|
|
@ -166,7 +166,7 @@ class TestPlaylistAsKodiMusicVideo:
|
|||
assert_transaction_log_matches(
|
||||
output_directory=output_directory,
|
||||
transaction_log=transaction_log,
|
||||
transaction_log_summary_file_name="test_video.txt",
|
||||
transaction_log_summary_file_name="youtube/test_video.txt",
|
||||
)
|
||||
if not dry_run:
|
||||
expected_single_video_download.assert_files_exist(relative_directory=output_directory)
|
||||
|
|
|
|||
|
|
@ -129,7 +129,7 @@ class TestPlaylistAsKodiMusicVideo:
|
|||
assert_transaction_log_matches(
|
||||
output_directory=output_directory,
|
||||
transaction_log=transaction_log,
|
||||
transaction_log_summary_file_name="test_split_video.txt",
|
||||
transaction_log_summary_file_name="youtube/test_split_video.txt",
|
||||
)
|
||||
|
||||
if not dry_run:
|
||||
|
|
|
|||
Loading…
Reference in a new issue