Compare commits

...
2 Commits
+7 -4
View File
@@ -98,7 +98,6 @@ def sync_recordings(
{"id": recording.id, "path": recording.path} {"id": recording.id, "path": recording.path}
) )
result.files_checked += recordings_count
result.orphans_found += len(recordings_to_delete) result.orphans_found += len(recordings_to_delete)
result.orphan_paths.extend( result.orphan_paths.extend(
[ [
@@ -173,7 +172,7 @@ def sync_recordings(
for file in files for file in files
} }
result.files_checked += len(files_on_disk) result.files_checked = len(files_on_disk)
files_to_delete: list[str] = [] files_to_delete: list[str] = []
for file in files_on_disk: for file in files_on_disk:
@@ -198,10 +197,14 @@ def sync_recordings(
result.aborted = True result.aborted = True
return result return result
if files_to_delete and not dry_run: if dry_run:
logger.info( logger.info(
f"Deleting {len(files_to_delete)} recordings files with missing DB entries" f"Recordings sync (dry run): Found {len(files_to_delete)} orphaned files"
) )
return result
# Delete orphans
logger.info(f"Deleting {len(files_to_delete)} orphaned recordings files")
for file in files_to_delete: for file in files_to_delete:
try: try:
os.unlink(file) os.unlink(file)