Livestream Database Handling for Overwrite mode complete. Schedule goes back to pre-stream state if server crashes/stops.

This commit is contained in:
rainbow napkin 2025-05-18 17:47:47 -04:00
parent 85c1258bb6
commit 8c8b2a6f0b
6 changed files with 194 additions and 55 deletions

View file

@ -616,8 +616,8 @@ class queuePanel extends panelObj{
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]) > now.getTime()){
//Otherwise, if the item is currently playing (confirm with UUID since time might not always be reliable, such as during livestreams)
}else if(entry[1].uuid == this.client.player.mediaHandler.nowPlaying.uuid){
//Add 'Stop' option to context menu
menuMap.set("Stop", ()=>{this.client.socket.emit('stop')});
//Add the Now Playing glow, not the prettiest place to add this, but why let a good conditional go to waste?
@ -1068,8 +1068,8 @@ class queuePanel extends panelObj{
const entryTitle = document.createElement('p');
entryTitle.textContent = utils.unescapeEntities(nowPlaying.title);
//Set entry div bottom-border location based on current time
entryDiv.style.bottom = `${this.offsetByDate(date, true)}px`
//Set entry div bottom-border location based on current time, round to match time marker
entryDiv.style.bottom = `${Math.round(this.offsetByDate(date, true))}px`
//Assembly entryDiv
entryDiv.appendChild(entryTitle);
@ -1100,8 +1100,8 @@ class queuePanel extends panelObj{
//Append entry div to queue container
this.queueContainer.appendChild(entryDiv);
}else{
//Update existing entry
staleEntry.style.bottom = `${this.offsetByDate(date, true)}px`
//Update existing entry, round offset to match time marker
staleEntry.style.bottom = `${Math.round(this.offsetByDate(date, true))}px`
}
//Keep tooltip date seperate so it re-calculates live duration properly
@ -1206,6 +1206,7 @@ class queuePanel extends panelObj{
}
getMediaEnd(media){
console.log(media);
//If we have an early end
if(media.earlyEnd != null){
return media.startTime + (media.earlyEnd * 1000);