Check that the CLI arguments passed to autosub are valid.
(args)
| 319 | |
| 320 | |
| 321 | def validate(args): |
| 322 | """ |
| 323 | Check that the CLI arguments passed to autosub are valid. |
| 324 | """ |
| 325 | if args.format not in FORMATTERS: |
| 326 | print( |
| 327 | "Subtitle format not supported. " |
| 328 | "Run with --list-formats to see all supported formats." |
| 329 | ) |
| 330 | return False |
| 331 | |
| 332 | if args.src_language not in LANGUAGE_CODES.keys(): |
| 333 | print( |
| 334 | "Source language not supported. " |
| 335 | "Run with --list-languages to see all supported languages." |
| 336 | ) |
| 337 | return False |
| 338 | |
| 339 | if args.dst_language not in LANGUAGE_CODES.keys(): |
| 340 | print( |
| 341 | "Destination language not supported. " |
| 342 | "Run with --list-languages to see all supported languages." |
| 343 | ) |
| 344 | return False |
| 345 | |
| 346 | if not args.source_path: |
| 347 | print("Error: You need to specify a source path.") |
| 348 | return False |
| 349 | |
| 350 | return True |
| 351 | |
| 352 | |
| 353 | def main(): |