Appling code formating
This commit is contained in:
112
piwigo_thumbgen.sh
Normal file → Executable file
112
piwigo_thumbgen.sh
Normal file → Executable file
@@ -24,68 +24,68 @@ STARTTIME=$(date +%s)
|
|||||||
|
|
||||||
for file in "$sourceDir"/**/*.{jpg,JPG,jpeg,JPEG}
|
for file in "$sourceDir"/**/*.{jpg,JPG,jpeg,JPEG}
|
||||||
do
|
do
|
||||||
if [[ ! -f "$file" ]]
|
if [[ ! -f "$file" ]]
|
||||||
then
|
then
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# replace all blanks and brakets
|
# replace all blanks and brakets
|
||||||
exp='[() ]'
|
exp='[() ]'
|
||||||
if [[ "$file" =~ $exp ]]
|
if [[ "$file" =~ $exp ]]
|
||||||
then
|
then
|
||||||
fileNew=${file//$exp/_}
|
fileNew=${file//$exp/_}
|
||||||
mv "${file}" "$fileNew"
|
mv "${file}" "$fileNew"
|
||||||
file="$fileNew"
|
file="$fileNew"
|
||||||
echo "Space replaced: ${file}"
|
echo "Space replaced: ${file}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
fnNoExt="${file%.*}"
|
fnNoExt="${file%.*}"
|
||||||
fnExt="${file##*.}"
|
fnExt="${file##*.}"
|
||||||
fnPath="${file%/*}"
|
fnPath="${file%/*}"
|
||||||
fnPath="${fnPath#$sourceDir}"
|
fnPath="${fnPath#$sourceDir}"
|
||||||
fnNoExt="${fnNoExt#$sourceDir}"
|
fnNoExt="${fnNoExt#$sourceDir}"
|
||||||
|
|
||||||
#echo "${fnPath} ${fnNoExt}"
|
#echo "${fnPath} ${fnNoExt}"
|
||||||
|
|
||||||
#If the medium thumbnail exists we assume that the rest also exists and skip this image
|
#If the medium thumbnail exists we assume that the rest also exists and skip this image
|
||||||
if [ ! -f "${destDir}${fnNoExt}-me.${fnExt}" ]; then
|
if [ ! -f "${destDir}${fnNoExt}-me.${fnExt}" ]; then
|
||||||
|
|
||||||
mkdir -p "${destDir}${fnPath}"
|
|
||||||
|
|
||||||
#Error checking
|
|
||||||
result=$(jpeginfo -c "$file")
|
|
||||||
if [[ $result != *"[OK]"* ]]
|
|
||||||
then
|
|
||||||
echo $result
|
|
||||||
fi
|
|
||||||
|
|
||||||
#auto rotate source image according to exif orientation information
|
mkdir -p "${destDir}${fnPath}"
|
||||||
orient=$(exiftool -Orientation "${file}")
|
|
||||||
if [[ $orient != *"normal"* ]]; then
|
|
||||||
quali=$(identify -format '%Q' "${file}")
|
|
||||||
if [ "$quali" -le "0" ]; then
|
|
||||||
quali=94
|
|
||||||
fi
|
|
||||||
echo "rotate with quality $quali preserving timestamp: $file"
|
|
||||||
TIMESTAMP="$( ls -l --time-style='+%Y%m%d%H%M.%S' "${file}" | cut --delimiter=' ' --fields=6 )"
|
|
||||||
mogrify -auto-orient -quality ${quali} "${file}"
|
|
||||||
touch -t ${TIMESTAMP} "${file}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
#echo "MISSING! ${destDir}${fnNoExt}-me.${fnExt}"
|
#Error checking
|
||||||
#Store correctly oriented base image (medium) in memory. All other thumbnails are created from this
|
result=$(jpeginfo -c "$file")
|
||||||
convert "${file}" -auto-orient -thumbnail 1008x756^ -write mpr:baseline +delete \
|
if [[ $result != *"[OK]"* ]]
|
||||||
mpr:baseline -write "${destDir}${fnNoExt}-la.${fnExt}" +delete \
|
then
|
||||||
mpr:baseline -thumbnail 792x594 -write "${destDir}${fnNoExt}-me.${fnExt}" +delete \
|
echo $result
|
||||||
mpr:baseline -thumbnail 150x9999 -write "${destDir}${fnNoExt}-cu_s150x9999.${fnExt}" +delete \
|
fi
|
||||||
mpr:baseline -thumbnail 144x144 -write "${destDir}${fnNoExt}-th.${fnExt}" +delete \
|
|
||||||
mpr:baseline -define jpeg:size=144x144 -thumbnail 120x120^ -gravity center -extent 120x120 "${destDir}${fnNoExt}-sq.${fnExt}"
|
#auto rotate source image according to exif orientation information
|
||||||
fi
|
orient=$(exiftool -Orientation "${file}")
|
||||||
counter=$[$counter +1]
|
if [[ $orient != *"normal"* ]]; then
|
||||||
if [ $(($counter%100)) -eq 0 ]; then
|
quali=$(identify -format '%Q' "${file}")
|
||||||
ENDTIME=$(date +%s)
|
if [ "$quali" -le "0" ]; then
|
||||||
echo "Processed: ${counter} - Executing for $((($ENDTIME - $STARTTIME)/60)) minutes"
|
quali=94
|
||||||
fi
|
fi
|
||||||
|
echo "rotate with quality $quali preserving timestamp: $file"
|
||||||
|
TIMESTAMP="$( ls -l --time-style='+%Y%m%d%H%M.%S' "${file}" | cut --delimiter=' ' --fields=6 )"
|
||||||
|
mogrify -auto-orient -quality ${quali} "${file}"
|
||||||
|
touch -t ${TIMESTAMP} "${file}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
#echo "MISSING! ${destDir}${fnNoExt}-me.${fnExt}"
|
||||||
|
#Store correctly oriented base image (medium) in memory. All other thumbnails are created from this
|
||||||
|
convert "${file}" -auto-orient -thumbnail 1008x756^ -write mpr:baseline +delete \
|
||||||
|
mpr:baseline -write "${destDir}${fnNoExt}-la.${fnExt}" +delete \
|
||||||
|
mpr:baseline -thumbnail 792x594 -write "${destDir}${fnNoExt}-me.${fnExt}" +delete \
|
||||||
|
mpr:baseline -thumbnail 150x9999 -write "${destDir}${fnNoExt}-cu_s150x9999.${fnExt}" +delete \
|
||||||
|
mpr:baseline -thumbnail 144x144 -write "${destDir}${fnNoExt}-th.${fnExt}" +delete \
|
||||||
|
mpr:baseline -define jpeg:size=144x144 -thumbnail 120x120^ -gravity center -extent 120x120 "${destDir}${fnNoExt}-sq.${fnExt}"
|
||||||
|
fi
|
||||||
|
counter=$[$counter +1]
|
||||||
|
if [ $(($counter%100)) -eq 0 ]; then
|
||||||
|
ENDTIME=$(date +%s)
|
||||||
|
echo "Processed: ${counter} - Executing for $((($ENDTIME - $STARTTIME)/60)) minutes"
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
chown -R www-data:pi ${destDir}../
|
chown -R www-data:pi ${destDir}../
|
||||||
|
@@ -5,18 +5,18 @@ subCatId=1
|
|||||||
|
|
||||||
if [ "$1" != "" ] && [ "$2" != "" ]
|
if [ "$1" != "" ] && [ "$2" != "" ]
|
||||||
then
|
then
|
||||||
catId=$1
|
catId=$1
|
||||||
subCatId=$2
|
subCatId=$2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
perl -w /root/script/piwigo_refresh.pl \
|
perl -w /root/script/piwigo_refresh.pl \
|
||||||
--base_url=https://change.me/gallery \
|
--base_url=https://change.me/gallery \
|
||||||
--site=2 \
|
--site=2 \
|
||||||
--user="-change me-" \
|
--user="-change me-" \
|
||||||
--password="-change me-" \
|
--password="-change me-" \
|
||||||
--directory="/var/www/piwigo/network" \
|
--directory="/var/www/piwigo/network" \
|
||||||
--caddie=0 \
|
--caddie=0 \
|
||||||
--privacy_level=4 \
|
--privacy_level=4 \
|
||||||
--cat=${catId} \
|
--cat=${catId} \
|
||||||
--subcat=${subCatId}
|
--subcat=${subCatId}
|
||||||
|
10
piwisync.sh
10
piwisync.sh
@@ -4,9 +4,9 @@ myyear=$(date "+%Y")
|
|||||||
|
|
||||||
if [ "$1" != "" ]
|
if [ "$1" != "" ]
|
||||||
then
|
then
|
||||||
myyear=$1
|
myyear=$1
|
||||||
#echo Error subdir parameter missing
|
#echo Error subdir parameter missing
|
||||||
#exit 1;
|
#exit 1;
|
||||||
fi
|
fi
|
||||||
|
|
||||||
subDir="$myyear/"
|
subDir="$myyear/"
|
||||||
@@ -15,8 +15,8 @@ networkPhotoRoot="/home/network/Qbilder/photos/${subDir}"
|
|||||||
|
|
||||||
if [ ! -e ${networkPhotoRoot} ]
|
if [ ! -e ${networkPhotoRoot} ]
|
||||||
then
|
then
|
||||||
echo "${networkPhotoRoot} not found"
|
echo "${networkPhotoRoot} not found"
|
||||||
exit 1;
|
exit 1;
|
||||||
fi
|
fi
|
||||||
|
|
||||||
/root/script/piwigo_thumbgen.sh "${networkPhotoRoot}" "${piwigoThumbRoot}"
|
/root/script/piwigo_thumbgen.sh "${networkPhotoRoot}" "${piwigoThumbRoot}"
|
||||||
|
Reference in New Issue
Block a user