Modified Queue Logic to handle bulk queueing better.
This commit is contained in:
parent
b27175bb7d
commit
3c144894c6
|
|
@ -53,6 +53,7 @@ module.exports = class{
|
||||||
}
|
}
|
||||||
|
|
||||||
defineListeners(socket){
|
defineListeners(socket){
|
||||||
|
//Queueing Functions
|
||||||
socket.on("queue", (data) => {this.queueURL(socket, data)});
|
socket.on("queue", (data) => {this.queueURL(socket, data)});
|
||||||
socket.on("stop", (data) => {this.stopMedia(socket)}); //needs perms
|
socket.on("stop", (data) => {this.stopMedia(socket)}); //needs perms
|
||||||
socket.on("delete", (data) => {this.deleteMedia(socket, data)});
|
socket.on("delete", (data) => {this.deleteMedia(socket, data)});
|
||||||
|
|
@ -279,18 +280,17 @@ module.exports = class{
|
||||||
//Grab the next item
|
//Grab the next item
|
||||||
const nextItem = this.getNextItem();
|
const nextItem = this.getNextItem();
|
||||||
|
|
||||||
//If we have no next item
|
//Get current item
|
||||||
if(nextItem == null){
|
const currentItem = this.getItemAtEpoch()
|
||||||
//Get current item
|
|
||||||
const currentItem = this.getItemAtEpoch()
|
|
||||||
|
|
||||||
//If we have a current item and it isn't currently playing
|
//If we have a current item and it isn't currently playing
|
||||||
if(currentItem != null && (this.nowPlaying == null || currentItem.uuid != this.nowPlaying.uuid)){
|
if(currentItem != null && (this.nowPlaying == null || currentItem.uuid != this.nowPlaying.uuid)){
|
||||||
//Start the found item at w/ a pre-calculated time stamp to reflect the given start time
|
//Start the found item at w/ a pre-calculated time stamp to reflect the given start time
|
||||||
this.start(currentItem, Math.round((new Date().getTime() - currentItem.startTime) / 1000) + currentItem.startTimeStamp, volatile);
|
this.start(currentItem, Math.round((new Date().getTime() - currentItem.startTime) / 1000) + currentItem.startTimeStamp, volatile);
|
||||||
}
|
}
|
||||||
//otherwise if we have an item
|
|
||||||
}else{
|
//If we have a next item
|
||||||
|
if(nextItem != null){
|
||||||
//Calculate the amount of time in ms that the next item will start in
|
//Calculate the amount of time in ms that the next item will start in
|
||||||
const startsIn = nextItem.startTime - new Date().getTime();
|
const startsIn = nextItem.startTime - new Date().getTime();
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue