#!/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 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 " Ballon Stratosphérique ENSIL - F4KMH " /ramfs/lit-$IMG mogrify -format 'jpg' -font Liberation-Sans -fill white -undercolor '#00000080' -pointsize 24 -gravity NorthEast -annotate +40+50 " $(date "+%a %d %b %y - %X")" /ramfs/lit-$IMG echo "=> Adding GPS Position" 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 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 ""