Browse Source

fix date show if no GPS

Pierre Bourdin 1 month ago
parent
commit
f22b2e255a
2 changed files with 15 additions and 5 deletions
  1. 8 1
      acquisition_process/1_capture
  2. 7 4
      convert_process/2_convert

+ 8 - 1
acquisition_process/1_capture

@@ -38,6 +38,9 @@ echo "$LOND $LONM $LONS"
 ALTITUDE=$(echo $DATA| tr ' ' '\n' | grep 'alt=' | cut -d'=' -f2 | cut -d',' -f1)
 echo "$ALTITUDE meters ! Wooo so hiiigh !"
 
+GPS_DATE=$(echo $DATA| tr ' ' '\n' | grep 'date=' | cut -d'=' -f2 | cut -d',' -f1)
+echo "GPS date : $GPS_DATE"
+
 # Creation du script pour ajout des données Exif dans le JPG
 cat <<EOF > /ramfs/.conf_exif
     # Ajouter aux metadatas les informations de geolocalisation
@@ -48,6 +51,10 @@ cat <<EOF > /ramfs/.conf_exif
     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
+    add Exif.GPSInfo.GPSAltitudeRef 0
+    add Exif.GPSInfo.GPSAltitude ${ALTITUDE}/1
+    add Exif.GPSInfo.GPSTimeStamp ${GPS_DATE:0:2}/1 ${GPS_DATE:2:2}/1 ${GPS_DATE:4:2}/1
+    add Exif.GPSInfo.GPSDateStamp ${GPS_DATE:0:2}:${GPS_DATE:2:2}:${GPS_DATE:4:2}
 EOF
 
 echo $LAT
@@ -93,7 +100,7 @@ if [ $? -eq 0 ]; then
     then
 	echo "Reading GPS data from device"
         $READ_NMEA_PATH > /ramfs/.gpsdata
-        cat /ramfs/.out | grep "Pas de signal GPS"
+        cat /ramfs/.gpsdata | grep "Pas de signal GPS"
 
         if [[ $? -eq 0 ]]; then
             echo "Pas de signal GPS"

+ 7 - 4
convert_process/2_convert

@@ -36,7 +36,6 @@ fi
 
 echo "=> Adding annotaion"
 mogrify -format 'jpg' -font Liberation-Sans -fill white -undercolor '#00000080' -pointsize 24 -gravity NorthEast -annotate +40+10 "$SSTV_BANNER" /ramfs/lit-$IMG
-mogrify -format 'jpg' -font Liberation-Sans -fill white -undercolor '#00000080' -pointsize 24 -gravity NorthEast -annotate +40+50 " $(date -u --date=@$(date "+%s"))" /ramfs/lit-$IMG
 
 
 if [[ $HAVE_GPS = 1 ]]
@@ -48,12 +47,16 @@ then
     then
         GPS_POS=$(exiftool ~/_Pictures/$IMG | grep "GPS Position" | cut -d":" -f2)
         ALTITUDE=$(exiftool ~/_Pictures/$IMG | grep "GPS Altitude" | cut -d":" -f2)
+        GPS_DATE=$(exiftool ~/_Pictures/$IMG | grep "GPS Date/Time" | cut -d":" -f2-)
+
         mogrify -format 'jpg' -font Liberation-Sans -fill white -undercolor '#00000080' -pointsize 24 -gravity NorthEast -annotate +40+410 "Altitude : $ALTITUDE" /ramfs/lit-$IMG
         mogrify -format 'jpg' -font Liberation-Sans -fill white -undercolor '#00000080' -pointsize 24 -gravity NorthEast -annotate +40+450 "$GPS_POS" /ramfs/lit-$IMG
+        mogrify -format 'jpg' -font Liberation-Sans -fill white -undercolor '#00000080' -pointsize 24 -gravity NorthEast -annotate +40+50 "$GPS_DATE" /ramfs/lit-$IMG
     else
-        mogrify -format 'jpg' -font Liberation-Sans -fill white -undercolor '#00000080' -pointsize 24 -gravity NorthEast -annotate +40+410 "Altitude : Unknown" /ramfs/lit-$IMG
-        mogrify -format 'jpg' -font Liberation-Sans -fill white -undercolor '#00000080' -pointsize 24 -gravity NorthEast -annotate +40+450 "NO GPS." /ramfs/lit-$IMG
-      
+        echo "=> No GPS Position found"
+        # Pas beau de mettre no gps, on commente
+        #mogrify -format 'jpg' -font Liberation-Sans -fill white -undercolor '#00000080' -pointsize 24 -gravity NorthEast -annotate +40+410 "Altitude : Unknown" /ramfs/lit-$IMG
+        #mogrify -format 'jpg' -font Liberation-Sans -fill white -undercolor '#00000080' -pointsize 24 -gravity NorthEast -annotate +40+450 "NO GPS." /ramfs/lit-$IMG
     fi
 else
     echo "=> HAVE_GPS = 0, add nothing"