29
29
30
30
31
31
def set_output (
32
- out : str | None , _export : str | None , path : Path | None , log : Log
33
- ) -> tuple [str , dict [ str , Any ] ]:
32
+ out : str | None , export : str | None , path : Path | None , log : Log
33
+ ) -> tuple [str , str ]:
34
34
if out is None or out == "-" :
35
35
if path is None :
36
36
log .error ("`--output` must be set." ) # When a timeline file is the input.
@@ -42,33 +42,31 @@ def set_output(
42
42
# Use `mp4` as the default, because it is most compatible.
43
43
ext = ".mp4" if path is None else path .suffix
44
44
45
- export : dict [str , Any ]
46
- if _export is None :
45
+ if export is None :
47
46
match ext :
48
47
case ".xml" :
49
- export = { "export" : " premiere"}
48
+ export = " premiere"
50
49
case ".fcpxml" :
51
- export = { "export" : " final-cut-pro"}
50
+ export = " final-cut-pro"
52
51
case ".mlt" :
53
- export = { "export" : " shotcut"}
52
+ export = " shotcut"
54
53
case ".json" | ".v1" :
55
- export = { "export" : " v1"}
54
+ export = " v1"
56
55
case ".v3" :
57
- export = { "export" : " v3"}
56
+ export = " v3"
58
57
case _:
59
- export = {"export" : "default" }
60
- else :
61
- export = parse_export (_export , log )
58
+ export = "default"
62
59
63
- match export [ "export" ] :
60
+ match export :
64
61
case "premiere" | "resolve-fcp7" :
65
62
ext = ".xml"
66
63
case "final-cut-pro" | "resolve" :
67
64
ext = ".fcpxml"
68
65
case "shotcut" :
69
66
ext = ".mlt"
70
67
case "v1" :
71
- ext = ".v1"
68
+ if ext != ".json" :
69
+ ext = ".v1"
72
70
case "v3" :
73
71
ext = ".v3"
74
72
@@ -186,9 +184,13 @@ def edit_media(paths: list[str], args: Args, log: Log) -> None:
186
184
src = sources [0 ]
187
185
use_path = src .path
188
186
189
- output , export_ops = set_output (args .output , args .export , use_path , log )
190
- assert "export" in export_ops
191
- export = export_ops ["export" ]
187
+ if args .export is None :
188
+ output , export = set_output (args .output , args .export , use_path , log )
189
+ export_ops : dict [str , Any ] = {"export" : export }
190
+ else :
191
+ export_ops = parse_export (args .export , log )
192
+ export = export_ops ["export" ]
193
+ output , _ = set_output (args .output , export , use_path , log )
192
194
193
195
if output == "-" :
194
196
# When printing to stdout, silence all logs.
0 commit comments