36 lines
996 B
Bash
36 lines
996 B
Bash
#!/bin/sh
|
|
# (c) schick Informatik
|
|
# Dieses Script lädt alle Bilder aus der angegebenen Textdatei herunter und konvertiert sie in
|
|
# C-Berry hochkant Format via convert (imagemagick)
|
|
# Achtung, die Bilder sollten alle unterschiedliche Namen haben (url)
|
|
#
|
|
IMGDIR="/home/pi/StatusBerry/download/"
|
|
OUTDIR="/home/pi/StatusBerry/img/"
|
|
IMGURLLIST="/home/pi/StatusBerry/imgFileUrlList.txt"
|
|
|
|
if [ ! -d "$IMGDIR" ]
|
|
then
|
|
echo "Directory $IMGDIR not found.."
|
|
exit 1
|
|
fi
|
|
|
|
if [ ! -f "$IMGURLLIST" ]
|
|
then
|
|
echo "Text file $IMGURLLIST with image url's not found.."
|
|
exit 1
|
|
fi
|
|
|
|
cat "$IMGURLLIST" | while read ANURL
|
|
do
|
|
# download image
|
|
wget -N -U Mozilla --directory-prefix=$IMGDIR "$ANURL"
|
|
FILENAME=$(basename $ANURL)
|
|
BASEFILENAME="${FILENAME%.*}"
|
|
# image resize and stuff
|
|
convert $IMGDIR$FILENAME -resize 240x320! -rotate 90 -depth 24 -compress None -type truecolor -units PixelsPerInch -density 72 "BMP3:$OUTDIR$BASEFILENAME.bmp"
|
|
|
|
done
|
|
|
|
|
|
|