init encap

This commit is contained in:
Chris Ham
2018-09-25 15:41:53 -07:00
parent 4d153373d1
commit a197b379e4
3 changed files with 22 additions and 21 deletions

View File

@@ -1,19 +1,16 @@
TODO: TODO:
☐ Modularize OBS and Twitch code
☐ Room vid requests / import ☐ Room vid requests / import
☐ Support viewer skip voting
☐ Command to add sets of videos to the queue at once (like the entire ttas or all gold segments)
☐ support for $pause
☐ Command to stop video rotation / timers (shutdown)
☐ Start/stop stream automation
☐ Rotating background images (leftside) ☐ Rotating background images (leftside)
☐ Stream alerts for chat ☐ Stream alerts for chat
☐ support for $pause
☐ remove currently playing video from vote choices ☐ remove currently playing video from vote choices
☐ restrict # of requests a user can have in the queue at once ☐ restrict # of requests a user can have in the queue at once
☐ Add cooldowns ☐ Add cooldowns
☐ Start/stop stream automation
☐ Move vods to their own config
☐ Tool to output list of video ID's / descriptions ☐ Tool to output list of video ID's / descriptions
☐ Support viewer skip voting
☐ Command to add sets of videos to the queue at once (like the entire ttas or all gold segments)
☐ Command to stop video rotation / timers (shutdown)
☐ Ability to include/exclude vods from shuffle in config
Ideas: Ideas:
☐ Web interface for viewers to issue commands -- twitch extension?! ☐ Web interface for viewers to issue commands -- twitch extension?!
@@ -21,6 +18,9 @@ Ideas:
___________________ ___________________
Archive: Archive:
✔ Move vods to their own config @done (18-09-25 15:40) @project(TODO)
✔ Modularize OBS and Twitch code @done (18-09-25 15:39) @project(TODO)
✔ Ability to include/exclude vods from shuffle in config @done (18-09-25 15:39) @project(TODO)
✔ Add random chance for room grind playlist to show for certain amount of time @done (18-09-21 12:28) @project(TODO) ✔ Add random chance for room grind playlist to show for certain amount of time @done (18-09-21 12:28) @project(TODO)
✔ show commercials after a video length cap is hit -- show at conclusion of video @done (18-09-19 11:11) @project(TODO) ✔ show commercials after a video length cap is hit -- show at conclusion of video @done (18-09-19 11:11) @project(TODO)
✔ add memes to commercial scene @done (18-09-19 11:11) @project(TODO) ✔ add memes to commercial scene @done (18-09-19 11:11) @project(TODO)

23
fgfm.js
View File

@@ -72,18 +72,22 @@ const twitchInit = (config) => {
// Initialize Stream automation // Initialize Stream automation
const streamInit = (config, twitch) => { const streamInit = (config, twitch) => {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
// Set up the initial queue by randomly choosing the configured amount of vods included in shuffling // Set up initial queue + start playback
state.videoQueue = config.vods.alttp.filter(e => e.includeInShuffle === true).sort(util.randSort).slice(0, config.initialQueueSize); const init = () => {
console.log(`Initial video queue: ${state.videoQueue.map((c, i) => `[${i+1}] ${c.chatName}`).join(' | ')}`); // Set up the initial queue by randomly choosing the configured amount of vods included in shuffling
state.videoQueue = config.vods.alttp.filter(e => e.includeInShuffle === true).sort(util.randSort).slice(0, config.initialQueueSize);
console.log(`Initial video queue: ${state.videoQueue.map((c, i) => `[${i+1}] ${c.chatName}`).join(' | ')}`);
// Start queue playback
state.currentVideo = state.videoQueue.shift();
showVideo(state.currentVideo);
}
// Show a gameplay vod // Show a gameplay vod
const showVideo = video => { const showVideo = video => {
console.log(`Showing video: ${video.chatName}`); console.log(`Showing video: ${video.chatName}`);
// play the next video when the previous finishes obs.playVideoInScene(video, config.defaultSceneName, nextVideo)
let handleVideoEnd = () => {nextVideo()};
obs.playVideoInScene(video, config.defaultSceneName, handleVideoEnd)
.then(timer => { .then(timer => {
// track timer so we can cancel callback later on if necessary // track timer so we can cancel callback later on if necessary
state.videoTimer = timer; state.videoTimer = timer;
@@ -157,10 +161,6 @@ const streamInit = (config, twitch) => {
showVideo(state.currentVideo); showVideo(state.currentVideo);
}; };
// Start queue playback
state.currentVideo = state.videoQueue.shift();
showVideo(state.currentVideo);
// "Commercials" // "Commercials"
const showCommercial = (video, callback) => { const showCommercial = (video, callback) => {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
@@ -502,6 +502,7 @@ const streamInit = (config, twitch) => {
rtvInterval = setInterval(() => {rockTheVote()}, 300000); rtvInterval = setInterval(() => {rockTheVote()}, 300000);
}); });
init();
resolve(obs); resolve(obs);
}); });
}; };

View File

@@ -97,7 +97,7 @@ function GHOBS(config) {
return this.websocket.setSceneItemProperties({"item": item, "scene-name": scene, "visible": visible}); return this.websocket.setSceneItemProperties({"item": item, "scene-name": scene, "visible": visible});
}; };
this.toggleVisible(item) => { this.toggleVisible = (item) => {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
this.websocket.getSceneItemProperties({"item": item}) this.websocket.getSceneItemProperties({"item": item})
.then(data => { .then(data => {
@@ -116,7 +116,7 @@ function GHOBS(config) {
return this.setVisible(item, scene, false); return this.setVisible(item, scene, false);
}; };
this.switchToScene(scene) => { this.switchToScene = (scene) => {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
if (this.currentScene === scene) { if (this.currentScene === scene) {
resolve(true); resolve(true);