Repository navigation
Expand file tree
/
Copy pathlp.js
More file actions
115 lines (106 loc) · 3.72 KB
/
Copy pathlp.js
File metadata and controls
115 lines (106 loc) · 3.72 KB
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
const { obsScene, back } = require('../lib/actions');
const { repeat } = require('../lib/arrays');
const { profile, folder } = require('../lib/profile');
const {
detocsStopRecording,
nextPromoHotkey,
detocsScreenshot,
detocsStartRecording,
detocsClip15s,
overlayToggle,
prepActions,
parseConfig,
} = require('./lp-common');
/** @typedef {import('../lib/profile').Profile} Profile */
/** @typedef {import('../lib/profile').Profiles} Profiles */
/** @typedef {import('./lp-common').LpConfig} LpConfig */
const DEVICE_WIDTH = 5;
/**
* @param {{parsedConfig: LpConfig, configFile: string}} params
* @returns {Profiles}
*/
function generateProfiles({
parsedConfig: {
name,
eventName,
twitchAccountId,
obsCollection: collection,
idleScene,
commentaryScene = 'commentators',
commentarySource,
breakScene,
endScene,
games,
},
}) {
const defaultIdle = obsScene({ title: 'Idle', target: 'program', sceneName: idleScene });
const brb = obsScene({ title: 'BRB', target: 'program', sceneName: breakScene });
const goodbye = obsScene({ title: 'Goodbye', target: 'program', sceneName: endScene });
const players = obsScene({ title: 'Players', target: 'program', sceneName: 'players' });
const wideShot = obsScene({ title: 'Venue', target: 'program', sceneName: 'venue' });
const commentary = obsScene({ title: 'Commentary', target: 'program', sceneName: commentaryScene });
const info = obsScene({ title: 'Info', target: 'program', sceneName: 'info' });
const promo = obsScene({ title: 'Promo', target: 'program', sceneName: 'promo' });
const shill = obsScene({ title: 'Shill', target: 'program', sceneName: 'shill' });
const toggleCommentators = overlayToggle({
title: 'Toggle\nCommentator\nNames',
obsCollection: collection,
overlayScene: commentaryScene,
overlaySource: commentarySource,
overlayId: commentarySource ? undefined : 'commentators',
});
const prepActions1 = prepActions(
games.slice(0, DEVICE_WIDTH),
breakScene,
twitchAccountId,
eventName,
detocsStopRecording()
);
const prepFolder1 = profile({ name: 'Prep', actions: prepActions1 });
const prepActions2 = prepActions(
games.slice(DEVICE_WIDTH, DEVICE_WIDTH * 2),
breakScene,
twitchAccountId,
eventName,
detocsStopRecording()
);
const prepFolder2 = profile({ name: 'Prep', actions: prepActions2 });
const gameProfiles = games.map(game => {
const scoreboard = obsScene({
title: game.name,
target: 'program',
sceneName: game.scoreboardScene,
});
const toggleScoreboard = overlayToggle({
title: 'Toggle\nScorebaord',
obsCollection: collection,
overlayScene: game.scoreboardScene,
overlaySource: game.scoreboardSource,
overlayId: game.scoreboardId,
});
const idle = !game.idleScene ? defaultIdle : obsScene({
title: 'Idle',
target: 'program',
sceneName: game.idleScene,
});
const actions = [
[players, commentary, toggleCommentators, promo, nextPromoHotkey()],
[toggleScoreboard, wideShot, detocsStopRecording(), shill, detocsScreenshot()],
[scoreboard, idle, detocsStartRecording(), info, detocsClip15s()],
];
actions[0][0] = back();
return profile({ name: game.name, actions });
});
const mainProfile = profile({
name, actions: [
[folder(prepFolder1), folder(prepFolder2), ...repeat(DEVICE_WIDTH - 5, null), detocsStopRecording(), brb, goodbye],
gameProfiles.slice(DEVICE_WIDTH, DEVICE_WIDTH * 2).map(folder),
gameProfiles.slice(0, DEVICE_WIDTH).map(folder),
]
});
return {
mainProfile,
additionalProfiles: [prepFolder1, prepFolder2, ...gameProfiles],
};
}
module.exports = (argv) => generateProfiles(parseConfig(argv));