mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-03-25 01:28:22 +03:00
Compare commits
No commits in common. "594a70634731a32aef82b14d5b2c8041e2cef4da" and "f1a19128ed77c85c4bf5defe5cd825abaa601b24" have entirely different histories.
594a706347
...
f1a19128ed
@ -98,6 +98,7 @@ def sync_recordings(
|
||||
{"id": recording.id, "path": recording.path}
|
||||
)
|
||||
|
||||
result.files_checked += recordings_count
|
||||
result.orphans_found += len(recordings_to_delete)
|
||||
result.orphan_paths.extend(
|
||||
[
|
||||
@ -172,7 +173,7 @@ def sync_recordings(
|
||||
for file in files
|
||||
}
|
||||
|
||||
result.files_checked = len(files_on_disk)
|
||||
result.files_checked += len(files_on_disk)
|
||||
|
||||
files_to_delete: list[str] = []
|
||||
for file in files_on_disk:
|
||||
@ -197,20 +198,16 @@ def sync_recordings(
|
||||
result.aborted = True
|
||||
return result
|
||||
|
||||
if dry_run:
|
||||
if files_to_delete and not dry_run:
|
||||
logger.info(
|
||||
f"Recordings sync (dry run): Found {len(files_to_delete)} orphaned files"
|
||||
f"Deleting {len(files_to_delete)} recordings files with missing DB entries"
|
||||
)
|
||||
return result
|
||||
|
||||
# Delete orphans
|
||||
logger.info(f"Deleting {len(files_to_delete)} orphaned recordings files")
|
||||
for file in files_to_delete:
|
||||
try:
|
||||
os.unlink(file)
|
||||
result.orphans_deleted += 1
|
||||
except OSError as e:
|
||||
logger.error(f"Failed to delete {file}: {e}")
|
||||
for file in files_to_delete:
|
||||
try:
|
||||
os.unlink(file)
|
||||
result.orphans_deleted += 1
|
||||
except OSError as e:
|
||||
logger.error(f"Failed to delete {file}: {e}")
|
||||
|
||||
logger.debug("End sync recordings.")
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user