Branch Coverage

blib/lib/Image/ExifTool/Geotag.pm
Criterion Covered Total %
branch 311 658 47.2


line true false branch
152 0 9 unless (eval { do { require Time::Local } })
160 7 2 unless $points
164 7 2 unless $has
168 0 9 if ($val =~ /^(\xef\xbb\xbf)?<(\?xml|gpx)[\s>]/) { }
0 9 elsif ($val =~ /(\x0d\x0a|\x0d|\x0a)/) { }
175 8 1 if ($et->Open(\*EXIFTOOL_TRKFILE, $val)) { }
1 0 elsif ($val eq 'DATETIMEONLY') { }
178 0 8 unless ($raf->Read($_, 256))
183 3 5 if (/^(\xef\xbb\xbf)?<(\?xml|gpx)[\s>]/) { }
5 0 elsif (/(\x0d\x0a|\x0d|\x0a)/) { }
203 0 8 unless ($from)
220 8 0 unless defined $csvDelim
223 8 322 unless $raf->ReadLine($_)
225 7 315 unless ($format)
227 0 7 if (/^<(\?xml|gpx)[\s>]/) { }
2 5 elsif (/^.*\$([A-Z]{2}(RMC|GGA|GLL|ZDA)|PMGNTRK),/) { }
0 5 elsif (/^A(FLA|XSY|FIL)/) { }
1 4 elsif (/^HFDTE(?:DATE:)?(\d{2})(\d{2})(\d{2})/) { }
0 4 elsif ($nmeaStart and /^B/) { }
0 4 elsif (/^TP,D,/) { }
1 3 elsif (/^\s*\d+\s+.*\sypr\s*$/ and (@tmp = split(' ', $_, 0)) == 12) { }
1 2 elsif (/\b(GPS)?Date/i && /\b(GPS)?(Date)?Time/i || /\bTime\(seconds\)/i and /\Q$csvDelim\E/) { }
0 2 elsif (/"(timelineObjects|placeVisit|activitySegment|latitudeE7)":/) { }
239 0 1 $3 >= 70 ? :
261 1 4 if (/^Time ?\(seconds\)$/i) { }
0 4 elsif (/^Date ?Time/i) { }
0 4 elsif (/^Date/i) { }
0 4 elsif (/^Time(?! ?\(text\))/i) { }
1 3 elsif (/^(Pos)?Lat/i) { }
1 2 elsif (/^(Pos)?Lon/i) { }
0 2 elsif (/^(Pos)?Alt/i) { }
0 2 elsif (/^Speed/i) { }
0 2 elsif (/^(Angle)?(Heading|Track|Bearing)/i) { }
0 2 elsif (/^(Angle)?Pitch/i or /^Camera ?Elevation ?Angle/i) { }
0 2 elsif (/^(Angle)?Roll/i) { }
0 2 elsif (/^Img ?Dir/i) { }
265 1 0 if ($trackFile and $trackFile =~ m[(\d{4})-(\d{2})-(\d{2})[^/]+(\d{2})-(\d{2})-(\d{2})[^/]*$]) { }
281 0 1 if /ref$/i
284 0 1 if /ref$/i
290 0 0 if (m[\((mph|km/h|m/s)\)]) { }
305 3 2 if ($param) { }
320 0 2 if ++$skipped > 50
327 177 141 if ($format eq 'XML') { }
0 141 elsif ($format eq 'Winplus') { }
7 134 elsif ($format eq 'Bramor') { }
93 41 elsif ($format eq 'CSV') { }
0 41 elsif ($format eq 'JSON') { }
336 38 199 if ($arg =~ /^(\w+:)?(\w+)=(['"])(.*?)\3/g)
338 18 20 if ($tag)
340 0 18 if ($isOrient{$tag}) { }
0 18 elsif ($tag eq 'alt') { }
0 18 elsif ($tag eq 'atemp') { }
344 0 0 if defined $fix->{'alt'} and not $fix->{'alt'} =~ /^[+-]?\d+\.?\d*/
345 0 0 if $fix->{'alt'}
355 24 146 if (defined $tag and not $tag)
357 12 12 if (not $2) { }
11 1 elsif ($fix and $lastFix and %$fix) { }
365 0 44 unless defined $lastFix->{$_}
370 51 107 if (length $1) { }
0 107 elsif ($tok eq 'td') { }
371 32 19 if ($tag)
372 3 29 if ($tag eq 'coords') { }
374 0 0 if (defined $fix->{'lon'} and defined $fix->{'lat'} and defined $fix->{'alt'})
379 0 3 if $fix->{'alt'}
381 0 29 if ($tok eq 'when' and $fix->{'time'}) { }
386 0 29 if ($isOrient{$tag}) { }
11 18 elsif ($tag eq 'alt') { }
0 18 elsif ($tag eq 'atemp') { }
390 0 11 if defined $fix->{'alt'} and not $fix->{'alt'} =~ /^[+-]?\d+\.?\d*/
391 11 0 if $fix->{'alt'}
402 69 38 unless defined $fix->{'lat'} and defined $fix->{'lon'}
403 24 14 unless (defined $fix->{'time'})
404 24 0 unless @saveTime
407 0 14 unless ($fix->{'lat'} =~ /^[+-]?\d+\.?\d*/ and $fix->{'lon'} =~ /^[+-]?\d+\.?\d*/)
408 0 0 unless $e0
411 0 14 unless (defined($time = &GetTime($fix->{'time'})))
412 0 0 unless $e1
416 0 14 if defined $fix->{'pdop'} or defined $fix->{'hdop'} or defined $fix->{'nsats'}
418 0 14 if ($fix->{'begin'})
421 0 0 if (defined $begin and $begin < $time)
426 0 0 unless @saveFix
431 0 0 if not $i and $points->{$t}
446 0 0 if $td and not $fix->{'time'} and /[\s>](\d{4}-\d{2}-\d{2})[T ](\d{2}:\d{2}:\d{2}(\.\d+)?)/
455 0 0 unless m[^TP,D,\s*([-+]?\d+\.\d*),\s*([-+]?\d+\.\d*),\s*(\d+)/(\d+)/(\d{4}),\s*(\d+):(\d+):(\d+)]
472 3 4 unless @parts == 12 and $parts[11] eq "ypr"
475 0 4 unless @d == 3 and @t == 3
501 1 460 unless defined $val and length $val
502 184 276 unless $param
503 0 276 if ($param eq 'datetime') { }
0 276 elsif ($param eq 'date') { }
0 276 elsif ($param eq 'time') { }
184 92 elsif ($param eq 'lat' or $param eq 'lon') { }
0 92 elsif ($param eq 'latref') { }
0 92 elsif ($param eq 'lonref') { }
92 0 elsif ($param eq 'runtime') { }
508 0 0 if ($dateTime)
513 0 0 if ($val =~ m[^(\d{2})/(\d{2})/(\d{4})$]) { }
0 0 elsif ($val =~ /(\d{4}).*?(\d{2}).*?(\d{2})/) { }
519 0 0 if ($val =~ /^(\d{1,2}):(\d{2}):(\d{2}(\.\d+)?).*?(([-+])(\d{1,2}):?(\d{2}))?/)
522 0 0 $6 eq '-' ? :
0 0 if $5
527 0 0 if $val =~ /^S/i
529 0 0 if $val =~ /^W/i
534 0 0 if $scaleSpeed and $param eq "speed"
536 0 0 if $sepTags{$param}
541 0 0 unless defined $fix->{$param}
544 92 0 if ($date and defined $secs and defined $fix->{'lat'} and defined $fix->{'lon'})
546 0 92 if defined $fix->{'alt'}
547 0 92 if defined $fix->{'track'}
548 0 92 if defined $fix->{'pitch'}
554 0 0 if (/"(latitudeE7|longitudeE7|latE7|lngE7|timestamp)":\s*"?(.*?)"?,?\s*[\x0d\x0a]/)
555 0 0 if ($1 eq 'timestamp') { }
0 0 elsif ($1 eq 'latitudeE7' or $1 eq 'latE7') { }
557 0 0 if $time and $fix->{'lat'} and $fix->{'lon'}
567 19 22 if ($format eq "NMEA")
570 1 18 unless /^(.*)\$([A-Z]{2}(RMC|GGA|GLL|GSA|ZDA)|PMGNTRK|PTNTHPR),/
572 0 18 if length $1
577 22 18 if ($format eq 'IGC') { }
3 15 elsif ($nmea eq 'RMC') { }
0 15 elsif ($nmea eq 'GGA') { }
0 15 elsif ($nmea eq 'GLL') { }
0 15 elsif ($nmea eq 'GSA') { }
0 15 elsif ($nmea eq 'ZDA') { }
12 3 elsif ($nmea eq 'PMGNTRK') { }
3 0 elsif ($nmea eq 'PTNTHPR') { }
582 12 10 unless /^B(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})(\d{3})([NS])(\d{3})(\d{2})(\d{3})([EW])([AV])(\d{5})(\d{5})/
583 10 0 $7 eq 'N' ? :
584 10 0 $11 eq 'E' ? :
585 10 0 $12 eq 'A' ? :
588 10 0 if ($dateFlarm)
589 0 10 if $secs < $lastSecs - &JITTER()
600 0 3 unless /^\$[A-Z]{2}RMC,(\d{2})(\d{2})(\d+(\.\d*)?),A?,(\d*?)(\d{1,2}\.\d+),([NS]),(\d*?)(\d{1,2}\.\d+),([EW]),(\d*\.?\d*),(\d*\.?\d*),(\d{2})(\d{2})(\d+)/
601 0 3 if $13 > 31 or $14 > 12 or $15 > 99
602 3 0 $7 eq 'N' ? :
603 3 0 $10 eq 'E' ? :
604 3 0 if length $11
605 3 0 if length $12
606 0 3 $15 >= 70 ? :
616 0 0 unless /^\$[A-Z]{2}GGA,(\d{2})(\d{2})(\d+(\.\d*)?),(\d*?)(\d{1,2}\.\d+),([NS]),(\d*?)(\d{1,2}\.\d+),([EW]),[1-6]?,(\d+)?,(\.\d+|\d+\.?\d*)?,(-?\d+\.?\d*)?,M?/
617 0 0 $7 eq 'N' ? :
618 0 0 $10 eq 'E' ? :
628 0 0 unless /^\$[A-Z]{2}GLL,(\d*?)(\d{1,2}\.\d+),([NS]),(\d*?)(\d{1,2}\.\d+),([EW]),(\d{2})(\d{2})(\d+(\.\d*)?),A/
629 0 0 $3 eq 'N' ? :
630 0 0 $6 eq 'E' ? :
637 0 0 unless /^\$[A-Z]{2}GSA,[AM],([23]),((?:\d*,){11}(?:\d*)),(\d+\.?\d*|\.\d+)?,(\d+\.?\d*|\.\d+)?,(\d+\.?\d*|\.\d+)?\*/
649 0 0 unless /^\$[A-Z]{2}ZDA,(\d{2})(\d{2})(\d{2}(\.\d*)?),(\d+),(\d+),(\d+)/
658 0 12 unless /^\$PMGNTRK,(\d+)(\d{2}\.\d+),([NS]),(\d+)(\d{2}\.\d+),([EW]),(-?\d+\.?\d*),([MF]),(\d{2})(\d{2})(\d+(\.\d*)?),A,(?:[^,]*,(\d{2})(\d{2})(\d+))?/
659 12 0 $3 eq 'N' ? :
660 0 12 $6 eq 'E' ? :
661 12 0 $8 eq 'M' ? :
663 12 0 if (defined $15)
664 0 12 if $13 > 31 or $14 > 12 or $15 > 99
666 0 12 $15 >= 70 ? :
679 0 3 unless /^\$PTNTHPR,(-?[\d.]+),[MNO],(-?[\d.]+),[MNO],(-?[\d.]+),[MNO]/
688 0 25 if (defined $secs and not defined $date and defined $lastDate)
690 0 0 if ($secs < $lastSecs - &JITTER())
695 0 0 if ($secs - $lastSecs < 10) { }
705 25 3 if (defined $date)
717 25 3 if ($nmea eq $nmeaStart or defined $secs and !defined($fixSecs) || $secs >= $fixSecs && $secs - $fixSecs >= 10 || $secs < $fixSecs && $secs + $secPerDay - $fixSecs >= 10) { }
727 25 0 if (defined $date) { }
0 0 elsif (defined $secs) { }
740 9 0 unless defined $fix->{$_}
742 0 3 if (defined $date) { }
0 3 elsif (defined $secs and not defined $fixSecs) { }
743 0 0 if $fix->{'isDate'}
745 0 0 if (defined $fixSecs) { }
747 0 0 if @fixTimes and $fixTimes[-1] == $fixSecs
751 0 0 if $secs < $fixSecs
758 0 0 if $noDateChanged
774 0 8 if ($noDate and not $geotag->{'NoDate'})
775 0 0 if ($isDate) { }
782 8 0 if $isDate
785 0 8 if ($isCut and $canCut)
789 0 0 unless $fix = $points->{$_}
790 0 0 if ($maxPDOP and $fix->{'pdop'} and $fix->{'pdop'} > $maxPDOP) { }
0 0 elsif ($maxHDOP and $fix->{'hdop'} and $fix->{'hdop'} > $maxHDOP) { }
0 0 elsif ($minSats and defined $fix->{'nsats'} and $fix->{'nsats'} ne '' and $fix->{'nsats'} < $minSats) { }
811 0 8 if $sortFixes
814 0 8 unless $fix = $$points{$fixTimes[0]}
819 1 7 if ($verbose)
821 0 1 unless $format
823 0 1 if $cutPDOP
824 0 1 if $cutHDOP
825 0 1 if $cutSats
826 1 0 if ($numPoints and $verbose > 1)
829 0 1 if $fixTimes[0] > $fixTimes[-1]
831 0 1 if ($verbose > 3)
837 8 0 if ($numPoints)
841 2 6 if $nmea{'GGA'} or $nmea{'PMGNTRK'} or $nmea{'B'}
842 1 7 if $nmea{'RMC'}
843 1 7 if $nmea{'PTNTHPR'}
857 0 14 unless $timeStr =~ /^(\d{4})-(\d+)-(\d+)T(\d+):(\d+):(\d+)(\.\d+)?(.*)/
859 3 11 if $7
864 3 11 if ($tz =~ /^([-+])(\d+):(\d{2})\b/ or $tz =~ /^([-+])(\d{2})(\d{2})?\b/)
866 0 3 if $1 eq "+"
880 3 7 if (ref $sync eq 'HASH') { }
882 2 1 if ($syncTimes) { }
887 0 0 $time < $syncTimes->[$pt] ? :
892 0 2 $t1 == $t0 ? :
917 0 0 if $i < 0 or $i >= scalar @$times
919 0 0 if abs $t - $t0 > $maxSecs
922 0 0 if defined $v
937 0 0 if ($dir) { }
942 0 0 if (defined $t1) { }
0 0 elsif (defined $t2) { }
943 0 0 if (defined $t2) { }
945 0 0 $t - $t1 < $t2 - $t ? :
953 0 0 if (defined $p and $et->{'OPTIONS'}{'Verbose'} > 2)
974 0 10 if $val and $geotag and not $geotag->{'IsDate'}
981 0 13 unless defined $geoMaxIntSecs
982 0 13 unless defined $geoMaxExtSecs
990 0 10 unless (defined $geotag)
994 9 1 unless ($times)
999 0 1 unless ($times and @$times or $geotag->{'DateTimeOnly'})
1003 0 10 unless (eval { do { require Time::Local } })
1009 10 0 if ($val =~ /^(\d{4}):(\d+):(\d+)\s+(\d+):(\d+):(\d+)(\.\d*)?(Z|([-+])(\d+):(\d+))?/) { }
0 0 elsif ($val =~ /^(\d{2}):(\d+):(\d+)(\.\d*)?(Z|([-+])(\d+):(\d+))?/) { }
1022 9 1 if ($tz) { }
1025 5 4 if ($tz ne "Z")
1027 4 1 $t0 eq '-' ? :
1034 1 9 if $fs and $fs ne "."
1038 0 10 if $noDate
1044 2 8 $time =~ /(\.\d+)$/ ? :
1046 1 9 if ($et->Options("Verbose") > 1 and not $secondTry)
1049 1 0 if defined $sync
1050 0 1 unless ($tz)
1056 1 9 if (not $times && @$times) { }
0 9 elsif ($time < $times->[0]) { }
1 8 elsif ($time > $times->[-1]) { }
1060 0 0 if ($time < $times->[0] - $geoMaxExtSecs) { }
1061 0 0 unless $err
1062 0 0 if $verbose > 2
1063 0 0 if $geotag->{'DateTimeOnly'}
1067 0 0 if $verbose > 2
1071 1 0 if ($time > $times->[-1] + $geoMaxExtSecs) { }
1072 1 0 unless $err
1073 0 1 if $verbose > 2
1074 0 1 if $geotag->{'DateTimeOnly'}
1078 0 0 if $verbose > 2
1086 10 14 $time < $times->[$pt] ? :
1093 0 8 $p1->{'first'} && $geoMaxIntSecs ? :
1096 0 8 if ($t1 - $t0 > $maxSecs and !($p1->{'span'} && $points->{$t0}{'span'}) || $p1->{'span'} != $points->{$t0}{'span'}) { }
1101 0 0 if ($time - $t0 < $t1 - $time) { }
1108 0 0 if (abs $time - $tn > $geoMaxExtSecs) { }
1109 0 0 unless $err
1110 0 0 if $verbose > 2
1111 0 0 if $geotag->{'DateTimeOnly'}
1114 0 0 if $verbose > 2
1118 0 8 $t1 == $t0 ? :
1120 0 8 if $verbose > 2
1127 21 19 unless $has->{$category}
1134 30 6 if (defined $v0 and defined $v1) { }
0 6 elsif (defined $f0b) { }
1139 0 0 unless defined $v0 and defined $v1
1142 6 0 if $sepTags{$key}
1146 0 0 if (defined $v0) { }
1150 0 0 unless defined $t0b
1152 0 0 if (defined $v1) { }
1156 0 0 unless defined $t1b
1159 0 0 $t1b == $t0b ? :
1160 0 0 if $verbose > 2
1164 0 30 if ($cyclical{$key} and abs $v1 - $v0 > 180) { }
1167 0 0 $v0 < $v1 ? :
1170 0 0 $cyc180{$key} ? :
1171 0 0 if $fix->{$key} >= $max
1180 9 1 if ($fix) { }
0 1 elsif ($geotag->{'NoDate'} and not $noDate and $val =~ s/^\S+\s+//) { }
1189 9 4 if ($fix) { }
1194 9 0 unless $noDate
1196 5 4 if (defined $fix->{'alt'}) { }
0 8 elsif ($has->{'alt'} and defined $iExt) { }
1198 0 5 $fix->{'alt'} < 0 ? :
1201 0 0 if ($tFix)
1203 0 0 $tFix->{'alt'} < 0 ? :
1209 1 8 if ($writeGroup)
1219 3 6 if ($has->{'track'})
1221 0 3 if (not defined $fix->{'track'} and defined $iExt)
1223 0 0 if $p
1226 2 1 defined $tFix->{'track'} ? :
1228 1 2 if (defined($spd = $tFix->{'speed'}))
1231 0 1 if ($ref and defined $speedConv{$ref}) { }
1232 0 0 if $speedConv{$speedConv{$ref}}
1241 3 6 if ($has->{'orient'})
1243 0 3 if (not defined $fix->{'dir'} and defined $iExt)
1245 0 0 if $p
1248 2 1 defined $tFix->{'dir'} ? :
1254 0 9 if ($has->{'atemp'})
1256 0 0 if (not defined $fix->{'atemp'} and defined $iExt)
1259 0 0 if $p
1263 8 1 unless ($xmp)
1265 6 1 $fix->{'lat'} > 0 ? :
7 1 if defined $fix->{'lat'}
1266 4 3 $fix->{'lon'} > 0 ? :
7 1 if defined $fix->{'lon'}
1275 9 0 unless ($exif)
1280 1 3 if defined $val
1281 2 2 if $writeGroup
1313 4 1 if ($val =~ /(.*?)\@(.*)/) { }
0 1 elsif (not $val =~ /^\d/ && $val =~ /:/) { }
1315 0 4 -f $2 ? :
1318 0 0 if -f $val
1320 4 1 if ($gpsTime or defined $syncFile) { }
1322 0 4 if (defined $syncFile)
1328 0 0 if $info->{'Error'}
1329 0 0 unless ($gpsTime)
1331 0 0 if $gpsTime and not $info->{'GPSDateTime'}
1333 0 0 unless $gpsTime
1336 0 0 if ($info->{$tag})
1342 0 0 unless $imgTime
1346 4 0 if ($imgTime =~ /^(\d+:\d+:\d+)\s+\d+/) { }
0 0 elsif ($gpsTime =~ /^(\d+:\d+:\d+)\s+\d+/) { }
1349 4 0 if ($gpsTime =~ /^\d+:\d+:\d+\s+\d+/) { }
1367 0 4 unless defined $imgSecs
1369 0 4 unless defined $gpsSecs
1371 0 4 if $gpsTime =~ /(\.\d+)/
1372 0 4 if $imgTime =~ /(\.\d+)/
1374 0 4 if ($gpsDateTime ne $gpsTime or $imgDateTime ne $imgTime)
1376 0 0 if $diff > 43200
1377 0 0 if $diff < -43200
1378 0 0 if ($gpsDateTime ne $gpsTime) { }
1387 4 0 unless ($noDate)
1388 2 2 unless $sync->{'Points'}
1391 2 2 if ($et->Options("Verbose") > 1)
1399 2 2 if (@times > 1)
1407 0 1 unless @vals
1412 1 1 unless @vals
1415 0 1 $val =~ /^\s*-/ ? :
1444 0 0 if ($fix)
1446 0 0 unless $_ eq "time" or not defined $fix->{$_}