-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[DEV] Custom ffmpeg unit test (#1076)
- Loading branch information
Showing
5 changed files
with
162 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
tests/resources/expected_downloads_summaries/plugins/file_convert/custom_ffmpeg_args.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
".ytdl-sub-subscription_test-download-archive.json": "19cf39d57914ba9cbd1e57ba6f1e0683", | ||
"JMC/Mock Entry 20-1.info.json": "INFO_JSON", | ||
"JMC/Mock Entry 20-1.jpg": "e80c508c4818454300133fe1dc1a9cd7", | ||
"JMC/Mock Entry 20-1.mkv": "1514f89a141f7b5ee3fdde9a70e63f57", | ||
"JMC/Mock Entry 20-1.nfo": "fefcf0b3e4f4ff80ad636584d50dadec", | ||
"JMC/Mock Entry 20-2.info.json": "INFO_JSON", | ||
"JMC/Mock Entry 20-2.jpg": "e80c508c4818454300133fe1dc1a9cd7", | ||
"JMC/Mock Entry 20-2.mkv": "da089645cc944fdb411ecc46facfe9f6", | ||
"JMC/Mock Entry 20-2.nfo": "025c0b631da5ff5470382b38fce78d2d", | ||
"JMC/Mock Entry 20-3.info.json": "INFO_JSON", | ||
"JMC/Mock Entry 20-3.jpg": "e80c508c4818454300133fe1dc1a9cd7", | ||
"JMC/Mock Entry 20-3.mkv": "5dbae183aa57c4062af9d5a2e0e0f8fe", | ||
"JMC/Mock Entry 20-3.nfo": "618b0ff948d9de2e10cf1da8c0dd6615", | ||
"JMC/Mock Entry 21-1.info.json": "INFO_JSON", | ||
"JMC/Mock Entry 21-1.jpg": "e80c508c4818454300133fe1dc1a9cd7", | ||
"JMC/Mock Entry 21-1.mkv": "61910bf74a0175fbdf595095109d1a1c", | ||
"JMC/Mock Entry 21-1.nfo": "e5c715749efc1603a6e2f59244d87aba" | ||
} |
81 changes: 81 additions & 0 deletions
81
tests/resources/transaction_log_summaries/plugins/file_convert/custom_ffmpeg_args.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
Files created: | ||
---------------------------------------- | ||
{output_directory} | ||
.ytdl-sub-subscription_test-download-archive.json | ||
{output_directory}/JMC | ||
Mock Entry 20-1.info.json | ||
Mock Entry 20-1.jpg | ||
Mock Entry 20-1.mkv | ||
Converted from mp4 | ||
Video Tags: | ||
album: Music Videos | ||
artist: JMC | ||
genre: ytdl-sub | ||
premiered: 2020-08-08 | ||
title: Mock Entry 20-1 | ||
year: 2020 | ||
Mock Entry 20-1.nfo | ||
NFO tags: | ||
musicvideo: | ||
album: Music Videos | ||
artist: JMC | ||
genre: ytdl-sub | ||
premiered: 2020-08-08 | ||
title: Mock Entry 20-1 | ||
Mock Entry 20-2.info.json | ||
Mock Entry 20-2.jpg | ||
Mock Entry 20-2.mkv | ||
Converted from mp4 | ||
Video Tags: | ||
album: Music Videos | ||
artist: JMC | ||
genre: ytdl-sub | ||
premiered: 2020-08-08 | ||
title: Mock Entry 20-2 | ||
year: 2020 | ||
Mock Entry 20-2.nfo | ||
NFO tags: | ||
musicvideo: | ||
album: Music Videos | ||
artist: JMC | ||
genre: ytdl-sub | ||
premiered: 2020-08-08 | ||
title: Mock Entry 20-2 | ||
Mock Entry 20-3.info.json | ||
Mock Entry 20-3.jpg | ||
Mock Entry 20-3.mkv | ||
Converted from mp4 | ||
Video Tags: | ||
album: Music Videos | ||
artist: JMC | ||
genre: ytdl-sub | ||
premiered: 2020-08-07 | ||
title: Mock Entry 20-3 | ||
year: 2020 | ||
Mock Entry 20-3.nfo | ||
NFO tags: | ||
musicvideo: | ||
album: Music Videos | ||
artist: JMC | ||
genre: ytdl-sub | ||
premiered: 2020-08-07 | ||
title: Mock Entry 20-3 | ||
Mock Entry 21-1.info.json | ||
Mock Entry 21-1.jpg | ||
Mock Entry 21-1.mkv | ||
Converted from mp4 | ||
Video Tags: | ||
album: Music Videos | ||
artist: JMC | ||
genre: ytdl-sub | ||
premiered: 2021-08-08 | ||
title: Mock Entry 21-1 | ||
year: 2021 | ||
Mock Entry 21-1.nfo | ||
NFO tags: | ||
musicvideo: | ||
album: Music Videos | ||
artist: JMC | ||
genre: ytdl-sub | ||
premiered: 2021-08-08 | ||
title: Mock Entry 21-1 |
24 changes: 0 additions & 24 deletions
24
tests/resources/transaction_log_summaries/plugins/file_convert/output_custom_ffmpeg.txt
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
from typing import Dict | ||
|
||
import pytest | ||
from expected_download import assert_expected_downloads | ||
from expected_transaction_log import assert_transaction_log_matches | ||
|
||
from ytdl_sub.entries.entry import ytdl_sub_chapters_from_comments | ||
from ytdl_sub.subscriptions.subscription import Subscription | ||
|
||
|
||
@pytest.fixture | ||
def file_convert_subscription_dict(output_directory) -> Dict: | ||
return { | ||
"preset": "Jellyfin Music Videos", | ||
"output_options": {"output_directory": output_directory}, | ||
"overrides": { | ||
"music_video_artist": "JMC", | ||
"url": "https://your.name.here", | ||
}, | ||
"file_convert": { | ||
"convert_to": "mkv", | ||
"convert_with": "ffmpeg", | ||
"ffmpeg_post_process_args": "-bitexact -vcodec copy -acodec copy -scodec mov_text", | ||
}, | ||
} | ||
|
||
|
||
class TestChapters: | ||
@pytest.mark.parametrize("dry_run", [True, False]) | ||
def test_file_convert_custom_args( | ||
self, | ||
config, | ||
subscription_name, | ||
file_convert_subscription_dict, | ||
output_directory, | ||
mock_download_collection_entries, | ||
dry_run, | ||
): | ||
subscription = Subscription.from_dict( | ||
config=config, | ||
preset_name=subscription_name, | ||
preset_dict=file_convert_subscription_dict, | ||
) | ||
|
||
with mock_download_collection_entries( | ||
is_youtube_channel=False, | ||
num_urls=1, | ||
is_extracted_audio=False, | ||
is_dry_run=dry_run, | ||
): | ||
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=f"plugins/file_convert/custom_ffmpeg_args.txt", | ||
) | ||
assert_expected_downloads( | ||
output_directory=output_directory, | ||
dry_run=dry_run, | ||
expected_download_summary_file_name="plugins/file_convert/custom_ffmpeg_args.json", | ||
) |