Add Support for Ignoring Warnings in mux
Method
#51
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Context
According to MKVToolNix's documentation, the exit codes are as follows:
0
: Muxing completed successfully.1
: Muxing completed with at least one warning. The user is urged to review the warning and resulting file.2
: An error occurred, and mkvmerge aborted.In my recently usage, I found some media resource failed to mux with exit code 1, and never has a detailed error message.
pymkv2/pymkv/MKVFile.py
Line 407 in a640ffb
I extracted the command line for the task and ran it directly in PowerShell with no errors. Whereas subprocess must return exit code 1 which in turn causes pymkv to raise an error and end the task prematurely, the fact is that there is nothing wrong with the output. So I decide to ignore the warning.
What's Changed
Previously, the mux method raised an exception for any non-zero exit code, including warnings. This behavior was overly restrictive for scenarios where warnings are acceptable, prompting the need for a more flexible implementation.
In this PR, when
ignore_warning
is set to True and mkvmerge exits with code 1 (warnings), the method will:For exit codes other than 0 or 1, the method raises a ValueError with detailed error output.
ignore_warning
is set as False in default.