Skip to content

Album card should show the image/video split returned by /index_metadata #368

Description

@lstein

GET /index_metadata/{album_key} returns image_count and video_count alongside filename_count (added in #360), but no frontend code reads them — the album card still shows a single total.

The motivation for the split was that once videos are indexed, the file count jumps for reasons the user can't see. "124 files" is ambiguous; "120 images, 4 videos" explains itself.

What's already done

Backend, in photomap/backend/routers/index.py:

class EmbeddingsIndexMetadata(BaseModel):
    filename_count: int
    embeddings_path: str
    last_modified: float
    image_count: int = 0
    video_count: int = 0

Derived from filename suffixes via is_video(), so indexes written before video support report image_count == filename_count and video_count == 0. Pinned by test_index_metadata_splits_images_and_videos and test_index_metadata_reports_legacy_indexes_as_all_images.

What's left

Consume the fields in the album card in photomap/frontend/static/javascript/album-manager.js.

Suggested display rule:

  • video_count == 0 → keep the current single count verbatim, so image-only albums are untouched
  • otherwise → "N images, M videos"

Worth deciding whether the singular/plural and zero-image case ("4 videos") are handled, and whether anywhere else showing a count (settings, the update-progress toast) should match.

Needs a Jest test in tests/frontend/, per CLAUDE.md.

Context

Found during the adversarial review of #360. Not a defect there — the PR set out to return the split and did, and the plan never specified the UI wiring. Filing so the inert API surface either gets a consumer or gets reconsidered.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions