From b47fdda4fe1bf6fe90d0ba30eedac435dde7c034 Mon Sep 17 00:00:00 2001 From: Ken D'Ambrosio Date: Tue, 12 May 2026 14:45:00 +0000 Subject: 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 --- app.rb | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'app.rb') diff --git a/app.rb b/app.rb index 2cd40b2..1fc5f69 100644 --- a/app.rb +++ b/app.rb @@ -96,6 +96,11 @@ helpers do taken_at: meta['taken_at'], width: meta['width'], height: meta['height'], + duration: meta['duration'], + camera: meta['camera'], + aperture: meta['aperture'], + shutter: meta['shutter'], + iso: meta['iso'], } end @@ -118,11 +123,36 @@ helpers do name: name, title: sub_data['title'] || name, cover: album_cover(sub_dir, sub_data), + count: media_count(sub_dir, sub_data), } end data['sort_reverse'] ? albums.reverse : albums end + def media_count(dir, data) + files = data['files'] || {} + direct = Dir.children(dir) + .count { |n| MEDIA_EXTS.include?(File.extname(n).downcase.delete_prefix('.')) && + (admin? || (files[n] || {}).fetch('visible', true)) } + sub_total = Dir.children(dir) + .select { |n| !n.start_with?('.') && File.directory?(File.join(dir, n)) } + .sum do |n| + sub_dir = File.join(dir, n) + sub_data = load_album(sub_dir) + next 0 if sub_data['visible'] == false && !admin? + media_count(sub_dir, sub_data) + end + direct + sub_total + end + + def format_duration(secs) + return nil unless secs + s = secs.to_i + h, s = s.divmod(3600) + m, s = s.divmod(60) + h > 0 ? format('%d:%02d:%02d', h, m, s) : format('%d:%02d', m, s) + end + def album_cover(dir, data) cover = data['cover'] return cover if cover && cover != '__random__' && File.exist?(File.join(dir, cover)) -- cgit v1.2.3