Skip to content

Commit

Permalink
remove extra messages from mkv error
Browse files Browse the repository at this point in the history
  • Loading branch information
cbusillo committed Jun 14, 2024
1 parent 2291676 commit 21cfb42
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
11 changes: 11 additions & 0 deletions bd_to_avp/modules/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,17 @@ class Config:
"video frame timecode differs",
"secondary stream video frame timecode differs",
]
MKV_ERROR_FILTERS = [
"which is less than minimum title length",
"Debug logging",
"AnyDVD",
"Do you want to continue anyway",
"MakeMKV",
"Do you want to continue anyway",
"AACS directory not present",
"Evaluation version",
"Using direct disc access mode",
]

MAKEMKVCON_PATH = Path("/Applications/MakeMKV.app/Contents/MacOS/makemkvcon")
SCRIPT_PATH = Path(__file__).parent.parent
Expand Down
13 changes: 12 additions & 1 deletion bd_to_avp/modules/disc.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,18 @@ def rip_disc_to_mkv(output_folder: Path, disc_info: DiscInfo, language_code: str
mkv_output = run_command(command, "Rip disc to MKV file.")
if config.continue_on_error or all(error not in mkv_output for error in config.MKV_ERROR_CODES):
return
raise MKVCreationError(f"Error occurred while ripping disc to MKV.\n\n{mkv_output}")
filtered_output = filter_lines_from_output(mkv_output, config.MKV_ERROR_FILTERS)

raise MKVCreationError(f"Error occurred while ripping disc to MKV.\n\n{filtered_output}")


def filter_lines_from_output(output: str, filter_strings: list[str]) -> str:
output_lines = output.splitlines()
filtered_output = ""
for line in output_lines:
if not any(filter_string in line for filter_string in filter_strings):
filtered_output += line + "\n"
return filtered_output


def create_custom_makemkv_profile(custom_profile_path: Path, language_code: str) -> None:
Expand Down

0 comments on commit 21cfb42

Please sign in to comment.