Arbeitsverzeichnis für Pendel-Redaktion. Beinhaltet Skripte sowie alle Pendel-Inhalte.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

78 lines
2.1 KiB

#!/bin/bash
IN="/home/chris/Pictures/digikam/pendel"
OUT="/home/chris/kollegen/pendel/out"
# case in-sensitive matching
shopt -s nocaseglob
if [ -z "$1" ]
then
echo "Add new pendel tour(s) to out/ by importing and resizing new images."
echo "In the out folder for all existing tours the images and tile images must exists. File gps.csv will be recreated with every call."
echo "Usage:"
echo " import.sh all: Rebuild out/ completetly. All tour directories must exist in the import folder."
echo " import 023 : Import single tour from import directory and rebuild gps.csv"
echo "Configuration:"
echo " Import folder: $IN"
echo " Out folder : $OUT"
exit 0
fi
# Renew complete out
if [ "$1" = "all" ]
then
echo Rebuild $OUT...
rm $OUT -r
mkdir $OUT
echo Copy images...
find $IN -regex $IN/[0-9][0-9][0-9]/[0-9].*\.jpg | xargs -L1 -I{} cp "{}" $OUT/
echo Rezise images to 1800x1200...
find $OUT -regex $OUT/[0-9].*\.jpg -printf "%f\n\r" | xargs -L1 -I{} convert -resize 1800x1200 -quality 70% $OUT/"{}" $OUT/"{}"
echo Copy tile images...
find $IN -regex $IN/[0-9][0-9][0-9]/tile_[0-9].*\.jpg | xargs -L1 -I{} cp "{}" $OUT/
echo Change file permissions to rw-rw-r--
chmod 664 $OUT/*
else
echo Add "$1" to $OUT
if [ ! -e "$OUT" ]
then echo Create "$OUT"
mkdir "$OUT"
fi
for file in $IN/$1/*; do
fname=$(basename $file)
pat="^[0-9].*\.jpg"
if [[ $fname =~ $pat ]];
then
echo Copy, convert and chmod $fname...
cp $file "$OUT"
convert -resize 1800x1200 -quality 70% $OUT/$fname $OUT/$fname
chmod 664 $OUT/$fname
else
pat="^tile_[0-9].*\.jpg"
if [[ $fname =~ $pat ]];
then
echo Copy and chmod $fname...
cp $file "$OUT"
chmod 664 $OUT/$fname
fi
fi
done
echo Create and chmod gps.csv...
find $OUT -regex $OUT/[0-9].*\.jpg | sort | xargs exiftool -filename -gpsposition -title -description -n -s -t -S -q -f > $OUT/gps.csv
chmod 664 $OUT/gps.csv
fi
echo Done.