Validates that the proper tool is available on the system to perform the `split-video` command. Arguments: use_mkvmerge: True if mkvmerge (-m), False otherwise. Raises: click.BadParameter if the proper video splitting tool cannot be found.
(use_mkvmerge: bool)
| 46 | |
| 47 | |
| 48 | def check_split_video_requirements(use_mkvmerge: bool) -> None: |
| 49 | """Validates that the proper tool is available on the system to perform the |
| 50 | `split-video` command. |
| 51 | |
| 52 | Arguments: |
| 53 | use_mkvmerge: True if mkvmerge (-m), False otherwise. |
| 54 | |
| 55 | Raises: click.BadParameter if the proper video splitting tool cannot be found. |
| 56 | """ |
| 57 | |
| 58 | if (use_mkvmerge and not is_mkvmerge_available()) or not is_ffmpeg_available(): |
| 59 | error_strs = [ |
| 60 | "{EXTERN_TOOL} is required for split-video{EXTRA_ARGS}.".format( |
| 61 | EXTERN_TOOL="mkvmerge" if use_mkvmerge else "ffmpeg", |
| 62 | EXTRA_ARGS=" when mkvmerge (-m) is set" if use_mkvmerge else "", |
| 63 | ) |
| 64 | ] |
| 65 | error_strs += ["Ensure the program is available on your system and try again."] |
| 66 | if not use_mkvmerge and is_mkvmerge_available(): |
| 67 | error_strs += ["You can specify mkvmerge (-m) to use mkvmerge for splitting."] |
| 68 | elif use_mkvmerge and is_ffmpeg_available(): |
| 69 | error_strs += ["You can specify copy (-c) to use ffmpeg stream copying."] |
| 70 | error_str = "\n".join(error_strs) |
| 71 | raise click.BadParameter(error_str, param_hint="split-video") |
| 72 | |
| 73 | |
| 74 | class CliContext: |
no test coverage detected