mirror of
https://github.com/MrSleeps/jellyfin-scene-search.git
synced 2026-11-17 23:41:28 +00:00
Track retained-library removals as index changes
This commit is contained in:
@@ -553,6 +553,7 @@ def _index_library(
|
||||
indexed = 0
|
||||
skipped = 0
|
||||
failed = 0
|
||||
pruned = 0
|
||||
current_item_ids: set[str] = set()
|
||||
|
||||
if progress is not None:
|
||||
@@ -597,6 +598,7 @@ def _index_library(
|
||||
).fetchone()
|
||||
if existing:
|
||||
con.execute("DELETE FROM media WHERE id = ?", (existing["id"],))
|
||||
pruned += 1
|
||||
shutil.rmtree(
|
||||
settings.thumbs_dir / jellyfin_media_id(item_id),
|
||||
ignore_errors=True,
|
||||
@@ -823,11 +825,11 @@ def _index_library(
|
||||
f"{summary.get('Name') or summary.get('Id')}: {exc}"
|
||||
)
|
||||
|
||||
pruned = 0
|
||||
if limit is None:
|
||||
pruned = _reconcile_library(library_id, current_item_ids)
|
||||
if pruned:
|
||||
print(f" pruned {pruned} stale item(s) no longer present in Jellyfin")
|
||||
reconciled = _reconcile_library(library_id, current_item_ids)
|
||||
pruned += reconciled
|
||||
if reconciled:
|
||||
print(f" pruned {reconciled} stale item(s) no longer present in Jellyfin")
|
||||
else:
|
||||
print(" limited run: stale-item reconciliation skipped")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user