Skip to content

Commit

Permalink
Use python filtering instead of grep
Browse files Browse the repository at this point in the history
  • Loading branch information
NickM-27 committed Jul 1, 2022
1 parent 3a0310d commit 68c2b60
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions frigate/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -672,15 +672,12 @@ def get_recordings_storage_usage():
du_cmd,
capture_output=True,
)
camera_dirs: list[str] = p.stdout.decode("utf-8").split("\n")

for camera_name in current_app.frigate_config.cameras.keys():
camera_mb = 0
filter_cmd = ["grep", "-P", camera_name]
summary: sp.CompletedProcess = sp.run(
filter_cmd, input=p.stdout, capture_output=True
)

for line in summary.stdout.decode("utf-8").split("\n"):
for line in filter(lambda dir: camera_name in dir, camera_dirs):
abbrev = line.split("\t")[0]

if abbrev:
Expand Down

0 comments on commit 68c2b60

Please sign in to comment.