| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- #!/bin/bash
- #IMG=$(cd /ramfs; find ./ -type f -name *.jpg -exec readlink -f {} \;)
- #IMG=$(ls -t /home/pi/_Pictures | head -1)
- source ~/BallonSonde/variables.sh
- while [[ ! -f /ramfs/.canbeconvert ]]; do
- sleep 1
- echo "wait for file to convert..."
- done
- IMG=$(cat /ramfs/.canbeconvert)
- echo "=> File $IMG detected !"
- #############
- # Mode SSTV
- while [[ -f "/ramfs/totx.wav" ]]; do
- echo "=> Skipping convert, because old one is not yet Txed !"
- sleep 5
- done
- # On traite l'image...
- if [[ $FULL_RAW_RES = 1 ]]
- then
- echo "=> Converting to PD1x0 Format 640x496"
- convert $DEFAULT_RAW_PATH/$IMG -resize 640x496^ /ramfs/lit-$IMG
- else
- echo "=> Already to the right format, do nothing"
- fi
- echo "=> Adding annotaion"
- mogrify -format 'jpg' -font Liberation-Sans -fill white -undercolor '#00000080' -pointsize 28 -gravity NorthEast -annotate +0+0 "$SSTV_BANNER" -draw "image Over 525,350 90,117 '$DEFAULT_PATH/img/ussel.png'" /ramfs/lit-$IMG
- if [[ $HAVE_GPS = 1 ]]
- then
- echo "=> Adding GPS Position"
- # On cherche à voir si on a la position GPS ou non dans le exif
- exiftool $DEFAULT_RAW_PATH/$IMG | grep -e "GPS Position" -e "GPS Altitude"
- if [[ $? -eq 0 ]]
- then
- GPS_POS=$(exiftool $DEFAULT_RAW_PATH/$IMG | grep "GPS Position" | cut -d":" -f2)
- # many parameters GPS Altitude Ref and GPS Altitude. Keep with spaces for grep
- ALTITUDE=$(exiftool $DEFAULT_RAW_PATH/$IMG | grep "GPS Altitude " | cut -d":" -f2 | cut -d" " -f2)
- GPS_DATE=$(exiftool $DEFAULT_RAW_PATH/$IMG | grep "GPS Date/Time" | cut -d":" -f2-)
- if [[ -n ${GPS_POS:-} ]]
- then
- mogrify -format 'jpg' -font Liberation-Sans -fill white -undercolor '#00000080' -pointsize 24 -gravity NorthEast -annotate +0+448 "$GPS_DATE / Altitude : $ALTITUDE m" /ramfs/lit-$IMG
- mogrify -format 'jpg' -font Liberation-Sans -fill white -undercolor '#00000080' -pointsize 24 -gravity NorthEast -annotate +0+472 "$GPS_POS" /ramfs/lit-$IMG
- else
- echo "=> No GPS Position found"
- fi
- else
- echo "=> No GPS Position found"
- # Pas beau de mettre no gps, on commente
- #mogrify -format 'jpg' -font Liberation-Sans -fill white -undercolor '#00000080' -pointsize 24 -gravity NorthEast -annotate +40+410 "Altitude : Unknown" /ramfs/lit-$IMG
- #mogrify -format 'jpg' -font Liberation-Sans -fill white -undercolor '#00000080' -pointsize 24 -gravity NorthEast -annotate +40+450 "NO GPS." /ramfs/lit-$IMG
- fi
- else
- echo "=> HAVE_GPS = 0, add nothing"
- fi
- echo " => Converting image to WAV..."
- cd ~/PySSTV/
- source bin/activate
- #time python -m pysstv --mode PD120 --rate 44800 --bits 16 --vox --fskid $INDICATIF /ramfs/lit-$IMG /ramfs/totx.wav
- time ~/libsstv/bin/sstv-encode pd180 /ramfs/lit-$IMG /ramfs/totx.wav
- deactivate
- echo "=> Setting flag that can be Tx"
- touch /ramfs/.canbetx
- rm -rf /ramfs/lit-$IMG
- echo -n ""
|