Repository navigation
Expand file tree
/
Copy pathlpxl.js
More file actions
133 lines (123 loc) · 4.63 KB
/
Copy pathlpxl.js
File metadata and controls
133 lines (123 loc) · 4.63 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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
const { resolve, dirname } = require('path');
const { obsScene, back, obsStudioMode, open, twitchTitle, twitchChatMessage } = require('../lib/actions');
const { repeat } = require('../lib/arrays');
const { profile, folder } = require('../lib/profile');
const {
detocsStopRecording,
nextPromoHotkey,
detocsScreenshot,
detocsStartRecording,
detocsClip15s,
overlayToggle,
prepActions,
parseConfig,
detocsStartGroup,
detocsEndGroup,
detocsIncrementP1,
detocsIncrementP2,
} = require('./lp-common');
/** @typedef {import('../lib/profile').Profile} Profile */
/** @typedef {import('../lib/profile').Profiles} Profiles */
/** @typedef {import('./lp-common').LpConfig} LpConfig */
const DEVICE_WIDTH = 8;
/**
* @param {{parsedConfig: LpConfig, configFile: string}} params
* @returns {Profiles}
*/
function generateProfiles({
parsedConfig: {
name,
eventName,
twitchAccountId,
obsCollection: collection,
crossfadeScript,
idleScene,
commentaryScene = 'commentators',
commentarySource,
breakScene,
endScene,
games,
},
configFile,
}) {
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 players2 = obsScene({ title: 'Players 2', target: 'program', sceneName: 'players 2' });
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 shillMsg = twitchChatMessage({
title: "Matcherino",
accountId: twitchAccountId,
message: "!m",
});
const replay = obsScene({ title: 'Replay', target: 'program', sceneName: 'replay' });
const crossfade = crossfadeScript ? open({ title: 'Crossfade', path: resolve(dirname(configFile), crossfadeScript) }) : null;
const studioMode = obsStudioMode({ title: 'Studio\nMode' });
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,
detocsEndGroup(),
);
const prepFolder1 = profile({ name: 'Prep', actions: prepActions1 });
const prepActions2 = prepActions(
games.slice(DEVICE_WIDTH, DEVICE_WIDTH * 2),
breakScene,
twitchAccountId,
eventName,
detocsEndGroup(),
);
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 = [
[back(), replay, detocsIncrementP1(), detocsIncrementP2(), detocsStartGroup(), detocsEndGroup(), brb, goodbye],
[players, players2, commentary, toggleCommentators, shillMsg],
[toggleScoreboard, wideShot, detocsStopRecording(), info, shill, promo, nextPromoHotkey()],
[scoreboard, idle, detocsStartRecording(), crossfade, detocsScreenshot(), detocsClip15s(), null, studioMode],
];
return profile({ name: game.name, actions });
});
const mainProfile = profile({
name, actions: [
[folder(prepFolder1), folder(prepFolder2), ...repeat(DEVICE_WIDTH - 5, null), detocsEndGroup(), brb, goodbye],
[...repeat(DEVICE_WIDTH - 3, null), detocsStartGroup(), commentary, toggleCommentators],
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));