This commit is contained in:
j 2021-10-20 09:31:42 +01:00
parent ab3d8f244e
commit 765fc78c7b

View File

@ -318,6 +318,18 @@ function totalDuration() {
}).reduce(function(a, b) { return a+b }, 0) }).reduce(function(a, b) { return a+b }, 0)
} }
function formatDict(position) {
var pos = ''
Object.keys(position).forEach(key => {
var name = key
if (name == 'absoluteZoom') {
name = 'zoom'
}
pos += name + ': ' + position[key] + ' '
})
return pos.trim()
}
function updateStatus() { function updateStatus() {
api('status', {}, function(response) { api('status', {}, function(response) {
if (response.result) { if (response.result) {
@ -347,7 +359,7 @@ function updateStatus() {
}) })
} }
if (response.result.position) { if (response.result.position) {
$('#position').html(JSON.stringify(response.result.position)) $('#position').html(formatDict(response.result.position))
} }
data.forEach(function(row) { data.forEach(function(row) {
var s = (response.result.next && row.seqid == response.result.next.seqid); var s = (response.result.next && row.seqid == response.result.next.seqid);
@ -364,7 +376,7 @@ function updateStatus() {
if (response.result.next.duration) { if (response.result.next.duration) {
delete response.result.next.duration delete response.result.next.duration
} }
$('#next').html(JSON.stringify(response.result.next)) $('#next').html('Next: ' + formatDict(response.result.next))
} }
if (update) { if (update) {
grid.invalidate(); grid.invalidate();
@ -753,7 +765,11 @@ function init_ptz() {
$('<br>').appendTo($(ptz)) $('<br>').appendTo($(ptz))
$('<br>').appendTo($(ptz)) $('<br>').appendTo($(ptz))
var name = $('<input>').appendTo($(ptz)) var name = $('<input>').appendTo($(ptz))
name.val(getPreset(id).name) var preset = getPreset(id)
if (preset) {
name.val(preset.name)
}
$('<button>').html('Set') $('<button>').html('Set')
.appendTo($(ptz)).on({ .appendTo($(ptz)).on({
click: function() { click: function() {