Bash scrip
Posted: Tue 10 Jul 2018 11:26 pm
Hi has any one made bash scrip to take snapshot off a ip cam and over lay in with data?
Support forum for Cumulus weather station software
https://cumulus.hosiene.co.uk/
Code: Select all
Temp: <#temp>°C - Press: <#press> hPa - Hum: <#hum>% - Wind: <#wspeed> mph(<#currentwdir>) - Rain: <#rfall> mm - UV Index: <#UV> - SolarRad: <#SolarRad> W/m² - CloudBase: <#cloudbase>.
Code: Select all
#!/bin/sh
#
#set variable yday to be like 20100208
#
#tday=$(date -d today +%Y%m%d%H%M%S);
#stamp=$(date '+DATE: %d/%m/%y%nTIME:%H:%M:%S');
tday=$(date +%Y%m%d%H%M%S);
#stamp=$(date +%Y%m%d);
#
# get weather image
wget --auth-no-challenge --http-user=xxxxxx --http-password=xxxxxxxx "http://xxx.xxx.xx.xxx/cgi/jpg/image.cgi" -O "/share/weather/sky1.jpg";
# next 2 lines add weather info
testdata="$(/bin/cat /share/weather/camdata.txt)";
testdata1=`date +"%A %d-%b-%Y %R %Z"`;
# add layers and text to image
convert -fill RoyalBlue4 -draw "fill-opacity 0.4 rectangle 0 0 1280 25" \
-fill red -draw "fill-opacity 0.6 rectangle 0 26 1280 27" \
-fill RoyalBlue4 -draw "fill-opacity 0.7 rectangle 0 695 1280 720" \
-fill red -draw "fill-opacity 0.6 rectangle 0 693 1280 694" \
-fill white -pointsize 18 -font /share/script/arialbold.ttf -draw "text 10,20 'Conlig Weather Station: $testdata1 - ICODOWNN2 - www.conligwx.org'" \
-fill yellow -pointsize 18 -draw "text 10,715 '$testdata'" /share/weather/sky1.jpg /share/weather/skywebcam.jpg
# convert image.jpg to 150kb for WUnderground
convert /share/weather/skywebcam.jpg -define jpeg:extent=150kb /share/weather/image.jpg
# ftp webcam to wunderground
lftp -e 'put /share/weather/image.jpg; bye' -u xxxxxxxx,passwordxxxx webcam.wunderground.com -d
Code: Select all
# ftp webcam to wunderground
#
lftp -e 'put /share/htdocs/weather/image.jpg; bye' -u XXXXXXXX,xxxxxxxx webcam.wunderground.com
Code: Select all
#!/bin/sh
#
# set variable yday to be like 20100208
#
# tday=$(date -d today +%Y%m%d%H%M%S);
# stamp=$(date '+DATE: %d/%m/%y%nTIME:%H:%M:%S');
tday=$(date +%Y%m%d%H%M%S);
# stamp=$(date +%Y%m%d);
#
# get weather image
wget --auth-no-challenge --http-user=xxxxx --http-password=xxxxxx "http://x.x.x.x/cgi/jpg/image.cgi" -O "/share/htdocs/weather/sky1.jpg";
# next 2 lines add weather info
#
testdata="$(/bin/cat /share/htdocs/weather/camdata.txt)";
testdata1=`date +"%A %d-%b-%Y %R %Z"`;
# convert -fill RoyalBlue4 -draw "fill-opacity 0.4 rectangle 0 0 1280 25" \
#
convert -fill RoyalBlue4 -draw "fill-opacity 0.4 rectangle 0 0 1280 25" \
-fill red -draw "fill-opacity 0.6 rectangle 0 26 1280 27" \
-fill RoyalBlue4 -draw "fill-opacity 0.7 rectangle 0 695 1280 720" \
-fill red -draw "fill-opacity 0.6 rectangle 0 693 1280 694" \
-fill white -pointsize 18 -font /share/db_backup/script/arialbold.ttf -draw "text 10,20 'Conlig Weather Station: $testdata1 - INEWTOWN20 - www.conligwx.org'" \
-fill yellow -pointsize 18 -draw "text 10,715 '$testdata'" /share/htdocs/weather/sky1.jpg /share/htdocs/weather/skywebcam.jpg
# convert image.jpg to 150kb for WUnderground
#
convert /share/htdocs/weather/skywebcam.jpg -define jpeg:extent=150kb /share/htdocs/weather/image.jpg
# add timestamp to filename for image history and video timelapse.
cp /share/htdocs/weather/sky.jpg /share/htdocs/weather/image-history/video@"$tday".jpg;
Code: Select all
#!/bin/sh
#maketimelapse movie
#
#set variable yday to be like 20100208
#
#yday=$(date +%Y%m%d %s -d $(( $(date +%s) - 86400 )));
yday=$(date -d "1 day ago" +%Y%m%d);
#
# make directory for yesterdays images
#
mkdir /share/htdocs/weather/image-history/"$yday";
# mkdir /volume1/Web/fishcam/image-history/"$yday";
#
# move yesterdays images to new directory sample image name is video@20100208000313.jpg
#
mv /share/htdocs/weather/image-history/video@"$yday"??????.jpg /share/htdocs/weather/image-history/"$yday"/;
# remove 0 byte files test script. find . -type f -size 0 | xargs ls -ld
cd /share/htdocs/weather/image-history/"$yday";
#find . -type f -size 0 | xargs rm;
# mv /volume1/Web/fishcam/image-history/video@"$yday"??????.jpg /volume1/Web/fishcam/image-history/"$yday"/;
# remove 0 byte files test script.
# cd /volume1/Web/fishcam/image-history/video@"$yday"??????.jpg /volume1/Web/fishcam/image-history/"$yday";
# /usr/bin/find . -type f -size 0 | xargs rm;
#
# create sequential files for ffmpeg to process apparently they have to be sequential for ffmpeg
#
x=1;
for i in $(ls -r -t /share/htdocs/weather/image-history/"$yday"/*jpg);
do counter=$(printf %04d $x);
ln -s "$i" /share/Public/tmp/img"$counter".jpg;
x=$(($x+1));
done;
#
#process with ffmpeg
#
# /volume1/.@plugins/AppCentral/upnp-server-v2/bin/ffmpeg -r 15 -f image2 -i /volume1/tmp/img%04d.jpg -qmax 9 /volume1/Web/weather/timelapse/"$yday".avi;
# /usr/local/bin/ffmpeg -r 15 -f image2 -i /volume1/tmp/img%04d.jpg -qmax 9 /volume1/Web/weather/timelapse/"$yday".avi;
ffmpeg -r 15 -f image2 -i /share/Public/tmp/img%04d.jpg -qmin 16 -qmax 26 /share/htdocs/weather/image-history/timelapse/"$yday".avi;
#
#tidy
#
rm /share/Public/tmp/img????.jpg;
#
# repeat final stages for fishcam..
#
# x=1;
# for i in $(ls -r -t /volume1/Web/fishcam/image-history/"$yday"/*jpg);
# do counter=$(printf %04d $x);
# ln "$i" /volume1/tmp/img"$counter".jpg;
# x=$(($x+1));
# done;
#
#process with ffmpeg
#
# /usr/local/bin/ffmpeg -r 15 -f image2 -i /volume1/tmp/img%04d.jpg -qmax 9 /volume1/Web/fishcam/timelapse/"$yday".avi;
# /volume1/Download/FFMPEG/ffmpeg -r 15 -f image2 -i /volume1/tmp/img%04d.jpg -qmax 9 /volume1/Web/fishcam/timelapse/"$yday".avi;
#
#tidy
#
# rm /volume1/tmp/img????.jpg;
#
#zip up yesterdays images to keep file count down
#
# /usr/builtin/bin/zip -rm0 /volume1/Web/fishcam/image-history/"$yday" /volume1/Web/fishcam/image-history/"$yday"
zip -rm9 /share/htdocs/weather/image-history/"$yday" /share/htdocs/weather/image-history/"$yday"
Code: Select all
Temp: <#temp>°C - Press: <#press> hPa - Hum: <#hum>% - Wind: <#wspeed> mph(<#currentwdir>) - Rain: <#rfall> mm - UV Index: <#UV> - SolarRad: <#SolarRad> W/m² - CloudBase: <#cloudbase>.