Continued work on Playlist Queueing

This commit is contained in:
rainbow napkin 2025-03-26 23:08:32 -04:00
parent 0325b645ca
commit 1167b2dd76

View file

@ -263,6 +263,9 @@ module.exports = class{
return now;
}
}
//If we fell through, just return input
return start;
}
refreshNextTimer(volatile = false){
@ -522,8 +525,7 @@ module.exports = class{
https://community.appsmith.com/content/blog/dark-side-foreach-why-you-should-think-twice-using-it
*/
let mediaObj = media[0];
for(let mediaObj of media){
//If someone is trying to schedule something that starts and ends in the past
if((mediaObj.getEndTime() < new Date().getTime()) && !force){
//If an originating socket was provided for this request
@ -608,9 +610,26 @@ module.exports = class{
//Add media to the persistant schedule
chanDB.media.scheduled.push(mediaObj);
//If something fucked up
}catch(err){
//If this was originated by someone
if(socket != null){
//Bitch at them
loggerUtils.socketExceptionHandler(socket, err);
//If not
}else{
//Bitch to the console
loggerUtils.localExceptionHandler(err);
}
}
}
}
//If we fucked with the DB during the main loop
if(chanDB == null && !volatile){
try{
//Save the database
chanDB.save();
//If something fucked up
}catch(err){
//If this was originated by someone
@ -625,8 +644,8 @@ module.exports = class{
}
}
//return media object for use
return mediaObj;
//return true to let everyone know this shit worked
return true;
}
async start(mediaObj, timestamp = mediaObj.startTimeStamp, volatile = false){
@ -964,7 +983,6 @@ module.exports = class{
//Add record to new schedule
newSched.push(record);
//Re-Schedule it in RAM
await this.scheduleMedia([mediaObj], null, chanDB, true, true, false);
}else{