12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- #!/bin/bash
- CONVERTLL_PATH="/home/pi/BallonSonde/convert_ll_dec.py"
- READ_NMEA_PATH="/home/pi/BallonSonde/read_nmea.py"
- echo "=> Acquisition on !"
- DATE=$(date +%y%m%d_%H%M%S)
- $READ_NMEA_PATH > /ramfs/.out
- raspistill -o /ramfs/$DATE.jpg
- DATA=$(cat /ramfs/.out)
- NS=$(echo $DATA| tr ' ' '\n' | grep NS | cut -d'=' -f2 | cut -d',' -f1)
- EW=$(echo $DATA| tr ' ' '\n' | grep EW | cut -d'=' -f2 | cut -d',' -f1)
- LAT=$(echo $DATA| tr ' ' '\n' | grep 'lat=' | cut -d'=' -f2 | cut -d',' -f1)
- echo "Latitude $LAT"
- LATD=$($CONVERTLL_PATH $LAT | grep "d:" | cut -d':' -f2)
- LATM=$($CONVERTLL_PATH $LAT | grep "m:" | cut -d':' -f2)
- LATS=$($CONVERTLL_PATH $LAT | grep "s:" | cut -d':' -f2 | sed 's/\.//' )
- echo "$LATD $LATM $LATS"
- LON=$(echo $DATA| tr ' ' '\n' | grep 'lon=' | cut -d'=' -f2 | cut -d',' -f1)
- echo "Longitude : $LON"
- LOND=$($CONVERTLL_PATH $LON| grep "d:" | cut -d':' -f2)
- LONM=$($CONVERTLL_PATH $LON | grep "m:" | cut -d':' -f2)
- LONS=$($CONVERTLL_PATH $LON | grep "s:" | cut -d':' -f2 | sed 's/\.//')
- echo "$LOND $LONM $LONS"
- # Creation du script pour ajout des données Exif dans le JPG
- cat <<EOF > /ramfs/.conf_exif
- # Ajouter aux metadatas les informations de geolocalisation
- # 'add' pour ajouter les informations
- # 'set' pour remplacer celles déjà exisante
- # 'del' pour les supprimer (sans préciser de valeur)
- add Exif.GPSInfo.GPSLatitudeRef ${NS}
- add Exif.GPSInfo.GPSLatitude ${LATD}/1 ${LATM}/1 ${LATS}/10000
- add Exif.GPSInfo.GPSLongitudeRef ${EW}
- add Exif.GPSInfo.GPSLongitude ${LOND}/1 ${LONM}/1 ${LONS}/10000
- EOF
- if [[ "$LAT" -ne "NO_DATA" ]]; then
- exiv2 -m /ramfs/.conf_exif /ramfs/$DATE.jpg
- else
- echo "Don't have GPS datas, continue without these datas"
- fi
- echo "Picz $DATE.jpg saved in RAM"
- mv /ramfs/$DATE.jpg ~/_Pictures
- echo "Picz $DATE.jpg saved to SDCARD"
- echo "$DATE.jpg" > /ramfs/.canbeconvert
- sleep 60
|