UI Updated to reflect active livestreams, queue locks while streaming.

This commit is contained in:
rainbow napkin 2025-05-15 19:56:00 -04:00
parent afa57e8080
commit b0cca2c6fc
2 changed files with 63 additions and 4 deletions

View file

@ -62,7 +62,7 @@ module.exports = class{
defineListeners(socket){
//Queueing Functions
socket.on("queue", (data) => {this.queueURL(socket, data)});
socket.on("stop", (data) => {this.stopMedia(socket)}); //needs perms
socket.on("stop", () => {this.stopMedia(socket)}); //needs perms
socket.on("delete", (data) => {this.deleteMedia(socket, data)});
socket.on("clear", (data) => {this.deleteRange(socket, data)});
socket.on("move", (data) => {this.moveMedia(socket, data)});
@ -407,6 +407,17 @@ module.exports = class{
}
async removeRange(start = new Date().getTime() - 60 * 1000, end = new Date().getTime(), socket){
//If we're streamlocked
if(this.streamLock){
//If an originating socket was provided for this request
if(socket != null){
//Yell at the user for being an asshole
loggerUtils.socketErrorHandler(socket, "You cannot edit the schedule while livestreaming!", "queue");
}
//Stop while we're ahead since the stream hasn't ended yet
return;
}
//Find items within given range
const foundItems = this.getItemsBetweenEpochs(start, end);
@ -440,6 +451,17 @@ module.exports = class{
}
async rescheduleMedia(uuid, start = new Date().getTime(), socket){
//If we're streamlocked
if(this.streamLock){
//If an originating socket was provided for this request
if(socket != null){
//Yell at the user for being an asshole
loggerUtils.socketErrorHandler(socket, "You cannot edit the schedule while livestreaming!", "queue");
}
//Stop while we're ahead since the stream hasn't ended yet
return;
}
//Find our media, don't remove it yet since we want to do some more testing first
const media = this.getItemByUUID(uuid);
@ -502,6 +524,17 @@ module.exports = class{
}
async removeMedia(uuid, socket, chanDB){
//If we're streamlocked
if(this.streamLock){
//If an originating socket was provided for this request
if(socket != null){
//Yell at the user for being an asshole
loggerUtils.socketErrorHandler(socket, "You cannot edit the schedule while livestreaming!", "queue");
}
//Stop while we're ahead since the stream hasn't ended yet
return;
}
//Get requested media
const media = this.getItemByUUID(uuid);
@ -643,6 +676,17 @@ module.exports = class{
https://community.appsmith.com/content/blog/dark-side-foreach-why-you-should-think-twice-using-it
*/
//If we're streamlocked
if(this.streamLock){
//If an originating socket was provided for this request
if(socket != null){
//Yell at the user for being an asshole
loggerUtils.socketErrorHandler(socket, "You cannot edit the schedule while livestreaming!", "queue");
}
//Stop while we're ahead since the stream hasn't ended yet
return;
}
for(let mediaObj of media){
const now = new Date().getTime();