Compare commits

...

2 Commits

Author SHA1 Message Date
j
f57dfcfaf7 fallback if preset is missing 2018-12-07 22:01:24 +01:00
j
9bf1dfd6e9 cleanup 2018-12-06 13:24:45 +01:00
2 changed files with 16 additions and 11 deletions

View File

@ -228,13 +228,12 @@ class Camera:
raise Exception('unknown preset %s' % id)
preset = preset[0]
i = preset['position']
#info = etree_to_dict(xml.etree.ElementTree.fromstring(self.get('presets/%s' % id)))
#i = info['PTZPreset']['AbsoluteHigh']
if i['elevation'] < 0:
i['elevation'] -= 1
i['azimuth'] += 1
print('goto preset', id, i['elevation'], i['azimuth'], i['absoluteZoom'])
return self.goto(i['elevation'], i['azimuth'], i['absoluteZoom'], pan=pan, tilt=tilt, zoom=zoom, zoom_last=zoom_last)
return self.goto(i['elevation'], i['azimuth'], i['absoluteZoom'],
pan=pan, tilt=tilt, zoom=zoom, zoom_last=zoom_last)
def goto(self, elevation, azimuth, absoluteZoom, speed=1, pan=None, tilt=None, zoom=None, zoom_last=False):
t0 = time.time()
@ -364,7 +363,6 @@ class Camera:
def get_presets_xml(self):
return self.get('presets')
def get_presets(self, details=False):
system_presets = list(range(33, 47)) + list(range(90, 106))
presets = etree_to_list(xml.etree.ElementTree.fromstring(self.get('presets')))
@ -377,6 +375,3 @@ class Camera:
preset['position'] = preset.pop('AbsoluteHigh')
preset['name'] = preset.pop('presetName')
return presets
#/PTZCtrl/channels/<ID>/patterns/<ID>/recordstart
#/PTZCtrl/channels/<ID>/patterns/<ID>/recordstop

View File

@ -504,7 +504,11 @@ function exportSequenceCSV() {
var r = [];
r.push(row.preset)
var preset = getPreset(row.preset)
if (preset) {
r.push(preset.name)
} else {
r.push(row.preset)
}
if (row.duration) {
position += row.duration
r.push(formatDuration(position))
@ -515,9 +519,15 @@ function exportSequenceCSV() {
}
r.push(row.speed)
r.push(row.sleep)
if (preset) {
r.push(preset.position.elevation)
r.push(preset.position.azimuth)
r.push(preset.position.absoluteZoom)
} else {
r.push('')
r.push('')
r.push('')
}
return r.join(',');
})).join('\n');
}