diff options
| author | Paul Buetow <paul@buetow.org> | 2026-06-24 10:45:28 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-06-24 10:45:28 +0300 |
| commit | 6697431d3855d3030b35c2ce232c9ea0e9282ba7 (patch) | |
| tree | 8e36cce1db02a40ee0954bd552ed43cb4ff2fe21 /src/lib/archive.source.sh | |
| parent | 6dfc0f1a9521cc4afe4941fc1328eec014b760a7 (diff) | |
Split album-metadata.source.sh into focused modules (6r0)
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>
Diffstat (limited to 'src/lib/archive.source.sh')
| -rw-r--r-- | src/lib/archive.source.sh | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/lib/archive.source.sh b/src/lib/archive.source.sh index b53a782..c27c65c 100644 --- a/src/lib/archive.source.sh +++ b/src/lib/archive.source.sh @@ -1,3 +1,31 @@ +# Tarball creation plus the naming helpers that decide what the archive file is +# called. The naming helpers (tarball_name_plan / generated_tarball_name) were +# moved here from album-metadata.source.sh (task 6r0): naming the archive is part +# of this module's tarball concern, alongside tarball() which writes it. The +# planned-name variant is consumed by the dry-run preview; the generated variant +# (with a real timestamp slug) is consumed by the album coordinator when it +# actually creates the archive. Behaviour and signatures are unchanged. + +# Print the tarball name as it will appear in the dry-run plan: the incoming +# directory's basename, a literal "<timestamp>" placeholder, and the suffix. +tarball_name_plan() { + local base + + base=$(basename "$INCOMING_DIR") + printf '%s-<timestamp>%s\n' "$base" "$TARBALL_SUFFIX" +} + +# Print the real tarball name used at generation time: the incoming directory's +# basename, the current timestamp slug, and the configured suffix. +generated_tarball_name() { + local base + local timestamp + + base=$(basename "$INCOMING_DIR") + timestamp=$(current_timestamp_slug) + printf '%s-%s%s\n' "$base" "$timestamp" "$TARBALL_SUFFIX" +} + tarball() { local -r tarball_name="$1"; shift local -r tarball_suffix="$TARBALL_SUFFIX" |
