Updated scheduler to display schedule archives upon request.
This commit is contained in:
parent
baf8255b2c
commit
50b1e15a6c
3 changed files with 61 additions and 1 deletions
|
|
@ -126,6 +126,10 @@ class channel{
|
|||
this.queueBroadcastSocket.on("queue", (data) => {
|
||||
this.queue = new Map(data.queue);
|
||||
});
|
||||
|
||||
this.socket.on("archive", (data) =>{
|
||||
this.sortQueue(data.archive);
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -157,6 +161,39 @@ class channel{
|
|||
this.streamType = data.streamType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sorts queue, optionally adding new items along the way
|
||||
* @param {object} queueData - Contains list of entries to add to the queue
|
||||
*/
|
||||
sortQueue(queueData){
|
||||
//Create array to temporary sort schedule within
|
||||
const tempSched = [];
|
||||
//Get current queue as entries
|
||||
let entries = Array.from(this.queue.entries());
|
||||
|
||||
//Blow-out existing queue since we've already pulled out the data we need from it
|
||||
this.queue = new Map();
|
||||
|
||||
|
||||
//If we have new queue data
|
||||
if(queueData != null){
|
||||
//Concat passed queue data to beggining of entries pulled from queue map
|
||||
entries = queueData.concat(entries);
|
||||
}
|
||||
|
||||
//For each media entry accounted for
|
||||
for(let entry of entries){
|
||||
//Store entry item in array indexed to its start epoch in seconds
|
||||
tempSched[Math.round(entry[0] / 1000)] = entry[1];
|
||||
}
|
||||
|
||||
//Iterate through populated indices of tempSched to skip over empty indexes, just like in the server-side
|
||||
for(let startTime of Object.keys(tempSched)){
|
||||
//Add each entry to the queue in order of start time
|
||||
this.queue.set(tempSched[startTime].startTime, tempSched[startTime]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Processes and applies default config on any unset settings
|
||||
* @param {Boolean} force - Whether or not to forcefully reset already set settings
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue