Provider: Local directory #10

Closed
opened 2026-03-27 21:56:07 +00:00 by antialias · 0 comments
Owner

Refactor the existing local directory photo source into the provider plugin interface (see #9).

This is the simplest provider and serves as the reference implementation for the plugin architecture.

Config Schema

{
  "path": { "type": "string", "description": "Absolute path to photos directory", "required": true },
  "recursive": { "type": "boolean", "description": "Scan subdirectories", "default": true }
}

Implementation Notes

  • Wraps the existing get_photo_list() / PHOTOS_DIR logic
  • list_photos() scans the directory for supported image extensions (jpg, png, webp, heic, bmp, tiff)
  • get_photo() opens the file with PIL
  • get_thumbnail() can return a resized version directly (fast, no network)
  • PhotoRef.id = relative file path from the configured root
  • PhotoRef.date = file mtime (or EXIF DateTimeOriginal if available)
  • No auth required
  • Auto-created as the default provider instance on first startup if no providers are configured, pointed at the Docker volume /photos

Migration

The current PHOTOS_DIR global and all direct filesystem access in server.py should be replaced with calls through this provider. Per-image settings keyed by filename should continue to work — PhotoRef.name will match the existing filenames.

Depends on #9 (core architecture).

Refactor the existing local directory photo source into the provider plugin interface (see #9). This is the simplest provider and serves as the reference implementation for the plugin architecture. ## Config Schema ```json { "path": { "type": "string", "description": "Absolute path to photos directory", "required": true }, "recursive": { "type": "boolean", "description": "Scan subdirectories", "default": true } } ``` ## Implementation Notes - Wraps the existing `get_photo_list()` / `PHOTOS_DIR` logic - `list_photos()` scans the directory for supported image extensions (jpg, png, webp, heic, bmp, tiff) - `get_photo()` opens the file with PIL - `get_thumbnail()` can return a resized version directly (fast, no network) - `PhotoRef.id` = relative file path from the configured root - `PhotoRef.date` = file mtime (or EXIF DateTimeOriginal if available) - No auth required - Auto-created as the default provider instance on first startup if no providers are configured, pointed at the Docker volume `/photos` ## Migration The current `PHOTOS_DIR` global and all direct filesystem access in `server.py` should be replaced with calls through this provider. Per-image settings keyed by filename should continue to work — `PhotoRef.name` will match the existing filenames. Depends on #9 (core architecture).
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: antialias/eink-photo-frame#10