]>
Commit | Line | Data |
---|---|---|
1 | /* | |
2 | Copyright (C) 2024 Rubén Beltrán del Río | |
3 | ||
4 | This program is free software: you can redistribute it and/or modify | |
5 | it under the terms of the GNU General Public License as published by | |
6 | the Free Software Foundation, either version 3 of the License, or | |
7 | (at your option) any later version. | |
8 | ||
9 | This program is distributed in the hope that it will be useful, | |
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | GNU General Public License for more details. | |
13 | ||
14 | You should have received a copy of the GNU General Public License | |
15 | along with this program. If not, see https://captura.tranquil.systems. | |
16 | */ | |
17 | import Foundation | |
18 | ||
19 | @objc(ConfigureCommand) | |
20 | class ConfigureCommand: NSScriptCommand { | |
21 | override func performDefaultImplementation() -> Any? { | |
22 | ||
23 | let args = self.directParameter as? [String: Any] ?? [:] | |
24 | ||
25 | // Here you can extract the parameters from the args dictionary and configure your settings | |
26 | let fps = args["fps"] as? Int | |
27 | let outputs = OutputFormatSetting(args["outputs"] as? String ?? "") | |
28 | let backend = URL(string: args["backend"] as? String ?? "") | |
29 | let backendOutput = OutputFormatSetting(args["backend_output"] as? String ?? "") | |
30 | let keepLocalFiles = args["keep_local_files"] as? Bool | |
31 | ||
32 | let config = ConfigureAction( | |
33 | action: "configure", | |
34 | fps: fps, | |
35 | outputs: outputs, | |
36 | backend: backend, | |
37 | backendOutput: backendOutput, | |
38 | keepLocalFiles: keepLocalFiles | |
39 | ) | |
40 | ||
41 | NotificationCenter.default.post( | |
42 | name: .setConfiguration, object: nil, | |
43 | userInfo: [ | |
44 | "config": config | |
45 | ]) | |
46 | NotificationCenter.default.post(name: .reloadConfiguration, object: nil, userInfo: nil) | |
47 | ||
48 | // Return a result if needed | |
49 | return nil | |
50 | } | |
51 | } |