#!/bin/bash # # # echo "# Extinction du bias-tee" /home/pi/rtl_biast/build/src/rtl_biast -b 0 echo "# Execution du décodage NOAA" echo "## Setting paths ..." satnogs_data_path=/tmp/.satnogs/data recorded_files_path=/home/pi/noaa_decoder/data/recorded # recorded_files_path=/home/pi/noaa_decoder/data/recorded resampled_files_path=/home/pi/noaa_decoder/data/resampled # resampled_files_path=/home/pi/noaa_decoder/data/resampled images_files_path=/home/pi/noaa_decoder/data/decoded # images_files_path=/home/pi/noaa_decoder/data/decoded echo "satnogs_data_path = ${satnogs_data_path}" echo "recorded_files_path = ${recorded_files_path}" echo "resampled_files_path = ${resampled_files_path}" echo "images_files_path = ${images_files_path}" echo "## Moving to satnogs data ..." cd "${satnogs_data_path}" echo "## Récupération du nom du fichier *.out" out_file="$(ls -A ./*.out)" echo "DBG : out_file = ${out_file}" echo "## Création des noms de fichier pour la suite ..." filename=$(basename -- "${out_file}") extension="${filename##*.}" filename="${filename%.*}" recorded_file="${filename}.ogg" resampled_file="${filename}_11025.wav" image_file="${filename}_hvc-precip.jpg" echo "DBG : recorded_file = ${recorded_file}" echo "DBG : resampled_file = ${resampled_file}" echo "DBG : image_file = ${image_file}" echo "## Moving to satnogs data ..." cd "${satnogs_data_path}" echo "## Récupération du nom du fichier *.out" out_file="$(ls -A ./*.out)" echo "DBG : out_file = ${out_file}" echo "## Création des noms de fichier pour la suite ..." filename=$(basename -- "${out_file}") extension="${filename##*.}" filename="${filename%.*}" recorded_file="${filename}.ogg" resampled_file="${filename}_11025.wav" image_file="${filename}_hvc-precip.jpg" echo "DBG : recorded_file = ${recorded_file}" echo "DBG : resampled_file = ${resampled_file}" echo "DBG : image_file = ${image_file}" echo "## Copie du fichier *.out en *.ogg" for i in {1..10} ; do echo "## Try #${i}" if [ -f "${out_file}" ] cp "${out_file}" "${recorded_files_path}/${recorded_file}" then echo "ERROR : File '${out_file}' does not exist" fi if [ -n "$(ls -A ${recorded_files_path} 2>/dev/null)" ] then echo "## Destination folder contains *.ogg files" break fi sleep 1 done echo "## Reechantillonage ..." sox "${recorded_files_path}/${recorded_file}" "${resampled_files_path}/${resampled_file}" rate 11025 echo "## Decodage de l'image ..." wxtoimg -v -c -k. -t n -e "HVC-precip" -A "${resampled_files_path}/${resampled_file}" "${images_files_path}/${image_file}" cd - echo "# Fin du script"