2_convert 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #!/bin/bash
  2. #IMG=$(cd /ramfs; find ./ -type f -name *.jpg -exec readlink -f {} \;)
  3. #IMG=$(ls -t /home/pi/_Pictures | head -1)
  4. while [[ ! -f /ramfs/.canbeconvert ]]; do
  5. sleep 1
  6. echo "wait for file to convert..."
  7. done
  8. IMG=$(cat /ramfs/.canbeconvert)
  9. echo "=> File $IMG detected !"
  10. #############
  11. # Mode SSTV
  12. while [[ -f "/ramfs/totx.wav" ]]; do
  13. echo "=> Skipping convert, because old one is not yet Txed !"
  14. sleep 5
  15. done
  16. # On traite l'image...
  17. echo "=> Copying picz in RAMFS"
  18. cp -r /home/pi/_Pictures/$IMG /ramfs/$IMG
  19. echo "=> Converting to PD120 Format <long>x496"
  20. convert /ramfs/$IMG -resize 660x496^ /ramfs/lit-$IMG
  21. rm -rf /ramfs/$IMG
  22. echo "=> Adding annotaion"
  23. mogrify -format 'jpg' -font Liberation-Sans -fill white -undercolor '#00000080' -pointsize 26 -gravity NorthEast -annotate +10+10 " $(date) - F4KMH - 73 :o) " /ramfs/lit-$IMG
  24. echo "=> Adding GPS Position"
  25. GPS_POS=$(exiftool /home/pi/_Pictures/$IMG | grep "GPS Position" | cut -d":" -f2)
  26. mogrify -format 'jpg' -font Liberation-Sans -fill white -undercolor '#00000080' -pointsize 26 -gravity NorthEast -annotate +20+450 "$GPS_POS" /ramfs/lit-$IMG
  27. echo " => Converting image to WAV..."
  28. cd ~/PySSTV/
  29. source bin/activate
  30. python -m pysstv --mode PD120 --rate 44100 --bits 16 --vox --fskid "F4IYQ" /ramfs/lit-$IMG /ramfs/totx.wav
  31. deactivate
  32. echo "=> Setting flag that can be Tx"
  33. touch /ramfs/.canbetx
  34. rm -rf /ramfs/lit-$IMG
  35. echo -n ""