mirror of
https://github.com/blakeblackshear/frigate.git
synced 2024-11-21 19:07:46 +01:00
add duration to cache
This commit is contained in:
parent
a748b70da1
commit
173eaabddf
@ -129,7 +129,7 @@ class RecordingMaintainer(threading.Thread):
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
if cache_path in self.end_time_cache:
|
if cache_path in self.end_time_cache:
|
||||||
end_time = self.end_time_cache[cache_path]
|
end_time, duration = self.end_time_cache[cache_path]
|
||||||
else:
|
else:
|
||||||
ffprobe_cmd = [
|
ffprobe_cmd = [
|
||||||
"ffprobe",
|
"ffprobe",
|
||||||
@ -144,9 +144,8 @@ class RecordingMaintainer(threading.Thread):
|
|||||||
p = sp.run(ffprobe_cmd, capture_output=True)
|
p = sp.run(ffprobe_cmd, capture_output=True)
|
||||||
if p.returncode == 0:
|
if p.returncode == 0:
|
||||||
duration = float(p.stdout.decode().strip())
|
duration = float(p.stdout.decode().strip())
|
||||||
self.end_time_cache[
|
end_time = start_time + datetime.timedelta(seconds=duration)
|
||||||
cache_path
|
self.end_time_cache[cache_path] = (end_time, duration)
|
||||||
] = end_time = start_time + datetime.timedelta(seconds=duration)
|
|
||||||
else:
|
else:
|
||||||
logger.warning(f"Discarding a corrupt recording segment: {f}")
|
logger.warning(f"Discarding a corrupt recording segment: {f}")
|
||||||
Path(cache_path).unlink(missing_ok=True)
|
Path(cache_path).unlink(missing_ok=True)
|
||||||
|
Loading…
Reference in New Issue
Block a user