您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 
 
 

77 行
2.4 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 "rtl_fm" > /dev/null
  25. then
  26. exit 1
  27. fi
  28. # $1 = Satellite Name
  29. # $2 = Frequency
  30. # $3 = FileName base
  31. # $4 = TLE File
  32. # $5 = EPOC start time
  33. # $6 = Time to capture
  34. # $7 = Satellite max elevation
  35. START_DATE=$(date '+%d-%m-%Y %H:%M')
  36. FOLDER_DATE="$(date +%Y)/$(date +%m)/$(date +%d)"
  37. 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
  38. PASS_START=$(expr "$5" + 90)
  39. SUN_ELEV=$(python2 sun.py $PASS_START)
  40. if [ ! -d ${NOAA_OUTPUT}/image/${FOLDER_DATE} ]; then
  41. mkdir -p ${NOAA_OUTPUT}/image/${FOLDER_DATE}
  42. fi
  43. if [ "${SUN_ELEV}" -gt "${SUN_MIN_ELEV}" ]; then
  44. ENHANCEMENTS="ZA MCIR MCIR-precip MSA MSA-precip HVC-precip HVCT-precip HVC HVCT"
  45. else
  46. ENHANCEMENTS="ZA MCIR MCIR-precip"
  47. fi
  48. /usr/local/bin/wxmap -T "${1}" -H "${4}" -p 0 -l 0 -o "${PASS_START}" ${NOAA_HOME}/map/"${3}"-map.png
  49. for i in $ENHANCEMENTS; do
  50. /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
  51. /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
  52. /usr/bin/gdrive upload --parent 1gehY-0iYkNSkBU9RCDsSTexRaQ_ukN0A ${NOAA_OUTPUT}/image/${FOLDER_DATE}/"${3}"-$i.jpg
  53. done
  54. if [ "${SUN_ELEV}" -gt "${SUN_MIN_ELEV}" ]; then
  55. python2 ${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
  56. else
  57. python2 ${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
  58. fi
  59. rm ${NOAA_AUDIO}/audio/*