Finished up with Persistent queue storage in database.

This commit is contained in:
rainbow napkin 2025-02-15 11:02:58 -05:00
parent d60182ceae
commit 8a273d8055
3 changed files with 296 additions and 80 deletions

View file

@ -566,7 +566,7 @@ class queuePanel extends panelObj{
`Source: ${entry[1].type}`,
`Duration: ${entry[1].duration}`,
`Start Time: ${new Date(entry[1].startTime).toLocaleString()}${entry[1].startTimeStamp == 0 ? '' : ' (Started Late)'}`,
`End Time: ${new Date(this.getMediaEnd(entry[1])).toLocaleString()}`
`End Time: ${new Date(this.getMediaEnd(entry[1])).toLocaleString()}${entry[1].earlyEnd == null ? '' : ' (Ended Early)'}`
]){
//Create a 'p' node
const component = document.createElement('p');
@ -587,19 +587,23 @@ class queuePanel extends panelObj{
//Create context menu map
const menuMap = new Map();
const now = new Date();
//If the item hasn't started yet
if(entry[1].startTime > new Date().getTime()){
if(entry[1].startTime > now.getTime()){
//Add 'Play' option to context menu
menuMap.set("Play now", ()=>{this.client.socket.emit('move', {uuid: entry[1].uuid})});
//Add 'Move To...' option to context menu
menuMap.set("Move To...", (event)=>{new reschedulePopup(event, this.client, entry[1], null, this.ownerDoc)});
//Otherwise, if the item is currently playing
}else if(this.getMediaEnd(entry[1]) > new Date().getTime()){
}else if(this.getMediaEnd(entry[1]) > now.getTime()){
//Add 'Stop' option to context menu
menuMap.set("Stop", ()=>{this.client.socket.emit('stop', {uuid: entry[1].uuid})});
//Add the Now Playing glow, not the prettiest place to add this, but why let a good conditional go to waste?
entryDiv.classList.add('now-playing');
//Otherwise, if the item has been archived
}else{
entryDiv.classList.add('archived');
}
//Add 'Delete' option to context menu
@ -609,8 +613,11 @@ class queuePanel extends panelObj{
//Add 'Copy URL' option to context menu
menuMap.set("Copy URL", ()=>{navigator.clipboard.writeText(entry[1].url);})
//Setup drag n drop
entryDiv.addEventListener('mousedown', clickEntry.bind(this));
//If the item hasn't yet ended
if(this.getMediaEnd(entry[1]) > now.getTime()){
//Setup drag n drop
entryDiv.addEventListener('mousedown', clickEntry.bind(this));
}
//Setup context menu
entryDiv.addEventListener('contextmenu', (event)=>{