mirror of
https://github.com/blakeblackshear/frigate.git
synced 2024-11-21 19:07:46 +01:00
remove thumbnail attribute if null
This commit is contained in:
parent
9e126a4b91
commit
6d12a34c40
@ -155,26 +155,28 @@ class TrackedObject:
|
|||||||
return significant_update
|
return significant_update
|
||||||
|
|
||||||
def to_dict(self, include_thumbnail: bool = False):
|
def to_dict(self, include_thumbnail: bool = False):
|
||||||
return {
|
event = {
|
||||||
"id": self.obj_data["id"],
|
'id': self.obj_data['id'],
|
||||||
"camera": self.camera,
|
'camera': self.camera,
|
||||||
"frame_time": self.obj_data["frame_time"],
|
'frame_time': self.obj_data['frame_time'],
|
||||||
"label": self.obj_data["label"],
|
'label': self.obj_data['label'],
|
||||||
"top_score": self.top_score,
|
'top_score': self.top_score,
|
||||||
"false_positive": self.false_positive,
|
'false_positive': self.false_positive,
|
||||||
"start_time": self.obj_data["start_time"],
|
'start_time': self.obj_data['start_time'],
|
||||||
"end_time": self.obj_data.get("end_time", None),
|
'end_time': self.obj_data.get('end_time', None),
|
||||||
"score": self.obj_data["score"],
|
'score': self.obj_data['score'],
|
||||||
"box": self.obj_data["box"],
|
'box': self.obj_data['box'],
|
||||||
"area": self.obj_data["area"],
|
'area': self.obj_data['area'],
|
||||||
"region": self.obj_data["region"],
|
'region': self.obj_data['region'],
|
||||||
"current_zones": self.current_zones.copy(),
|
'current_zones': self.current_zones.copy(),
|
||||||
"entered_zones": list(self.entered_zones).copy(),
|
'entered_zones': list(self.entered_zones).copy(),
|
||||||
"thumbnail": base64.b64encode(self.get_thumbnail()).decode("utf-8")
|
|
||||||
if include_thumbnail
|
|
||||||
else None,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if include_thumbnail:
|
||||||
|
event['thumbnail'] = base64.b64encode(self.get_thumbnail()).decode('utf-8')
|
||||||
|
|
||||||
|
return event
|
||||||
|
|
||||||
def get_thumbnail(self):
|
def get_thumbnail(self):
|
||||||
if (
|
if (
|
||||||
self.thumbnail_data is None
|
self.thumbnail_data is None
|
||||||
|
Loading…
Reference in New Issue
Block a user