Continued work on Playlist Queueing
This commit is contained in:
parent
0325b645ca
commit
1167b2dd76
|
|
@ -263,6 +263,9 @@ module.exports = class{
|
||||||
return now;
|
return now;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//If we fell through, just return input
|
||||||
|
return start;
|
||||||
}
|
}
|
||||||
|
|
||||||
refreshNextTimer(volatile = false){
|
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
|
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 someone is trying to schedule something that starts and ends in the past
|
||||||
if((mediaObj.getEndTime() < new Date().getTime()) && !force){
|
if((mediaObj.getEndTime() < new Date().getTime()) && !force){
|
||||||
//If an originating socket was provided for this request
|
//If an originating socket was provided for this request
|
||||||
|
|
@ -608,9 +610,26 @@ module.exports = class{
|
||||||
//Add media to the persistant schedule
|
//Add media to the persistant schedule
|
||||||
chanDB.media.scheduled.push(mediaObj);
|
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
|
//Save the database
|
||||||
chanDB.save();
|
chanDB.save();
|
||||||
|
|
||||||
//If something fucked up
|
//If something fucked up
|
||||||
}catch(err){
|
}catch(err){
|
||||||
//If this was originated by someone
|
//If this was originated by someone
|
||||||
|
|
@ -625,8 +644,8 @@ module.exports = class{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//return media object for use
|
//return true to let everyone know this shit worked
|
||||||
return mediaObj;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
async start(mediaObj, timestamp = mediaObj.startTimeStamp, volatile = false){
|
async start(mediaObj, timestamp = mediaObj.startTimeStamp, volatile = false){
|
||||||
|
|
@ -964,7 +983,6 @@ module.exports = class{
|
||||||
//Add record to new schedule
|
//Add record to new schedule
|
||||||
newSched.push(record);
|
newSched.push(record);
|
||||||
|
|
||||||
|
|
||||||
//Re-Schedule it in RAM
|
//Re-Schedule it in RAM
|
||||||
await this.scheduleMedia([mediaObj], null, chanDB, true, true, false);
|
await this.scheduleMedia([mediaObj], null, chanDB, true, true, false);
|
||||||
}else{
|
}else{
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue