feat: scan.resolve_index with end-of-batch error

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-21 16:24:51 +02:00
parent ba8de1253e
commit d5b314f6b6
2 changed files with 24 additions and 0 deletions
+8
View File
@@ -28,3 +28,11 @@ def list_images(folder, depth=0):
results.append(str(cur / name))
results.sort(key=lambda p: natural_key(os.path.relpath(p, root)))
return results
def resolve_index(count, index):
if count == 0:
raise FileNotFoundError("No images found in folder")
if index < 0 or index >= count:
raise IndexError(f"index {index} out of range: {count} images")
return index