summaryrefslogtreecommitdiff
path: root/src
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
parentfad3ea8d270527bd9728363614ac72aeb087e9f2 (diff)
add SHUFFLE option
Diffstat (limited to 'src')
-rw-r--r--src/photoalbum.default.conf2
-rwxr-xr-xsrc/photoalbum.sh11
2 files changed, 11 insertions, 2 deletions
diff --git a/src/photoalbum.default.conf b/src/photoalbum.default.conf
index 51cf886..51b2118 100644
--- a/src/photoalbum.default.conf
+++ b/src/photoalbum.default.conf
@@ -7,6 +7,8 @@ THUMBHEIGHT=300
HEIGHT=1200
# Max previews per page.
MAXPREVIEWS=40
+# Randomly shuffle all previews.
+# SHUFFLE=yes
# Diverse directories, need to be full paths, not relative!
INCOMING_DIR=$(pwd)/incoming
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++