You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

59 regels
2.2 KiB

  1. #!/bin/bash
  2. ## import common lib
  3. . "$HOME/.noaa.conf"
  4. . "$HOME/.tweepy.conf"
  5. . "$NOAA_HOME/common.sh"
  6. ## pass start timestamp and sun elevation
  7. PASS_START=$(expr "$5" + 90)
  8. SUN_ELEV=$(python3 "$NOAA_HOME"/sun.py "$PASS_START")
  9. if pgrep "rtl_fm" > /dev/null
  10. then
  11. log "There is an existing rtl_fm instance running, I quit" "ERROR"
  12. exit 1
  13. fi
  14. # $1 = Satellite Name
  15. # $2 = Frequency
  16. # $3 = FileName base
  17. # $4 = TLE File
  18. # $5 = EPOC start time
  19. # $6 = Time to capture
  20. # $7 = Satellite max elevation
  21. timeout "${6}" /usr/local/bin/rtl_fm ${BIAS_TEE} -f "${2}"M -s 60k -g 50 -p 55 -E wav -E deemp -F 9 - | /usr/bin/sox -t raw -e signed -c 1 -b 16 -r 60000 - "${NOAA_AUDIO}/audio/${3}.wav" rate 11025
  22. if [ ! -d "{NOAA_OUTPUT}/image/${FOLDER_DATE}" ]; then
  23. mkdir -m 775 -p "${NOAA_OUTPUT}/image/${FOLDER_DATE}"
  24. fi
  25. if [ "${SUN_ELEV}" -gt "${SUN_MIN_ELEV}" ]; then
  26. ENHANCEMENTS="ZA MCIR MCIR-precip MSA MSA-precip HVC-precip HVCT-precip HVC HVCT"
  27. else
  28. ENHANCEMENTS="ZA MCIR MCIR-precip"
  29. fi
  30. /usr/local/bin/wxmap -T "${1}" -H "${4}" -p 0 -l 0 -o "${PASS_START}" "${NOAA_HOME}/map/${3}-map.png"
  31. for i in $ENHANCEMENTS; do
  32. /usr/local/bin/wxtoimg -o -m "${NOAA_HOME}/map/${3}-map.png" -e "$i" "${NOAA_AUDIO}/audio/${3}.wav" "${NOAA_OUTPUT}/image/${FOLDER_DATE}/${3}-$i.jpg"
  33. /usr/bin/convert -quality 90 -format jpg "${NOAA_OUTPUT}/image/${FOLDER_DATE}/${3}-$i.jpg" -undercolor black -fill yellow -pointsize 18 -annotate +20+20 "${1} $i ${START_DATE}" "${NOAA_OUTPUT}/image/${FOLDER_DATE}/${3}-$i.jpg"
  34. done
  35. if [ -n "$CONSUMER_KEY" ]; then
  36. if [ "${SUN_ELEV}" -gt "${SUN_MIN_ELEV}" ]; then
  37. python3 "${NOAA_HOME}/post.py" "$1 ${START_DATE}" "$7" "${NOAA_OUTPUT}/image/${FOLDER_DATE}/$3-MCIR-precip.jpg" "${NOAA_OUTPUT}/image/${FOLDER_DATE}/$3-MSA-precip.jpg" "${NOAA_OUTPUT}/image/${FOLDER_DATE}/$3-HVC-precip.jpg" "${NOAA_OUTPUT}/image/${FOLDER_DATE}/$3-HVCT-precip.jpg"
  38. else
  39. python3 "${NOAA_HOME}/post.py" "$1 ${START_DATE}" "$7" "${NOAA_OUTPUT}/image/${FOLDER_DATE}/$3-MCIR-precip.jpg" "${NOAA_OUTPUT}/image/${FOLDER_DATE}/$3-MCIR.jpg"
  40. fi
  41. fi
  42. if [ "$DELETE_AUDIO" = true ];
  43. rm "${NOAA_AUDIO}/audio/${3}.wav"
  44. else
  45. # Move the audio from the ram fs to the SD Card
  46. mv "${NOAA_AUDIO}/audio/${3}.wav ${NOAA_OUTPUT}/audio/${3}.wav"
  47. fi