summaryrefslogtreecommitdiff
path: root/src/lib/album-metadata.source.sh
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-06-17 21:35:21 +0300
committerPaul Buetow <paul@buetow.org>2026-06-17 21:35:21 +0300
commit25aff490d739290602b28bdc53936dd3ea6ed939 (patch)
treedb6b521d3e5281d5edec1aa8588b48192e3a0f4d /src/lib/album-metadata.source.sh
parent6109e2a6f5bc45c3c4080259bd09a1e3dc48ea4d (diff)
mn0 share camera Make+Model dedup helper
The rule that joins a camera's EXIF Make + Model into one label while avoiding a duplicated manufacturer prefix (e.g. "Canon Canon EOS 5D" -> "Canon EOS 5D") was implemented independently in the album tooltip builder and the stats leaderboard tally. Extract it into a single shared helper camera_label_from_make_model in the new src/lib/metadata-label.source.sh, sourced before both callers. Both prior implementations were behavior-identical (empty model -> make, empty make -> model, exact/prefix dedup, case-sensitive), so this is a pure DRY refactor with no observable output change. Added a focused unit test covering dedup, plain concatenation and the empty-field edge cases. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Diffstat (limited to 'src/lib/album-metadata.source.sh')
-rw-r--r--src/lib/album-metadata.source.sh18
1 files changed, 3 insertions, 15 deletions
diff --git a/src/lib/album-metadata.source.sh b/src/lib/album-metadata.source.sh
index 2078a85..cc500ae 100644
--- a/src/lib/album-metadata.source.sh
+++ b/src/lib/album-metadata.source.sh
@@ -169,21 +169,9 @@ _photo_exif_tooltip_text_from_values() {
make="${values_ref[Make]:-}"
model="${values_ref[Model]:-}"
- camera="$make"
- if [ -n "$model" ]; then
- if [ -n "$make" ]; then
- case "$model" in
- "$make"|"$make "*)
- camera="$model"
- ;;
- *)
- camera="$make $model"
- ;;
- esac
- else
- camera="$model"
- fi
- fi
+ # Dedup the manufacturer prefix via the shared helper (task mn0) so this
+ # tooltip and the stats leaderboard derive identical camera labels.
+ camera=$(camera_label_from_make_model "$make" "$model")
_first_exif_value_to aperture "$exif_name" FNumber ApertureValue
_first_exif_value_to iso "$exif_name" \