summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Buetow (mars.fritz.box) <paul@buetow.org>2013-12-22 13:17:55 +0100
committerPaul Buetow (mars.fritz.box) <paul@buetow.org>2013-12-22 13:17:55 +0100
commit73c5f00efba75a67c0bbc001bfb09cea103d25f0 (patch)
treeff070788976a50bb920b482b9aa1fdc29d83cc52
parentf7f2ee5ed9f395fec5f0ac0dd0ff18ac93ef6d95 (diff)
can handle recursive incoming directories
-rwxr-xr-xphotoalbum.sh15
1 files changed, 13 insertions, 2 deletions
diff --git a/photoalbum.sh b/photoalbum.sh
index 39e149e..e579bdc 100755
--- a/photoalbum.sh
+++ b/photoalbum.sh
@@ -30,9 +30,20 @@ function template () {
function scale () {
cd ${INCOMING} && find ./ -type f | sort | while read photo; do
if [ ! -f "../photos/${photo}" ]; then
- echo "Scaling ${photo}"
+
+ # Flatten directories / to __
+ if [[ "${photo}" =~ / ]]; then
+ destphoto="${photo//\//__}"
+ else
+ destphoto="${photo}"
+ fi
+
+ destphoto="${destphoto//./}"
+
+ echo "Scaling ${photo} to ../photos/${destphoto}"
+
convert -auto-orient \
- -geometry ${GEOMETRY} "${photo}" "../photos/${photo}"
+ -geometry ${GEOMETRY} "${photo}" "../photos/${destphoto}"
fi
done