summaryrefslogtreecommitdiff
path: root/src/lib/metadata-cache.source.sh
AgeCommit message (Collapse)Author
2026-06-24Split album-metadata.source.sh into focused modules (6r0)Paul Buetow
album-metadata.source.sh aggregated six unrelated concerns. Move each along its existing seam (pure mechanical move, no logic changes): - EXIF presentation (photo_exif_details_html, tooltip helpers, the _photo_exif_values_to wrapper) stays in album-metadata.source.sh, which is now EXIF-presentation only. - File counting (count_files, count_incoming_images, count_tree_files) -> image.source.sh, which already owns incoming_image_files; count_incoming_images is a direct wrapper of it. - Tarball naming (tarball_name_plan, generated_tarball_name) -> archive.source.sh, which already owns tarball()/resolve_tar_opts. - Generation metadata + JSON (_collect_generation_metadata, _generation_metadata_json, write_generation_metadata) -> new generation-metadata.source.sh. - Dry-run (dry_run, collect_dry_run_*, print_dry_run_plan) -> new dry-run.source.sh. - clear_exif_cache -> metadata-cache.source.sh, next to the cache primitive cached_photo_identify_output. LIB_SOURCES (Justfile + src/shuriken.sh): insert generation-metadata and dry-run right after album-metadata, before album-render/album. They depend on image, archive, template and metadata-cache (all earlier or runtime-only calls), and are consumed by the album coordinator and the dry-run CLI action, which come later. bin/shuriken regenerated via just build. File-header comments updated to reflect the new homes. just test, just shellcheck, just check-generated and git diff --check all pass. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-24Promote single canonical identify-stream EXIF parser into metadata-cache (8r0)Paul Buetow
The `identify -verbose` EXIF-line regex and its array-fill loop were duplicated in three places that had already drifted: album-metadata's photo_exif_details_html and _photo_exif_values_to (exif: only) and stats-aggregate's _stats_parse_identify_stream (exif: plus a native Geometry -> __geometry path). Promote one canonical parser, photo_exif_values_to, into metadata-cache.source.sh next to its sibling cache primitive cached_photo_identify_output. It reads an identify stream from stdin and fills a nameref associative array; it is a strict superset of all three former sites (bare exif: tag keys plus the synthetic __geometry key). - stats accumulate_photo_stats now calls photo_exif_values_to (stdin); _stats_parse_identify_stream is removed. - album _photo_exif_values_to is a thin wrapper that pipes cached_photo_identify_output through the canonical parser. - album photo_exif_details_html consumes the same parser and skips the __geometry key it does not display. metadata-cache is sourced before both consumers in LIB_SOURCES, so the canonical parser is available at use time. Regenerated bin/shuriken via `just build`. Added test_shared_identify_parser_returns_exif_and_geometry asserting one parse yields both an exif: key and __geometry. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-17pn0 decouple stats from album internalsPaul Buetow
Stats reached directly into album-module internals: the private global ALBUM_VIEW_PAGE_BY_PHOTO and the EXIF cache reader cached_photo_identify_output. Introduce a clean boundary, behaviour and generated HTML byte-identical. - Promote the EXIF identify cache primitive (cached_photo_identify_output plus its private helpers photo_cache_signature and print_cached_photo_identify_output) out of album-metadata.source.sh into a new shared src/lib/metadata-cache.source.sh, sourced before both album and stats (right after metadata-label in LIB_SOURCES). It is a low-level metadata primitive used by both consumers, so it no longer belongs to album internals. Signature/behaviour unchanged. - Add album_view_page_for_photo accessor in album-render.source.sh as the documented public API; keep ALBUM_VIEW_PAGE_BY_PHOTO as the album's private backing store. stats-filter-album.source.sh now calls the accessor instead of indexing the global, so a change to album page naming/caching stays contained in the album module. - Add test_album_stats_decoupling_boundary asserting the accessor returns the backing-store value and that the assembled bin/shuriken keeps the cache primitive in the shared module and no longer indexes the global from the stats filter section. Existing stats/album tests unchanged. Verified: 3-image fixture (STATS_PAGE=yes, fixed seed) diff -r of stashed original vs new build is byte-identical across all 47 dist files (only the inherent generated_at timestamp normalized). just test, just shellcheck, just check-generated and git diff --check all pass. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>