Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

123456789101112131415161718192021222324252627282930313233343536373839
  1. #!/bin/bash
  2. # TODO: Warn the user
  3. BASEPATH="/var/www/wx/image"
  4. FINALPATH="/var/www/wx/images"
  5. SAT_NAMES="NOAA15 NOAA18 NOAA19 METEOR-M2"
  6. DB_PATH="/var/ramfs/panel.db"
  7. cd "$BASEPATH" || exit 1
  8. mkdir -p "$FINALPATH"
  9. for filename in $(find . -name *.jpg); do
  10. basename="$(echo "$filename" | sed 's~.*/~~')"
  11. for prefix in $SAT_NAMES; do
  12. basedate="$(echo "$basename" | sed -e "s/^$prefix//" | cut -f1,2 -d'-' | sed -e "s/-//")"
  13. if [[ $basename == *"$prefix"* ]]; then
  14. sat_name=$prefix
  15. fi
  16. done
  17. date_normalized=$(echo "$basedate" | sed -e "s/^$sat_name//;s/./&:/12;s/./&:/10;s/./& /8;s/./&\//6;s/./&\//4")
  18. epoch_date=$(date "+%s" -d "$date_normalized")
  19. passname=$(echo "$basename" | cut -f1,2 -d'-')
  20. echo "Migration in progress: $basename"
  21. cp "$BASEPATH/$filename" "$FINALPATH"
  22. if [[ $basename == *"METEOR"* ]]; then
  23. sqlite3 "$DB_PATH" "insert into decoded_passes (pass_start, file_path, daylight_pass, is_noaa) values ($epoch_date,\"$passname\",1,0);"
  24. elif [[ $basename == *"ZA"* ]]; then
  25. if [[ -f "$FINALPATH/$passname-MSA.jpg" ]]; then
  26. sqlite3 "$DB_PATH" "insert into decoded_passes (pass_start, file_path, daylight_pass, is_noaa) values ($epoch_date,\"$passname\",1,1);"
  27. else
  28. sqlite3 "$DB_PATH" "insert into decoded_passes (pass_start, file_path, daylight_pass, is_noaa) values ($epoch_date,\"$passname\",0,1);"
  29. fi
  30. fi
  31. echo "Done."
  32. echo ""
  33. done