ExifTool Forum

ExifTool => The "exiftool" Application => Topic started by: samk on April 28, 2021, 07:17:31 PM

Title: Conditionals in .fmt files
Post by: samk on April 28, 2021, 07:17:31 PM
Hello,

Is it possible to add values to conditionals in the print format files?

I am trying to check if GPS telemetry is not zeroed out (from a video file). Right now, I simply check for its existence with:


#[IF]  $gpslatitude $gpslongitude $sampletime
#[BODY]<trkpt>
#[BODY]  <lat>$gpslatitude#</lat>
... etc.


Is it possible to check if those GPS latitudes and longitudes do not equal to zero? If so, how would I go about doing this?

Thanks, and apologies if this has already been answered
Title: Re: Conditionals in .fmt files
Post by: Phil Harvey on April 28, 2021, 08:55:39 PM
Sure.  You can do something like this:

#[IF]  ${gpslatitude;$_ = undef if $_ == 0} ${gpslongitude;$_ = undef if $_ == 0} $sampletime

- Phil
Title: Re: Conditionals in .fmt files
Post by: samk on April 29, 2021, 03:58:44 PM
Thank you very much :)
Title: Re: Conditionals in .fmt files
Post by: Phil Harvey on April 29, 2021, 04:17:07 PM
Oh.  Actually for this to work properly you need to test the numerical value:

#[IF]  ${gpslatitude#;$_ = undef if $_ == 0} ${gpslongitude#;$_ = undef if $_ == 0} $sampletime