summaryrefslogtreecommitdiffstats
path: root/scripts/update.rb
diff options
context:
space:
mode:
authorKen D'Ambrosio <ken@jots.org>2026-05-12 14:45:00 +0000
committerKen D'Ambrosio <ken@jots.org>2026-05-12 14:45:00 +0000
commitb47fdda4fe1bf6fe90d0ba30eedac435dde7c034 (patch)
tree81f1921bedaf9e86e65d511c6bacbddd4697c7df /scripts/update.rb
parent67a19fed3ff7ff9a40d489863fcef432cdba0913 (diff)
Add photo counts, EXIF details, video duration badges, slideshow launcher UI
- Album cards show recursive photo count (bubbles up through sub-albums). - Lightbox info panel shows camera, aperture, shutter speed, and ISO; update.rb now extracts and stores these EXIF fields. - Video thumbnail cards show a duration badge (e.g. "1:23"). - Slideshow launcher redesigned: button on its own line, with Shuffle / Full screen / Interval options on a second line, all inside a rounded border to make the grouping clear. - Fixed album-actions alignment so Interval sits level with the checkboxes. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'scripts/update.rb')
-rw-r--r--scripts/update.rb26
1 files changed, 20 insertions, 6 deletions
diff --git a/scripts/update.rb b/scripts/update.rb
index 9052341..0b052ba 100644
--- a/scripts/update.rb
+++ b/scripts/update.rb
@@ -80,15 +80,29 @@ end
# ── Metadata enrichment ────────────────────────────────────────────────────────
def enrich_image(full, name, meta)
- # EXIF date (skip if already recorded)
- if meta['taken_at'].nil?
+ needs_exif = meta['taken_at'].nil? || meta['camera'].nil? ||
+ meta['aperture'].nil? || meta['shutter'].nil? || meta['iso'].nil?
+ if needs_exif
begin
exif = MiniExiftool.new(full, numerical: false)
- raw = exif.date_time_original || exif.create_date || exif.date_time
- if raw
- meta['taken_at'] = raw.respond_to?(:strftime) ? raw.strftime('%Y-%m-%dT%H:%M:%S') : raw.to_s
- puts " #{name}: taken_at = #{meta['taken_at']}"
+
+ if meta['taken_at'].nil?
+ raw = exif.date_time_original || exif.create_date || exif.date_time
+ if raw
+ meta['taken_at'] = raw.respond_to?(:strftime) ? raw.strftime('%Y-%m-%dT%H:%M:%S') : raw.to_s
+ puts " #{name}: taken_at = #{meta['taken_at']}"
+ end
+ end
+
+ if meta['camera'].nil?
+ make = exif.make.to_s.strip
+ model = exif.model.to_s.strip
+ cam = model.downcase.start_with?(make.downcase) ? model : [make, model].reject(&:empty?).join(' ')
+ meta['camera'] = cam.empty? ? nil : cam
end
+ meta['aperture'] ||= exif.f_number ? "f/#{exif.f_number}" : nil
+ meta['shutter'] ||= exif.exposure_time&.to_s
+ meta['iso'] ||= (exif.iso_speed_ratings || exif.iso)&.to_i
rescue StandardError => e
warn " #{name}: EXIF error — #{e.message}"
end