]> git.r.bdr.sh - rbdr/captura/blame - Captura/Scripting/ConfigureCommand.swift
Add license and contributing
[rbdr/captura] / Captura / Scripting / ConfigureCommand.swift
CommitLineData
5802c153
RBR
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 */
e42019cd
RBR
17import Foundation
18
19@objc(ConfigureCommand)
20class 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(name: .setConfiguration, object: nil, userInfo: [
42 "config": config
43 ])
44 NotificationCenter.default.post(name: .reloadConfiguration, object: nil, userInfo: nil)
45
46 // Return a result if needed
47 return nil
48 }
49}