-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathobs-utils.js
78 lines (66 loc) · 1.71 KB
/
obs-utils.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
import * as fs from 'fs';
export async function start_recording(obs)
{
await obs.call('StartRecord');
}
export async function stop_recording(obs)
{
await obs.call('StopRecord')
}
export async function set_scene(obs, sceneName)
{
await obs.call('SetCurrentProgramScene', {sceneName: sceneName})
}
export async function get_output_folder(obs)
{
return (await obs.call('GetRecordDirectory')).recordDirectory
}
export async function set_output_folder(obs, folderPath)
{
fs.mkdirSync(folderPath, {recursive: true})
await obs.call('SetRecordDirectory', {recordDirectory: folderPath})
}
export async function get_output_filename(obs)
{
return (await obs.call('GetProfileParameter',
{
parameterCategory: 'Output',
parameterName: 'FilenameFormatting'
})).parameterValue;
}
export async function set_output_filename(obs, fileName)
{
await obs.call('SetProfileParameter',
{
parameterCategory: 'Output',
parameterName: 'FilenameFormatting',
parameterValue: fileName
})
}
export async function validate_scenes(obs)
{
let scenes = (await obs.call('GetSceneList')).scenes
let found_slippi = false;
let found_ddr = false;
for (let i = 0; i < scenes.length; i++)
{
if (scenes[i].sceneName == 'slippi')
{
found_slippi = true;
}
if (scenes[i].sceneName == 'ddr')
{
found_ddr = true;
}
}
if (!found_ddr)
{
console.error('No scene in OBS named "ddr"');
throw new Error("Unable to record arrows");
}
if (!found_slippi)
{
console.error('No scene in OBS named "slippi"');
throw new Error("Unable to record slippi");
}
}