Skip to content

Pair JPEG+DNG twins as one catalog photo - #21

Merged
mauricewipf merged 2 commits into
masterfrom
cursor/jpeg-dng-pairing-fa3f
Sep 5, 2026
Merged

mauricewipf merged 2 commits into
masterfrom
cursor/jpeg-dng-pairing-fa3f

Conversation

@mauricewipf

Copy link
Copy Markdown
Owner

Closes #4

Problem

Camera dumps land as JPEG+DNG twins with the same stem. Hallward indexed both as separate stills, so the album grid showed two cells per shot.

Solution

Pair matching JPEG+DNG files as one catalog Photo with two paths:

  • Primary path (relpath) — the developed JPEG shown in the grid, thumbs, and viewer
  • Raw path (raw_relpath) — the DNG twin kept on disk and in catalog identity, but not indexed as its own grid cell

This mirrors the existing Live Photo pattern (still indexed, .MOV skipped) but stores the RAW attachment in SQLite because both files are stills.

Indexing

  • DNG files with a same-stem JPEG sibling are skipped during walk (like Live Photo motion files)
  • JPEG rows get raw_relpath set when a DNG twin exists
  • Warm-skip logic also compares raw_relpath so adding/removing a twin triggers re-index
  • Edited sidecar stems (*-edited, *-edited-N) are excluded from pairing

File operations

Delete, copy, cut, and paste treat the DNG companion like a Live Photo .MOV: it moves/deletes with the shown JPEG.

Schema

Adds nullable raw_relpath TEXT to photos, migrated automatically on catalog open.

Out of scope (per issue)

Test plan

  • cargo test --locked — all 188 tests green
  • Unit: media pairing detection, edited-sidecar exclusion, standalone DNG/JPEG
  • Unit: index::jpeg_dng_twins_index_as_one_photo — one row, correct raw_relpath
  • Unit: delete removes both JPEG and DNG; reindex leaves catalog empty
  • Unit: copy/cut paste moves DNG with JPEG; destination row has raw_relpath
  • Existing Live Photo copy/cut/delete tests unchanged
Open in Web Open in Cursor 

cursoragent and others added 2 commits September 5, 2026 21:23
Camera dumps often include a developed JPEG and a matching DNG raw
file with the same stem. Index both as a single Photo row: the JPEG
is the primary path shown in the grid, with raw_relpath pointing at
the DNG kept on disk.

- Add raw_relpath column with migration on catalog open
- Skip standalone DNG indexing when a JPEG twin exists (mirrors Live Photo MOV skip)
- Exclude edited sidecar stems from pairing
- Delete/copy/cut/paste move DNG companions with the shown still
- Unit tests for pairing, indexing, delete, and clipboard

Co-authored-by: Maurice Wipf <mauricewipf@users.noreply.github.com>
Gate dng_twin_for_still on is_jpeg_dng_still so a lone DNG is not
treated as its own RAW companion. Add regression tests for orphan.DNG.

Co-authored-by: Maurice Wipf <mauricewipf@users.noreply.github.com>
@mauricewipf
mauricewipf merged commit e2aeda9 into master Sep 5, 2026
1 check passed
@cursor
cursor Bot deleted the cursor/jpeg-dng-pairing-fa3f branch September 5, 2026 21:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Pair JPEG+DNG twins as one photo

2 participants