Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.
 
 
 
 
 
 

84 řádky
2.5 KiB

  1. #!/bin/sh
  2. ## debug
  3. # set -x
  4. . ~/.noaa.conf
  5. ## sane checks
  6. if [ ! -d "${NOAA_HOME}" ]; then
  7. mkdir -p "${NOAA_HOME}"
  8. fi
  9. if [ ! -d "${NOAA_OUTPUT}" ]; then
  10. mkdir -p "${NOAA_OUTPUT}"
  11. fi
  12. if [ ! -d "${NOAA_AUDIO}/audio/" ]; then
  13. mkdir -p "${NOAA_AUDIO}/audio/"
  14. fi
  15. if [ ! -d "${NOAA_OUTPUT}/image/" ]; then
  16. mkdir -p "${NOAA_OUTPUT}/image/"
  17. fi
  18. if [ ! -d "${NOAA_HOME}/map/" ]; then
  19. mkdir -p "${NOAA_HOME}/map/"
  20. fi
  21. if [ ! -d "${NOAA_HOME}/predict/" ]; then
  22. mkdir -p "${NOAA_HOME}/predict/"
  23. fi
  24. #if pgrep "stream_fm" > /dev/null
  25. #then
  26. # pkill -9 -f stream_fm
  27. # pkill -9 -f rtl_fm
  28. # pkill -9 -f socat
  29. #fi
  30. if pgrep "rtl_fm" > /dev/null
  31. then
  32. exit 1
  33. fi
  34. # $1 = Satellite Name
  35. # $2 = Frequency
  36. # $3 = FileName base
  37. # $4 = TLE File
  38. # $5 = EPOC start time
  39. # $6 = Time to capture
  40. # $7 = Satellite max elevation
  41. START_DATE=$(date '+%d-%m-%Y %H:%M')
  42. FOLDER_DATE="$(date +%Y)/$(date +%m)/$(date +%d)"
  43. timeout "${6}" /usr/local/bin/rtl_fm -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
  44. sudo renice -19 -p "$(pidof rtl_fm)"
  45. PASS_START=$(expr "$5" + 90)
  46. SUN_ELEV=$(python3 sun.py "$PASS_START")
  47. if [ ! -d "{NOAA_OUTPUT}/image/${FOLDER_DATE}" ]; then
  48. mkdir -p "${NOAA_OUTPUT}/image/${FOLDER_DATE}"
  49. fi
  50. if [ "${SUN_ELEV}" -gt "${SUN_MIN_ELEV}" ]; then
  51. ENHANCEMENTS="ZA MCIR MCIR-precip MSA MSA-precip HVC-precip HVCT-precip HVC HVCT"
  52. else
  53. ENHANCEMENTS="ZA MCIR MCIR-precip"
  54. fi
  55. /usr/local/bin/wxmap -T "${1}" -H "${4}" -p 0 -l 0 -o "${PASS_START}" "${NOAA_HOME}/map/${3}-map.png"
  56. for i in $ENHANCEMENTS; do
  57. /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"
  58. /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"
  59. done
  60. if [ "${SUN_ELEV}" -gt "${SUN_MIN_ELEV}" ]; then
  61. 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"
  62. else
  63. 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"
  64. fi
  65. rm "${NOAA_AUDIO}/audio/${3}.wav"