mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-03 01:35:22 +03:00
Store the segment size in db
This commit is contained in:
parent
bb3aee3698
commit
52b9614db2
@ -283,6 +283,10 @@ class RecordingMaintainer(threading.Thread):
|
|||||||
logger.debug(
|
logger.debug(
|
||||||
f"Copied {file_path} in {datetime.datetime.now().timestamp()-start_frame} seconds."
|
f"Copied {file_path} in {datetime.datetime.now().timestamp()-start_frame} seconds."
|
||||||
)
|
)
|
||||||
|
try:
|
||||||
|
segment_size = float(os.stat(file_path)) / 1000
|
||||||
|
except OSError:
|
||||||
|
segment_size = -1
|
||||||
|
|
||||||
rand_id = "".join(
|
rand_id = "".join(
|
||||||
random.choices(string.ascii_lowercase + string.digits, k=6)
|
random.choices(string.ascii_lowercase + string.digits, k=6)
|
||||||
@ -297,10 +301,8 @@ class RecordingMaintainer(threading.Thread):
|
|||||||
motion=motion_count,
|
motion=motion_count,
|
||||||
# TODO: update this to store list of active objects at some point
|
# TODO: update this to store list of active objects at some point
|
||||||
objects=active_count,
|
objects=active_count,
|
||||||
|
segment_size=segment_size,
|
||||||
)
|
)
|
||||||
else:
|
|
||||||
logger.warning(f"Ignoring segment because {file_path} already exists.")
|
|
||||||
os.remove(cache_path)
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"Unable to store recording segment {cache_path}")
|
logger.error(f"Unable to store recording segment {cache_path}")
|
||||||
Path(cache_path).unlink(missing_ok=True)
|
Path(cache_path).unlink(missing_ok=True)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user