Added verbose queue
This commit is contained in:
parent
dcafd8faf6
commit
e1528c0155
|
|
@ -1,6 +1,12 @@
|
||||||
Canopy - 0.2.1-INDEV
|
Canopy - 0.2.1-INDEV (verbose queue)
|
||||||
======
|
======
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
This branch exists to seperate the extra shit I added to the queue for bug-hunting so it wouldn't make a mess of the main development branch :P
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
Canopy - /ˈkæ.nə.pi/:
|
Canopy - /ˈkæ.nə.pi/:
|
||||||
- The upper layer of foliage and branches of a forest, containing the majority of animal life.
|
- The upper layer of foliage and branches of a forest, containing the majority of animal life.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -60,8 +60,22 @@ module.exports = class{
|
||||||
socket.on("clear", (data) => {this.deleteRange(socket, data)});
|
socket.on("clear", (data) => {this.deleteRange(socket, data)});
|
||||||
socket.on("move", (data) => {this.moveMedia(socket, data)});
|
socket.on("move", (data) => {this.moveMedia(socket, data)});
|
||||||
socket.on("lock", () => {this.toggleLock(socket)});
|
socket.on("lock", () => {this.toggleLock(socket)});
|
||||||
|
|
||||||
|
|
||||||
|
socket.on("chanDump", () => {this.chanDump(socket)});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
chanDump(socket){
|
||||||
|
socket.emit('chanDump',
|
||||||
|
{
|
||||||
|
nowPlaying: this.nowPlaying,
|
||||||
|
schedule: Array.from(this.schedule),
|
||||||
|
//timer: this.nextTimer
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//--- USER FACING QUEUEING FUNCTIONS ---
|
//--- USER FACING QUEUEING FUNCTIONS ---
|
||||||
async queueURL(socket, data){
|
async queueURL(socket, data){
|
||||||
//Get the current channel from the database
|
//Get the current channel from the database
|
||||||
|
|
@ -149,6 +163,7 @@ module.exports = class{
|
||||||
|
|
||||||
//End the media
|
//End the media
|
||||||
this.end();
|
this.end();
|
||||||
|
console.log(`Media set to end due at the request of ${socket.user}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -298,6 +313,9 @@ module.exports = class{
|
||||||
clearTimeout(this.nextTimer);
|
clearTimeout(this.nextTimer);
|
||||||
//Set the next timer
|
//Set the next timer
|
||||||
this.nextTimer = setTimeout(()=>{this.start(nextItem, nextItem.startTimeStamp, volatile)}, startsIn);
|
this.nextTimer = setTimeout(()=>{this.start(nextItem, nextItem.startTimeStamp, volatile)}, startsIn);
|
||||||
|
console.log(`next item '${nextItem.title}' timer set to start in ${startsIn} seconds`);
|
||||||
|
}else{
|
||||||
|
console.log('next timer is unset');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -461,6 +479,7 @@ module.exports = class{
|
||||||
if(this.nowPlaying != null && this.nowPlaying.uuid == uuid){
|
if(this.nowPlaying != null && this.nowPlaying.uuid == uuid){
|
||||||
//End playback
|
//End playback
|
||||||
this.end(false, true);
|
this.end(false, true);
|
||||||
|
console.log("Media ended due to removal of media");
|
||||||
//otherwise
|
//otherwise
|
||||||
}else{
|
}else{
|
||||||
try{
|
try{
|
||||||
|
|
@ -661,6 +680,7 @@ module.exports = class{
|
||||||
//Silently end the media in RAM so the database isn't stepping on itself up ahead
|
//Silently end the media in RAM so the database isn't stepping on itself up ahead
|
||||||
//Alternatively we could've used await, but then we'd be doubling up on DB transactions :P
|
//Alternatively we could've used await, but then we'd be doubling up on DB transactions :P
|
||||||
this.end(true, true, true);
|
this.end(true, true, true);
|
||||||
|
console.log("Media ended due to start of new media");
|
||||||
}
|
}
|
||||||
|
|
||||||
//reset current timestamp
|
//reset current timestamp
|
||||||
|
|
@ -732,6 +752,7 @@ module.exports = class{
|
||||||
|
|
||||||
//Call the end function once the video is over
|
//Call the end function once the video is over
|
||||||
this.syncTimer = setTimeout(this.end.bind(this), leftover);
|
this.syncTimer = setTimeout(this.end.bind(this), leftover);
|
||||||
|
console.log(`Media set to end by sync function in ${leftover} milliseconds`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -769,12 +790,16 @@ module.exports = class{
|
||||||
throw new Error(`Unable to find channel document ${this.channel.name} while ending queue item!`);
|
throw new Error(`Unable to find channel document ${this.channel.name} while ending queue item!`);
|
||||||
}
|
}
|
||||||
|
|
||||||
//If we haven't changed 'nowPlaying' in the play list
|
//If we haven't changed 'nowPlaying' in the DB
|
||||||
if(chanDB.media.nowPlaying.uuid == wasPlaying.uuid){
|
if(chanDB.media.nowPlaying.uuid == wasPlaying.uuid){
|
||||||
//Take it out
|
//Take it out
|
||||||
await chanDB.media.nowPlaying.deleteOne();
|
await chanDB.media.nowPlaying.deleteOne();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//NOTE: Keep an eye on this
|
||||||
|
//It seems this was part of my original design (don't remember was high)
|
||||||
|
//Though it is weird we keep it in both this.schedule and this.nowPlaying at the same time...
|
||||||
|
//More testing will have to be done...
|
||||||
//Take it out of the active schedule
|
//Take it out of the active schedule
|
||||||
this.schedule.delete(wasPlaying.startTime);
|
this.schedule.delete(wasPlaying.startTime);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue