summaryrefslogtreecommitdiff
path: root/src/lib/album-render.source.sh
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-06-24 21:17:01 +0300
committerPaul Buetow <paul@buetow.org>2026-06-24 21:17:01 +0300
commitfe89919d47296844364323e5b1dd9ce25511f3dd (patch)
treecb8976ae64b6faf6edf32d6a06981558b0aa2d3b /src/lib/album-render.source.sh
parent3b0ac59ded124ad8c8038ef6b1b6094a495a04c2 (diff)
Extract shared list_photos/pick_random_photo helper (br0)
Collapse the duplicated "find photos, error on empty, random_index by ctx, return one" pattern into a single photo-list.source.sh exposing list_photos <dir> and pick_random_photo <dir> <ctx>. Consumers in album-photo-select, album-render, image-pipeline and stats-render now call the shared helpers; _stats_load_background_photos keeps its caching via a cached list_photos call rather than re-listing per filter page. Per-call-site random_index ctx strings are preserved, so selection semantics are unchanged. Sourced before its consumers in LIB_SOURCES (Justfile + src/shuriken.sh); bin/shuriken regenerated. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Diffstat (limited to 'src/lib/album-render.source.sh')
-rw-r--r--src/lib/album-render.source.sh8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/lib/album-render.source.sh b/src/lib/album-render.source.sh
index e039b07..4c65f69 100644
--- a/src/lib/album-render.source.sh
+++ b/src/lib/album-render.source.sh
@@ -5,8 +5,10 @@
# bundle now live in siblings, all sourced before this file:
# - album-tile-layout.source.sh (tile_layout_for/build_tile_block/...)
# - album-thumbnail-html.source.sh (build_preview_thumbnail/append_preview_grid)
-# - album-photo-select.source.sh (album_photo_files/randomphoto/splash/...)
-# This module calls into all three at runtime; all libs are sourced before any
+# - album-photo-select.source.sh (album_photo_files/album_page_records/splash)
+# The generic "pick one seeded-random photo from a dir" used for page backgrounds
+# now comes from the shared pick_random_photo (photo-list.source.sh, task br0).
+# This module calls into all of these at runtime; all libs are sourced before any
# code runs, so the cross-module calls resolve regardless of source order.
#
# Maps each album photo filename to its view-page basename ("<page>-<preview>")
@@ -39,7 +41,7 @@ start_preview_page() {
local -r header_bar="$1"; shift
local background_image
- background_image=$(randomphoto "$photos_dir" "$page_name")
+ background_image=$(pick_random_photo "$photos_dir" "$page_name")
template header "$page_name.html" \
html_dir "$html_dir" \
backhref "$backhref" \