random chance for room vids
This commit is contained in:
@@ -37,7 +37,7 @@
|
|||||||
"defaultSceneName": "fgfm",
|
"defaultSceneName": "fgfm",
|
||||||
"commercialSceneName": "commercial",
|
"commercialSceneName": "commercial",
|
||||||
"currentActivitySceneItemName": "now-showing-txt",
|
"currentActivitySceneItemName": "now-showing-txt",
|
||||||
"initialQueueSize": 3,
|
"initialQueueSize": 1,
|
||||||
"recentlyPlayedMemory": 5,
|
"recentlyPlayedMemory": 5,
|
||||||
"roomGrindChance": 25,
|
"roomGrindChance": 25,
|
||||||
"roomGrindPlaytime": 1800,
|
"roomGrindPlaytime": 1800,
|
||||||
@@ -51,5 +51,7 @@
|
|||||||
"roomConfigFile": "./conf/rooms.json",
|
"roomConfigFile": "./conf/rooms.json",
|
||||||
"roomVidsBasePath": "Y:\\media\\videos\\ALttP\\my-vids\\room-vids",
|
"roomVidsBasePath": "Y:\\media\\videos\\ALttP\\my-vids\\room-vids",
|
||||||
"roomVidPlaytime": 60,
|
"roomVidPlaytime": 60,
|
||||||
|
"roomShuffleChance": 85,
|
||||||
|
"roomShuffleCount": 15,
|
||||||
"debug": false
|
"debug": false
|
||||||
}
|
}
|
||||||
35
fgfm.js
35
fgfm.js
@@ -105,8 +105,17 @@ const streamInit = (config, twitch) => {
|
|||||||
.catch(console.error);
|
.catch(console.error);
|
||||||
};
|
};
|
||||||
|
|
||||||
const addRoomVideo = room => {
|
const addRoomVideo = (room, loop) => {
|
||||||
let loops = Math.floor(config.roomVidPlaytime / room.videoData.length);
|
if (Array.isArray(room)) {
|
||||||
|
for (var i = 0; i < room.length; i++) {
|
||||||
|
return addRoomVideo(room[i], loop);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let loops = 1;
|
||||||
|
if (typeof loop === 'undefined' || loop === true) {
|
||||||
|
loops = Math.floor(config.roomVidPlaytime / room.videoData.length);
|
||||||
|
}
|
||||||
console.log(`Adding ${loops} instances of room video for ${room.dungeonName} - ${room.roomName} to the queue`);
|
console.log(`Adding ${loops} instances of room video for ${room.dungeonName} - ${room.roomName} to the queue`);
|
||||||
|
|
||||||
let video = {
|
let video = {
|
||||||
@@ -171,11 +180,23 @@ const streamInit = (config, twitch) => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// filter recently played from shuffle
|
// Random chance for room videos to be added
|
||||||
let freshVods = config.vods.alttp.filter(e => {
|
if ((Math.floor(Math.random() * 100) + 1) <= config.roomShuffleChance) {
|
||||||
return e.includeInShuffle === true && !state.recentlyPlayed.includes(e.id);
|
console.log(`Room vids selected!`);
|
||||||
});
|
|
||||||
state.currentVideo = freshVods.sort(util.randSort).slice(0, 1).shift();
|
let roomVid = config.rooms.sort(util.randSort).slice(0, 1);
|
||||||
|
|
||||||
|
addRoomVideo(roomVid);
|
||||||
|
|
||||||
|
// play the first one
|
||||||
|
state.currentVideo = state.videoQueue.shift();
|
||||||
|
} else {
|
||||||
|
// filter recently played from shuffle
|
||||||
|
let freshVods = config.vods.alttp.filter(e => {
|
||||||
|
return e.includeInShuffle === true && !state.recentlyPlayed.includes(e.id);
|
||||||
|
});
|
||||||
|
state.currentVideo = freshVods.sort(util.randSort).slice(0, 1).shift();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
showVideo(state.currentVideo);
|
showVideo(state.currentVideo);
|
||||||
|
|||||||
Reference in New Issue
Block a user