You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: index.js
+63-62Lines changed: 63 additions & 62 deletions
Original file line number
Diff line number
Diff line change
@@ -4,68 +4,69 @@ const { program } = require("commander");
4
4
constOBSWebSocket=require("obs-websocket-js");
5
5
const{ version }=require("./package.json");
6
6
7
-
program
8
-
.option(
9
-
"-a, --address <address>",
10
-
"the address to the machine in which OBS is running and the port configured in OBS under Tools > WebSockets Server Settings",
11
-
"localhost:4444"
12
-
)
13
-
.option(
14
-
"-p, --password <password>",
15
-
"the password configured in OBS under Tools > WebSockets Server Settings"
16
-
)
17
-
.option(
18
-
"-f, --field <field>",
19
-
`project a field out of the OBS response, for example, given an OBS response of ‘[{ ..., "streaming": false, ...}]’ and a <field> of ‘0.streaming’, obs-cli outputs just ‘false’; this is a convenience for applications that need only one part of the response`
20
-
)
21
-
.arguments("<request[=arguments]...>")
22
-
.description("Remote control OBS from the command line.",{
23
-
"request[=arguments]": `a request name (for example, ‘GetRecordingFolder’), optionally followed by arguments (for example, ‘SetRecordingFolder='{ "rec-folder": "/tmp/" }'’) (see https://github.com/Palakis/obs-websocket/blob/4.x-current/docs/generated/protocol.md for the complete list of requests and their arguments)`,
24
-
})
25
-
.action(async(requestsStrings,{ address, password, field })=>{
26
-
letobs;
27
-
try{
28
-
constrequests=[];
29
-
for(constrequestofrequestsStrings){
30
-
constindex=request.indexOf("=");
31
-
if(index===-1)requests.push([request]);
32
-
else
33
-
requests.push([
34
-
request.slice(0,index),
35
-
JSON.parse(request.slice(index+1)),
36
-
]);
37
-
}
7
+
(async()=>{
8
+
awaitprogram
9
+
.option(
10
+
"-a, --address <address>",
11
+
"the address to the machine in which OBS is running and the port configured in OBS under Tools > WebSockets Server Settings",
12
+
"localhost:4444"
13
+
)
14
+
.option(
15
+
"-p, --password <password>",
16
+
"the password configured in OBS under Tools > WebSockets Server Settings"
17
+
)
18
+
.option(
19
+
"-f, --field <field>",
20
+
`project a field out of the OBS response, for example, given an OBS response of ‘[{ ..., "streaming": false, ...}]’ and a <field> of ‘0.streaming’, obs-cli outputs just ‘false’; this is a convenience for applications that need only one part of the response`
21
+
)
22
+
.arguments("<request[=arguments]...>")
23
+
.description("Remote control OBS from the command line.",{
24
+
"request[=arguments]": `a request name (for example, ‘GetRecordingFolder’), optionally followed by arguments (for example, ‘SetRecordingFolder='{ "rec-folder": "/tmp/" }'’) (see https://github.com/Palakis/obs-websocket/blob/4.x-current/docs/generated/protocol.md for the complete list of requests and their arguments)`,
25
+
})
26
+
.action(async(requestsStrings,{ address, password, field })=>{
0 commit comments