mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-05 18:55:23 +03:00
Add handling for non-existent or empty model file paths in compute_model_hash() method
This commit is contained in:
parent
17e8a46c7d
commit
bebb22dc11
@ -118,6 +118,10 @@ class ModelConfig(BaseModel):
|
|||||||
}
|
}
|
||||||
|
|
||||||
def compute_model_hash(self) -> None:
|
def compute_model_hash(self) -> None:
|
||||||
|
if not self.path or not os.path.exists(self.path):
|
||||||
|
print("File does not exist or path is empty.")
|
||||||
|
self._model_hash = hashlib.md5(b"unknown").hexdigest()
|
||||||
|
else:
|
||||||
with open(self.path, "rb") as f:
|
with open(self.path, "rb") as f:
|
||||||
file_hash = hashlib.md5()
|
file_hash = hashlib.md5()
|
||||||
while chunk := f.read(8192):
|
while chunk := f.read(8192):
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user