Browse Source

store received images in database, also change file path on disk

tags/1.5
Nico Rey 4 years ago
parent
commit
6550fe70ad
2 changed files with 14 additions and 7 deletions
  1. +9
    -4
      receive.sh
  2. +5
    -3
      receive_meteor.sh

+ 9
- 4
receive.sh View File

@@ -34,23 +34,28 @@ fi


if [ "${SUN_ELEV}" -gt "${SUN_MIN_ELEV}" ]; then if [ "${SUN_ELEV}" -gt "${SUN_MIN_ELEV}" ]; then
ENHANCEMENTS="ZA MCIR MCIR-precip MSA MSA-precip HVC-precip HVCT-precip HVC HVCT" ENHANCEMENTS="ZA MCIR MCIR-precip MSA MSA-precip HVC-precip HVCT-precip HVC HVCT"
daylight="true"
else else
ENHANCEMENTS="ZA MCIR MCIR-precip" ENHANCEMENTS="ZA MCIR MCIR-precip"
daylight="false"
fi fi


log "Bulding pass map" "INFO" log "Bulding pass map" "INFO"
/usr/local/bin/wxmap -T "${1}" -H "${4}" -p 0 -l 0 -o "${PASS_START}" "${NOAA_HOME}/map/${3}-map.png" /usr/local/bin/wxmap -T "${1}" -H "${4}" -p 0 -l 0 -o "${PASS_START}" "${NOAA_HOME}/map/${3}-map.png"
for i in $ENHANCEMENTS; do for i in $ENHANCEMENTS; do
log "Decoding image" "INFO" log "Decoding image" "INFO"
/usr/local/bin/wxtoimg -o -m "${NOAA_HOME}/map/${3}-map.png" -e "$i" "${NOAA_AUDIO}/audio/${3}.wav" "${NOAA_OUTPUT}/image/${FOLDER_DATE}/${3}-$i.jpg"
/usr/bin/convert -quality 90 -format jpg "${NOAA_OUTPUT}/image/${FOLDER_DATE}/${3}-$i.jpg" -undercolor black -fill yellow -pointsize 18 -annotate +20+20 "${1} $i ${START_DATE}" "${NOAA_OUTPUT}/image/${FOLDER_DATE}/${3}-$i.jpg"
/usr/local/bin/wxtoimg -o -m "${NOAA_HOME}/map/${3}-map.png" -e "$i" "${NOAA_AUDIO}/audio/${3}.wav" "${NOAA_OUTPUT}/image/${3}-$i.jpg"
/usr/bin/convert -quality 90 -format jpg "${NOAA_OUTPUT}/image/${3}-$i.jpg" -undercolor black -fill yellow -pointsize 18 -annotate +20+20 "${1} $i ${START_DATE}" "${NOAA_OUTPUT}/image/${3}-$i.jpg"
/usr/bin/convert -thumbnail 300 "${NOAA_OUTPUT}/image/${3}-$i.jpg" "${NOAA_OUTPUT}/image/thumb/${3}-$i.jpg
done done
if [ -n "$CONSUMER_KEY" ]; then if [ -n "$CONSUMER_KEY" ]; then
log "Posting to Twitter" "INFO" log "Posting to Twitter" "INFO"
if [ "${SUN_ELEV}" -gt "${SUN_MIN_ELEV}" ]; then if [ "${SUN_ELEV}" -gt "${SUN_MIN_ELEV}" ]; then
python3 "${NOAA_HOME}/post.py" "$1 ${START_DATE}" "$7" "${NOAA_OUTPUT}/image/${FOLDER_DATE}/$3-MCIR-precip.jpg" "${NOAA_OUTPUT}/image/${FOLDER_DATE}/$3-MSA-precip.jpg" "${NOAA_OUTPUT}/image/${FOLDER_DATE}/$3-HVC-precip.jpg" "${NOAA_OUTPUT}/image/${FOLDER_DATE}/$3-HVCT-precip.jpg"
sqlite3 /home/pi/raspberry-noaa/panel.db "insert into decoded_passes (pass_start, file_path, daylight_pass, is_noaa) values ($5,\"$3\", 1,1);
python3 "${NOAA_HOME}/post.py" "$1 ${START_DATE}" "$7" "${NOAA_OUTPUT}/image/${FOLDER_DATE}/$3-MCIR-precip.jpg" "${NOAA_OUTPUT}/image/$3-MSA-precip.jpg" "${NOAA_OUTPUT}/image/$3-HVC-precip.jpg" "${NOAA_OUTPUT}/image/$3-HVCT-precip.jpg"
else else
python3 "${NOAA_HOME}/post.py" "$1 ${START_DATE}" "$7" "${NOAA_OUTPUT}/image/${FOLDER_DATE}/$3-MCIR-precip.jpg" "${NOAA_OUTPUT}/image/${FOLDER_DATE}/$3-MCIR.jpg"
sqlite3 /home/pi/raspberry-noaa/panel.db "insert into decoded_passes (pass_start, file_path, daylight_pass, is_noaa) values ($5,\"$3\", 0,1);"
python3 "${NOAA_HOME}/post.py" "$1 ${START_DATE}" "$7" "${NOAA_OUTPUT}/image/$3-MCIR-precip.jpg" "${NOAA_OUTPUT}/image/$3-MCIR.jpg"
fi fi
fi fi




+ 5
- 3
receive_meteor.sh View File

@@ -51,14 +51,16 @@ rm "${METEOR_OUTPUT}/${3}.qpsk"
if [ -f "${METEOR_OUTPUT}/${3}.dec" ]; then if [ -f "${METEOR_OUTPUT}/${3}.dec" ]; then
log "I got a successful ${3}.dec file. Creating false color image" "INFO" log "I got a successful ${3}.dec file. Creating false color image" "INFO"
medet_arm "${METEOR_OUTPUT}/${3}.dec" "${METEOR_OUTPUT}/${3}-122" -r 65 -g 65 -b 64 -d medet_arm "${METEOR_OUTPUT}/${3}.dec" "${METEOR_OUTPUT}/${3}-122" -r 65 -g 65 -b 64 -d
convert "${METEOR_OUTPUT}/${3}-122.bmp" "${NOAA_OUTPUT}/image/${FOLDER_DATE}/${3}-122.jpg"
convert "${METEOR_OUTPUT}/${3}-122.bmp" "${NOAA_OUTPUT}/image/${3}-122.jpg"
log "Rectifying image to adjust aspect ratio" "INFO" log "Rectifying image to adjust aspect ratio" "INFO"
python3 "${NOAA_HOME}/rectify.py" "${NOAA_OUTPUT}/image/${FOLDER_DATE}/${3}-122.jpg"
convert "${NOAA_OUTPUT}/image/${FOLDER_DATE}/${3}-122-rectified.jpg" -channel rgb -normalize "${NOAA_OUTPUT}/image/${FOLDER_DATE}/${3}-122-rectified.jpg"
python3 "${NOAA_HOME}/rectify.py" "${NOAA_OUTPUT}/image/${3}-122.jpg"
convert -thumbnail 300 "${NOAA_OUTPUT}/image/${3}-122-rectified.jpg" "${NOAA_OUTPUT}/image/thumb/${3}-122-rectified.jpg"
convert "${NOAA_OUTPUT}/image/${3}-122-rectified.jpg" -channel rgb -normalize "${NOAA_OUTPUT}/image/${3}-122-rectified.jpg"
log "Deleting base image files" "INFO" log "Deleting base image files" "INFO"
rm "${METEOR_OUTPUT}/${3}-122.bmp" rm "${METEOR_OUTPUT}/${3}-122.bmp"
rm "${METEOR_OUTPUT}/${3}.bmp" rm "${METEOR_OUTPUT}/${3}.bmp"
rm "${NOAA_OUTPUT}/image/${FOLDER_DATE}/${3}-122.jpg" rm "${NOAA_OUTPUT}/image/${FOLDER_DATE}/${3}-122.jpg"
sqlite3 /home/pi/raspberry-noaa/panel.db "insert into decoded_passes (pass_start, file_path, daylight_pass, is_noaa) values ($5,\"$3\", 1,0);"
if [ -n "$CONSUMER_KEY" ]; then if [ -n "$CONSUMER_KEY" ]; then
log "Posting to Twitter" "INFO" log "Posting to Twitter" "INFO"
python3 "${NOAA_HOME}/post.py" "$1 EXPERIMENTAL ${START_DATE} Resolución completa: http://weather.reyni.co/image/${FOLDER_DATE}/${3}-122-rectified.jpg" "$7" "${NOAA_OUTPUT}/image/${FOLDER_DATE}/${3}-122-rectified.jpg" python3 "${NOAA_HOME}/post.py" "$1 EXPERIMENTAL ${START_DATE} Resolución completa: http://weather.reyni.co/image/${FOLDER_DATE}/${3}-122-rectified.jpg" "$7" "${NOAA_OUTPUT}/image/${FOLDER_DATE}/${3}-122-rectified.jpg"


Loading…
Cancel
Save