Decide where the synced subtitles for ``srtin`` should be written. Overwriting the input takes precedence; otherwise, when subtitles were auto-detected from the reference, write a ` .synced.srt` next to each input; otherwise fall back to the explicit (possibly ``None``) output.
(args: argparse.Namespace, srtin: Optional[str])
| 102 | |
| 103 | |
| 104 | def _resolve_srtout(args: argparse.Namespace, srtin: Optional[str]) -> Optional[str]: |
| 105 | """Decide where the synced subtitles for ``srtin`` should be written. |
| 106 | |
| 107 | Overwriting the input takes precedence; otherwise, when subtitles were |
| 108 | auto-detected from the reference, write a `<name>.synced.srt` next to each |
| 109 | input; otherwise fall back to the explicit (possibly ``None``) output. |
| 110 | """ |
| 111 | if args.overwrite_input: |
| 112 | return srtin |
| 113 | if getattr(args, "auto_srtout", False) and srtin is not None: |
| 114 | return "{}.synced.srt".format(os.path.splitext(srtin)[0]) |
| 115 | return args.srtout |
| 116 | |
| 117 | |
| 118 | def get_srt_pipe_maker( |
no outgoing calls