2_convert 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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) - F4IYQ - 73 :o) " /ramfs/lit-$IMG
  24. echo " => Converting image to WAV..."
  25. cd ~/PySSTV/
  26. source bin/activate
  27. python -m pysstv --mode PD120 --rate 44100 --bits 16 --vox --fskid "F4IYQ" /ramfs/lit-$IMG /ramfs/totx.wav
  28. deactivate
  29. echo "=> Setting flag that can be Tx"
  30. touch /ramfs/.canbetx
  31. rm -rf /ramfs/lit-$IMG
  32. echo -n ""