12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- #!/bin/bash
- #IMG=$(cd /ramfs; find ./ -type f -name *.jpg -exec readlink -f {} \;)
- #IMG=$(ls -t /home/pi/_Pictures | head -1)
- 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...
- echo "=> Copying picz in RAMFS"
- cp -r /home/pi/_Pictures/$IMG /ramfs/$IMG
- echo "=> Converting to PD120 Format <long>x496"
- convert /ramfs/$IMG -resize 660x496^ /ramfs/lit-$IMG
- rm -rf /ramfs/$IMG
- echo "=> Adding annotaion"
- mogrify -format 'jpg' -font Liberation-Sans -fill white -undercolor '#00000080' -pointsize 24 -gravity NorthEast -annotate +40+10 "https://f4koa.fr - Ballon Planète-Sciences - F4KOA-AM " /ramfs/lit-$IMG
- mogrify -format 'jpg' -font Liberation-Sans -fill white -undercolor '#00000080' -pointsize 24 -gravity NorthEast -annotate +40+50 " $(date -u --date=@$(date "+%s"))" /ramfs/lit-$IMG
- echo "=> Adding GPS Position"
- # On cherche à voir si on a la position GPS ou non dans le exif
- exiftool /home/pi/_Pictures/$IMG | grep -e "GPS Position" -e "GPS Altitude"
- if $? -eq 0; then
- GPS_POS=$(exiftool /home/pi/_Pictures/$IMG | grep "GPS Position" | cut -d":" -f2)
- ALTITUDE=$(exiftool /home/pi/_Pictures/$IMG | grep "GPS Altitude" | cut -d":" -f2)
- mogrify -format 'jpg' -font Liberation-Sans -fill white -undercolor '#00000080' -pointsize 24 -gravity NorthEast -annotate +40+410 "Altitude : $ALTITUDE" /ramfs/lit-$IMG
- mogrify -format 'jpg' -font Liberation-Sans -fill white -undercolor '#00000080' -pointsize 24 -gravity NorthEast -annotate +40+450 "$GPS_POS" /ramfs/lit-$IMG
- else
- 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
- echo " => Converting image to WAV..."
- cd ~/PySSTV/
- source bin/activate
- python -m pysstv --mode PD120 --rate 44100 --bits 16 --vox --fskid "F4IYQ" /ramfs/lit-$IMG /ramfs/totx.wav
- deactivate
- echo "=> Setting flag that can be Tx"
- touch /ramfs/.canbetx
- rm -rf /ramfs/lit-$IMG
- echo -n ""
|