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.
 
 
 
 
 

107 lines
2.9 KiB

#!/bin/bash
IN="/Users/chris/Pictures/digikam/pendel"
OUT="/Users/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 023 : Import single tour from import directory and rebuild gps.csv"
echo " import.sh all: Rebuild out/ completetly. All tour directories must exist in the import folder. BE CAREFUL!!!"
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 in $OUT..."
# clear file content
> $OUT/gps.csv
# renew content by images in out
total=0
for file in $OUT/*; do
fname=$(basename $file)
pat="^[0-9].*\.jpg"
if [[ $fname =~ $pat ]];
then
let "total++"
echo -ne " $total\033[0K\r"
title=$(exiftool -title -t -S $file)
if [[ $title == *" - "* ]]
then
title1=$(exiftool -title -t -S $file | sed 's/\(.*\) - .*/\1/')
title2=$(exiftool -title -t -S $file | sed 's/.* - \(.*\)/\1/')
else
title1=$title
title2=$(exiftool -description -t -S $file)
fi
part3=$(exiftool -filename -gpsposition -n -s -t -S -q -f $file)
echo "WERT=$part1 $part2 $part3 $title1 $itle2"
echo -e "$part3\t$title1\t$title2" >> $OUT/gps.csv
fi
done
echo "Wrote $total lines"
chmod 664 $OUT/gps.csv
fi
echo Done.