potentially working
This commit is contained in:
parent
94fc4b59e5
commit
4c4dfcc21f
6 changed files with 72 additions and 6 deletions
|
|
@ -122,7 +122,9 @@ def set_ffmpeg_metadata_chapters(
|
||||||
file_path,
|
file_path,
|
||||||
"-i",
|
"-i",
|
||||||
metadata_file.name,
|
metadata_file.name,
|
||||||
"-map_metadata",
|
"-map",
|
||||||
|
"0",
|
||||||
|
"-map_chapters",
|
||||||
"1",
|
"1",
|
||||||
"-bitexact", # for reproducibility
|
"-bitexact", # for reproducibility
|
||||||
"-codec",
|
"-codec",
|
||||||
|
|
@ -146,7 +148,7 @@ def add_ffmpeg_metadata_key_values(file_path: str, key_values: Dict[str, str]) -
|
||||||
file_path_ext = file_path.split(".")[-1]
|
file_path_ext = file_path.split(".")[-1]
|
||||||
output_file_path = f"{file_path}.out.{file_path_ext}"
|
output_file_path = f"{file_path}.out.{file_path_ext}"
|
||||||
|
|
||||||
ffmpeg_args = ["-i", file_path]
|
ffmpeg_args = ["-i", file_path, "-map", "0"]
|
||||||
for key, value in key_values.items():
|
for key, value in key_values.items():
|
||||||
ffmpeg_args.extend(["-metadata", f"{key}={value}"])
|
ffmpeg_args.extend(["-metadata", f"{key}={value}"])
|
||||||
ffmpeg_args.extend(["-codec", "copy", output_file_path])
|
ffmpeg_args.extend(["-codec", "copy", output_file_path])
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
import mergedeep
|
||||||
import pytest
|
import pytest
|
||||||
from e2e.expected_download import assert_expected_downloads
|
from e2e.expected_download import assert_expected_downloads
|
||||||
from e2e.expected_transaction_log import assert_transaction_log_matches
|
from e2e.expected_transaction_log import assert_transaction_log_matches
|
||||||
|
|
@ -85,3 +86,39 @@ class TestSubtitles:
|
||||||
dry_run=dry_run,
|
dry_run=dry_run,
|
||||||
expected_download_summary_file_name="plugins/test_subtitles_embedded_and_file.json",
|
expected_download_summary_file_name="plugins/test_subtitles_embedded_and_file.json",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@pytest.mark.parametrize("dry_run", [True, False])
|
||||||
|
def test_subtitles_chapters_tags_embedded(
|
||||||
|
self,
|
||||||
|
music_video_config,
|
||||||
|
timestamps_file_path,
|
||||||
|
single_video_subs_embed_preset_dict,
|
||||||
|
output_directory,
|
||||||
|
dry_run,
|
||||||
|
):
|
||||||
|
# Test chapters and video tags in addition to subtitles
|
||||||
|
mergedeep.merge(
|
||||||
|
single_video_subs_embed_preset_dict,
|
||||||
|
{
|
||||||
|
"youtube": {"chapter_timestamps": timestamps_file_path},
|
||||||
|
"video_tags": {"tags": {"title": "{title}"}},
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
|
subscription = Subscription.from_dict(
|
||||||
|
config=music_video_config,
|
||||||
|
preset_name="subtitles_embedded_test",
|
||||||
|
preset_dict=single_video_subs_embed_preset_dict,
|
||||||
|
)
|
||||||
|
|
||||||
|
transaction_log = subscription.download(dry_run=dry_run)
|
||||||
|
assert_transaction_log_matches(
|
||||||
|
output_directory=output_directory,
|
||||||
|
transaction_log=transaction_log,
|
||||||
|
transaction_log_summary_file_name="plugins/test_subtitles_tags_chapters.txt",
|
||||||
|
)
|
||||||
|
assert_expected_downloads(
|
||||||
|
output_directory=output_directory,
|
||||||
|
dry_run=dry_run,
|
||||||
|
expected_download_summary_file_name="plugins/test_subtitles_tags_chapters.json",
|
||||||
|
)
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
"JMC - YouTube Rewind 2019: For the Record | #YouTubeRewind-thumb.jpg": "704246dd78074e8a0ec001dd8d03fd60",
|
||||||
|
"JMC - YouTube Rewind 2019: For the Record | #YouTubeRewind.mp4": "e2e60d3e3ff7739d071aa953642980af",
|
||||||
|
"JMC - YouTube Rewind 2019: For the Record | #YouTubeRewind.nfo": "ffa10f1cbc098ace7b1c7a8fbe3097a8"
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,21 @@
|
||||||
|
Files created in '{output_directory}'
|
||||||
|
----------------------------------------
|
||||||
|
JMC - YouTube Rewind 2019: For the Record | #YouTubeRewind-thumb.jpg
|
||||||
|
JMC - YouTube Rewind 2019: For the Record | #YouTubeRewind.mp4
|
||||||
|
Chapters embedded into the video:
|
||||||
|
0:00: Intro
|
||||||
|
0:10: Part 1
|
||||||
|
0:20: Part 2
|
||||||
|
0:30: Part 3
|
||||||
|
0:40: Part 4
|
||||||
|
1:01: Part 5
|
||||||
|
Embedded subtitles with lang(s) en, de
|
||||||
|
Video Tags:
|
||||||
|
title: YouTube Rewind 2019: For the Record | #YouTubeRewind
|
||||||
|
JMC - YouTube Rewind 2019: For the Record | #YouTubeRewind.nfo
|
||||||
|
NFO tags:
|
||||||
|
musicvideo:
|
||||||
|
album: Music Videos
|
||||||
|
artist: JMC
|
||||||
|
title: YouTube Rewind 2019: For the Record | #YouTubeRewind
|
||||||
|
year: 2019
|
||||||
|
|
@ -9,6 +9,11 @@ JMC - Oblivion Mod "Falcor" p.1.mp4
|
||||||
0:30: Part 3
|
0:30: Part 3
|
||||||
0:40: Part 4
|
0:40: Part 4
|
||||||
1:01: Part 5
|
1:01: Part 5
|
||||||
|
Video Tags:
|
||||||
|
description:
|
||||||
|
🎸 / ' "
|
||||||
|
newline?
|
||||||
|
title: Oblivion Mod "Falcor" p.1
|
||||||
JMC - Oblivion Mod "Falcor" p.1.nfo
|
JMC - Oblivion Mod "Falcor" p.1.nfo
|
||||||
NFO tags:
|
NFO tags:
|
||||||
musicvideo:
|
musicvideo:
|
||||||
|
|
|
||||||
|
|
@ -53,13 +53,11 @@ class TestYoutubeVideo:
|
||||||
output_directory=output_directory,
|
output_directory=output_directory,
|
||||||
transaction_log=transaction_log,
|
transaction_log=transaction_log,
|
||||||
transaction_log_summary_file_name="youtube/test_video.txt",
|
transaction_log_summary_file_name="youtube/test_video.txt",
|
||||||
regenerate_transaction_log=True,
|
|
||||||
)
|
)
|
||||||
assert_expected_downloads(
|
assert_expected_downloads(
|
||||||
output_directory=output_directory,
|
output_directory=output_directory,
|
||||||
dry_run=dry_run,
|
dry_run=dry_run,
|
||||||
expected_download_summary_file_name="youtube/test_video.json",
|
expected_download_summary_file_name="youtube/test_video.json",
|
||||||
regenerate_expected_download_summary=True,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
@pytest.mark.parametrize("dry_run", [True, False])
|
@pytest.mark.parametrize("dry_run", [True, False])
|
||||||
|
|
@ -113,11 +111,9 @@ class TestYoutubeVideo:
|
||||||
output_directory=output_directory,
|
output_directory=output_directory,
|
||||||
transaction_log=transaction_log,
|
transaction_log=transaction_log,
|
||||||
transaction_log_summary_file_name="youtube/test_video_with_chapter_timestamps.txt",
|
transaction_log_summary_file_name="youtube/test_video_with_chapter_timestamps.txt",
|
||||||
regenerate_transaction_log=True,
|
|
||||||
)
|
)
|
||||||
assert_expected_downloads(
|
assert_expected_downloads(
|
||||||
output_directory=output_directory,
|
output_directory=output_directory,
|
||||||
dry_run=dry_run,
|
dry_run=dry_run,
|
||||||
expected_download_summary_file_name="youtube/test_video_with_chapter_timestamps.json",
|
expected_download_summary_file_name="youtube/test_video_with_chapter_timestamps.json",
|
||||||
regenerate_expected_download_summary=True,
|
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue