Repository navigation
Check config files for bad settings, and explain unreadable input files - #142
Merged
Merged
Conversation
Merged
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Closes #141.
Config files
A config file's values become argparse defaults, and argparse never checks defaults against
choicesor flags unknown keys. So{"codec": "libvpx-vp9"}(the README's own example) ran raw libvpx without thevp9speed settings, and a typo like{"target-filesize": 20}crashed with aTypeErrortraceback._check_config()inarguments.pynow checks each config file as it loads (the default one,--config, and any file a config points to) and stops withparser.error():config.json has an unknown setting 'target-filesize'. Did you mean 'target_filesize'?config.json: argument -c/--codec: invalid choice: 'libvpx-vp9' (choose from 'x264', ...)The
configkey is still allowed. The message shows the file's full path, so it's clear which file to fix when the default config is the culprit.Unreadable input files
ff4d nope.mp4used to end in a rawffmpeg._run.Error: ffprobe errortraceback.main()now catchesffmpeg.ErrorfromTwoPass(path)and logs ffprobe's last stderr line, which names the file and the problem:/clips/nope.mp4: No such file or directory/clips/notes.mp4: Invalid data found when processing input/clips: Is a directoryREADME
"codec": "vp9".pyproject.toml.--no-configexample (no---config).Tests
test_arguments.py: unknown key, invalid codec, and a bad value in a nested config (the message names the inner file). Replaced the test that expected unknown keys to pass through, and changed a"vp9-speed"codec that's no longer accepted to"vp9".test_main.py: an ffprobe error exits 1 with the stderr reason, or a fallback message when stderr is empty.