summaryrefslogtreecommitdiff
path: root/src/photoalbum.sh
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2022-03-05 11:48:50 +0000
committerPaul Buetow <paul@buetow.org>2022-03-05 11:48:50 +0000
commite044cd54a39f38526ba7ed986df56ab2973e0329 (patch)
treebe3be0659180f8dc8bab064084a3a262c0abfc59 /src/photoalbum.sh
parentfad3ea8d270527bd9728363614ac72aeb087e9f2 (diff)
add SHUFFLE option
Diffstat (limited to 'src/photoalbum.sh')
-rwxr-xr-xsrc/photoalbum.sh11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/photoalbum.sh b/src/photoalbum.sh
index 31c96fb..0f4e0f6 100755
--- a/src/photoalbum.sh
+++ b/src/photoalbum.sh
@@ -89,6 +89,14 @@ animate-zoom
END
}
+maybe_shuffle () {
+ if [ "$SHUFFLE" = yes ]; then
+ sort -R
+ else
+ sort
+ fi
+}
+
albumhtml () {
declare photos_dir="$1" ; shift
declare html_dir="$1" ; shift
@@ -98,7 +106,6 @@ albumhtml () {
declare -i num=1
declare -i i=0
-
declare name="page-$num"
# Random background image for preview page.
@@ -106,7 +113,7 @@ albumhtml () {
export show_header_bar='yes'
template 'header' "$name.html"
- cd "$DIST_DIR/$photos_dir" && find ./ -type f | sort | sed 's;^\./;;' |
+ cd "$DIST_DIR/$photos_dir" && find ./ -type f | maybe_shuffle | sed 's;^\./;;' |
while read -r photo; do
let i++