working
This commit is contained in:
parent
41cef6af3e
commit
7cb2df9d09
6 changed files with 30 additions and 20 deletions
|
|
@ -23,9 +23,11 @@ class Entry(EntryVariables, BaseEntry):
|
|||
This is not reflected in the entry. See if the mkv file exists and return "mkv" if so,
|
||||
otherwise, return the original extension.
|
||||
"""
|
||||
mkv_file_path = str(Path(self.working_directory()) / f"{self.uid}.mkv")
|
||||
if os.path.isfile(mkv_file_path):
|
||||
return "mkv"
|
||||
for possible_ext in [super().ext, "mkv"]:
|
||||
file_path = str(Path(self.working_directory()) / f"{self.uid}.{possible_ext}")
|
||||
if os.path.isfile(file_path):
|
||||
return possible_ext
|
||||
|
||||
return super().ext
|
||||
|
||||
def get_download_file_name(self) -> str:
|
||||
|
|
|
|||
|
|
@ -116,15 +116,17 @@ class FileConvertPlugin(Plugin[FileConvertOptions]):
|
|||
-------
|
||||
ffmpeg video remuxing post processing dict
|
||||
"""
|
||||
return {
|
||||
"postprocessors": [
|
||||
{
|
||||
"key": "FFmpegVideoRemuxer",
|
||||
"when": "post_process",
|
||||
"preferedformat": self.plugin_options.convert_to,
|
||||
}
|
||||
]
|
||||
}
|
||||
if self.plugin_options.convert_with == "yt-dlp":
|
||||
return {
|
||||
"postprocessors": [
|
||||
{
|
||||
"key": "FFmpegVideoRemuxer",
|
||||
"when": "post_process",
|
||||
"preferedformat": self.plugin_options.convert_to,
|
||||
}
|
||||
]
|
||||
}
|
||||
return None
|
||||
|
||||
def modify_entry(self, entry: Entry) -> Optional[Entry]:
|
||||
"""
|
||||
|
|
@ -144,7 +146,10 @@ class FileConvertPlugin(Plugin[FileConvertOptions]):
|
|||
ValidationException
|
||||
User ffmpeg arguments errored
|
||||
"""
|
||||
# Get original_ext here since there is mkv/yt-dlp shenanigans
|
||||
original_ext = entry.ext
|
||||
new_ext = self.plugin_options.convert_to
|
||||
|
||||
input_video_file_path = entry.get_download_file_path()
|
||||
converted_video_file_path = entry.get_download_file_path().removesuffix(entry.ext) + new_ext
|
||||
|
||||
|
|
@ -157,9 +162,7 @@ class FileConvertPlugin(Plugin[FileConvertOptions]):
|
|||
raise FileNotDownloadedException("Failed to find the input file")
|
||||
|
||||
if self.plugin_options.ffmpeg_post_process_args:
|
||||
tmp_output_file = (
|
||||
converted_video_file_path.removesuffix(new_ext) + f".tmp.{new_ext}"
|
||||
)
|
||||
tmp_output_file = converted_video_file_path.removesuffix(new_ext) + f"tmp.{new_ext}"
|
||||
ffmpeg_args_list = self.overrides.apply_formatter(
|
||||
self.plugin_options.ffmpeg_post_process_args
|
||||
).split()
|
||||
|
|
@ -177,11 +180,13 @@ class FileConvertPlugin(Plugin[FileConvertOptions]):
|
|||
)
|
||||
|
||||
FileHandler.move(tmp_output_file, converted_video_file_path)
|
||||
FileHandler.delete(tmp_output_file)
|
||||
FileHandler.delete(input_video_file_path)
|
||||
|
||||
if entry.ext != new_ext:
|
||||
if original_ext != new_ext:
|
||||
entry.add_kwargs(
|
||||
{
|
||||
"__converted_from": entry.ext,
|
||||
"__converted_from": original_ext,
|
||||
}
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ class TestFileConvert:
|
|||
"file_convert": {
|
||||
"convert_to": "mkv",
|
||||
"convert_with": "ffmpeg",
|
||||
"ffmpeg_post_process_args": "-vcodec copy -acodec copy -scodec mov_text",
|
||||
"ffmpeg_post_process_args": "-bitexact -vcodec copy -acodec copy -scodec mov_text",
|
||||
}
|
||||
},
|
||||
)
|
||||
|
|
|
|||
|
|
@ -47,6 +47,8 @@ def assert_transaction_log_matches(
|
|||
# Split, ensure there are the same number of new lines
|
||||
summary_lines: List[str] = summary.split("\n")
|
||||
expected_summary_lines: List[str] = expected_summary.split("\n")
|
||||
print(summary_lines)
|
||||
print(expected_summary_lines)
|
||||
assert len(summary_lines) == len(
|
||||
expected_summary_lines
|
||||
), f"Summary number of lines differ: {len(summary_lines) != len(expected_summary_lines)}"
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
".ytdl-sub-file_convert_test-download-archive.json": "74813dccf4e9732e49f5dc3c2d66f3be",
|
||||
"Beyond The Guitar/Beyond The Guitar - When you hear Hugh Jackman is returning as Wolverine in Deadpool 3-thumb.jpg": "662fcaadf6e80d63591bac19a5fdffb0",
|
||||
"Beyond The Guitar/Beyond The Guitar - When you hear Hugh Jackman is returning as Wolverine in Deadpool 3.info.json": "29118ff7fad058437325513f60649dc8",
|
||||
"Beyond The Guitar/Beyond The Guitar - When you hear Hugh Jackman is returning as Wolverine in Deadpool 3.mkv": "91b167c199a33cb6b6746506f135741f",
|
||||
"Beyond The Guitar/Beyond The Guitar - When you hear Hugh Jackman is returning as Wolverine in Deadpool 3.info.json": "3022131504a9df5d2fce266fada1ee3b",
|
||||
"Beyond The Guitar/Beyond The Guitar - When you hear Hugh Jackman is returning as Wolverine in Deadpool 3.mkv": "b5f248b560f89f3f2a83fcdcd197d486",
|
||||
"Beyond The Guitar/Beyond The Guitar - When you hear Hugh Jackman is returning as Wolverine in Deadpool 3.nfo": "cacf09ab38f9b3085da9c5af516cf22a"
|
||||
}
|
||||
|
|
@ -6,6 +6,7 @@ Files created:
|
|||
Beyond The Guitar - When you hear Hugh Jackman is returning as Wolverine in Deadpool 3-thumb.jpg
|
||||
Beyond The Guitar - When you hear Hugh Jackman is returning as Wolverine in Deadpool 3.info.json
|
||||
Beyond The Guitar - When you hear Hugh Jackman is returning as Wolverine in Deadpool 3.mkv
|
||||
Converted from webm
|
||||
Beyond The Guitar - When you hear Hugh Jackman is returning as Wolverine in Deadpool 3.nfo
|
||||
NFO tags:
|
||||
musicvideo:
|
||||
|
|
|
|||
Loading…
Reference in a new issue