prepare timeline and liveGrid for automated controls

plugin-touch-ups
Moe 2024-08-13 15:53:55 -07:00
parent b552d920fa
commit 11690afc05
2 changed files with 39 additions and 5 deletions

View File

@ -656,6 +656,11 @@ function closeLiveGridPlayer(monitorId,killElement){
console.log(err) console.log(err)
} }
} }
function closeLiveGridPlayers(monitors, killElement){
$.each(monitors,function(n,v){
monitorWatchOnLiveGrid(v.mid, killElement)
})
}
function monitorWatchOnLiveGrid(monitorId, watchOff){ function monitorWatchOnLiveGrid(monitorId, watchOff){
return mainSocket.f({f:'monitor',ff:watchOff ? 'watch_off' : 'watch_on',id: monitorId}) return mainSocket.f({f:'monitor',ff:watchOff ? 'watch_off' : 'watch_on',id: monitorId})
} }
@ -664,13 +669,20 @@ function monitorsWatchOnLiveGrid(monitorIds, watchOff){
monitorWatchOnLiveGrid(monitorId, watchOff) monitorWatchOnLiveGrid(monitorId, watchOff)
}) })
} }
function callMonitorToLiveGrid(v){ function callMonitorToLiveGrid(v, justTry){
var watchedOn = dashboardOptions().watch_on || {} var watchedOn = dashboardOptions().watch_on || {}
if(watchedOn[v.ke] && watchedOn[v.ke][v.mid] === 1 && loadedMonitors[v.mid] && loadedMonitors[v.mid].mode !== 'stop'){ if(justTry || watchedOn[v.ke] && watchedOn[v.ke][v.mid] === 1 && loadedMonitors[v.mid] && loadedMonitors[v.mid].mode !== 'stop'){
mainSocket.f({f:'monitor',ff:'watch_on',id:v.mid}) mainSocket.f({f:'monitor',ff:'watch_on',id:v.mid})
if(tabTree.name !== 'monitorSettings')openLiveGrid() if(tabTree.name !== 'monitorSettings')openLiveGrid()
console.log('loaded',v.name)
} }
} }
function callMonitorsToLiveGrid(monitors, justTry){
$.each(monitors,function(n,v){
console.log('loading',v.name)
callMonitorToLiveGrid(v, justTry)
})
}
function loadPreviouslyOpenedLiveGridBlocks(){ function loadPreviouslyOpenedLiveGridBlocks(){
$.getJSON(getApiPrefix(`monitor`),function(data){ $.getJSON(getApiPrefix(`monitor`),function(data){
$.each(data,function(n,v){ $.each(data,function(n,v){
@ -1279,8 +1291,8 @@ $(document).ready(function(e){
var monitorId = d.mid || d.id var monitorId = d.mid || d.id
var loadedMonitor = loadedMonitors[monitorId] var loadedMonitor = loadedMonitors[monitorId]
var subStreamChannel = d.subStreamChannel var subStreamChannel = d.subStreamChannel
var monitorsPerRow = cycleLiveOptions ? cycleLiveOptions.monitorsPerRow : null; var monitorsPerRow = null;
var monitorHeight = cycleLiveOptions ? cycleLiveOptions.monitorHeight : null; var monitorHeight = null;
if(!loadedMonitor.subStreamChannel && loadedMonitor.details.stream_type === 'useSubstream'){ if(!loadedMonitor.subStreamChannel && loadedMonitor.details.stream_type === 'useSubstream'){
toggleSubStream(monitorId,function(){ toggleSubStream(monitorId,function(){
drawLiveGridBlock(loadedMonitors[monitorId],subStreamChannel,monitorsPerRow,monitorHeight) drawLiveGridBlock(loadedMonitors[monitorId],subStreamChannel,monitorsPerRow,monitorHeight)
@ -1428,4 +1440,9 @@ $(document).ready(function(e){
}) })
} }
dashboardSwitchCallbacks.jpegMode = toggleJpegMode dashboardSwitchCallbacks.jpegMode = toggleJpegMode
window.openLiveGrid = openLiveGrid;
window.callMonitorToLiveGrid = callMonitorToLiveGrid;
window.monitorsWatchOnLiveGrid = monitorsWatchOnLiveGrid;
window.closeAllLiveGridPlayers = closeAllLiveGridPlayers;
window.closeLiveGridPlayers = closeLiveGridPlayers;
}) })

View File

@ -911,9 +911,25 @@ $(document).ready(function(){
onSelectedMonitorChange() onSelectedMonitorChange()
refreshTimeline() refreshTimeline()
} }
window.resetTimelineWithMonitors = function(monitorIds, start = new Date(), end = new Date(), tickTime){
setTimeout(() => {
timeStripSelectedMonitors = monitorIds || [];
onSelectedMonitorChange()
setLoadingMask(true)
dateRangeChanging = true
setTimestripDate(start, end)
setTimeout(() => {
dateRangeChanging = false
refreshTimeline()
var newTickPosition = tickTime || getTimeBetween(start,end,50);
setTickDate(newTickPosition)
},2000)
},1000)
openTab('timeline')
}
function refreshTimelineOnAgree(){ function refreshTimelineOnAgree(){
var askToLoad = isAllMonitorsSelected(50) var askToLoad = isAllMonitorsSelected(50)
if(askToLoad){ if(!window.skipTimelineAgree && askToLoad){
$.confirm.create({ $.confirm.create({
title: lang.tooManyMonitorsSelected, title: lang.tooManyMonitorsSelected,
body: lang.performanceMayBeAffected, body: lang.performanceMayBeAffected,
@ -931,6 +947,7 @@ $(document).ready(function(){
}else{ }else{
refreshTimeline() refreshTimeline()
} }
window.skipTimelineAgree = false;
} }
function monitorSelectorController(){ function monitorSelectorController(){
var el = $(this) var el = $(this)