Compare commits
2 Commits
869fbfc4f9
...
42be31ca81
Author | SHA1 | Date | |
---|---|---|---|
42be31ca81 | |||
8f79d073e6 |
17
camera.py
17
camera.py
|
@ -126,12 +126,20 @@ class Camera:
|
|||
return {}
|
||||
|
||||
def get(self, method):
|
||||
return requests.get(self.url(method), auth=self.auth).text
|
||||
while True:
|
||||
try:
|
||||
return requests.get(self.url(method), auth=self.auth).text
|
||||
except requests.exceptions.ConnectionError:
|
||||
time.sleep(0.1)
|
||||
|
||||
def put(self, method, data):
|
||||
if isinstance(data, dict):
|
||||
data = PTZData(data)
|
||||
return requests.put(self.url(method), data=data, auth=self.auth).text
|
||||
while True:
|
||||
try:
|
||||
return requests.put(self.url(method), data=data, auth=self.auth).text
|
||||
except requests.exceptions.ConnectionError:
|
||||
time.sleep(0.1)
|
||||
|
||||
def momentary(self, cmd, duration=None):
|
||||
if duration:
|
||||
|
@ -221,6 +229,11 @@ class Camera:
|
|||
segment_t0 = time.time()
|
||||
if self.abort:
|
||||
return
|
||||
print('next step %s at %s - %s' % (
|
||||
steps.index(step),
|
||||
datetime.now().strftime('%Y-%m-%d_%H:%M:%S'),
|
||||
json.dumps(step)
|
||||
))
|
||||
if isinstance(step, dict):
|
||||
if 'fast' in step or ('speed' in step and step['speed'] > 100):
|
||||
self.fast_preset(step.get('fast', step.get('preset')), True)
|
||||
|
|
Loading…
Reference in New Issue
Block a user