summaryrefslogtreecommitdiff
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
parentfad3ea8d270527bd9728363614ac72aeb087e9f2 (diff)
add SHUFFLE option
-rw-r--r--.version2
-rw-r--r--changelog6
-rw-r--r--share/templates/default/header.tmpl14
-rw-r--r--src/photoalbum.default.conf2
-rwxr-xr-xsrc/photoalbum.sh11
5 files changed, 26 insertions, 9 deletions
diff --git a/.version b/.version
index 8f0916f..4b9fcbe 100644
--- a/.version
+++ b/.version
@@ -1 +1 @@
-0.5.0
+0.5.1
diff --git a/changelog b/changelog
index d18ceb8..996d28a 100644
--- a/changelog
+++ b/changelog
@@ -1,3 +1,9 @@
+photoalbum (0.5.1) unstable; urgency=low
+
+ * Minor changes
+
+ -- Paul Buetow <paul@buetow.org> Tue, 22 Feb 2022 14:37:01 +0000
+
photoalbum (0.5.0) stable; urgency=low
* Major code refactoring
diff --git a/share/templates/default/header.tmpl b/share/templates/default/header.tmpl
index 4364ddd..c0c7c21 100644
--- a/share/templates/default/header.tmpl
+++ b/share/templates/default/header.tmpl
@@ -60,12 +60,14 @@ cat <<END
</head>
<body>
+END
+
+if [ "${show_header_bar}" = 'yes' ]; then
+cat <<END
<div class="header">
- <div>
- Site generated at $(date) with <a href="https://codeberg.org/foozone/photoalbum">codeberg.org/foozone/photoalbum</a>
- -
- &copy; by Paul Buetow
- </div>
- <div>${GOTO_OVERVIEW}</div>
+ Site generated at $(date) with <a href="https://codeberg.org/foozone/photoalbum">codeberg.org/foozone/photoalbum</a>
+ -
+ &copy; by Paul Buetow
</div>
END
+fi
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++