mirror of
https://github.com/blakeblackshear/frigate.git
synced 2024-11-25 18:30:56 -06:00
better error handling (fixes #739)
This commit is contained in:
parent
e299e73a68
commit
513a099c24
@ -461,9 +461,12 @@ class TrackedObjectProcessor(threading.Thread):
|
|||||||
crop=snapshot_config.crop,
|
crop=snapshot_config.crop,
|
||||||
height=snapshot_config.height
|
height=snapshot_config.height
|
||||||
)
|
)
|
||||||
with open(os.path.join(CLIPS_DIR, f"{camera}-{obj.obj_data['id']}.jpg"), 'wb') as j:
|
if jpg_bytes is None:
|
||||||
j.write(jpg_bytes)
|
logger.warning(f"Unable to save snapshot for {obj.obj_data['id']}.")
|
||||||
event_data['has_snapshot'] = True
|
else:
|
||||||
|
with open(os.path.join(CLIPS_DIR, f"{camera}-{obj.obj_data['id']}.jpg"), 'wb') as j:
|
||||||
|
j.write(jpg_bytes)
|
||||||
|
event_data['has_snapshot'] = True
|
||||||
self.event_queue.put(('end', camera, event_data))
|
self.event_queue.put(('end', camera, event_data))
|
||||||
|
|
||||||
def snapshot(camera, obj: TrackedObject, current_frame_time):
|
def snapshot(camera, obj: TrackedObject, current_frame_time):
|
||||||
@ -475,7 +478,11 @@ class TrackedObjectProcessor(threading.Thread):
|
|||||||
crop=mqtt_config.crop,
|
crop=mqtt_config.crop,
|
||||||
height=mqtt_config.height
|
height=mqtt_config.height
|
||||||
)
|
)
|
||||||
self.client.publish(f"{self.topic_prefix}/{camera}/{obj.obj_data['label']}/snapshot", jpg_bytes, retain=True)
|
|
||||||
|
if jpg_bytes is None:
|
||||||
|
logger.warning(f"Unable to send mqtt snapshot for {obj.obj_data['id']}.")
|
||||||
|
else:
|
||||||
|
self.client.publish(f"{self.topic_prefix}/{camera}/{obj.obj_data['label']}/snapshot", jpg_bytes, retain=True)
|
||||||
|
|
||||||
def object_status(camera, object_name, status):
|
def object_status(camera, object_name, status):
|
||||||
self.client.publish(f"{self.topic_prefix}/{camera}/{object_name}", status, retain=False)
|
self.client.publish(f"{self.topic_prefix}/{camera}/{object_name}", status, retain=False)
|
||||||
|
Loading…
Reference in New Issue
Block a user