Branch Coverage

blib/lib/Image/ExifTool/Geotag.pm
Criterion Covered Total %
branch 345 726 47.5


line true false branch
151 0 465 if ($v =~ s/^"//)
154 0 0 unless @toks
203 0 10 unless (eval { do { require Time::Local } })
213 8 2 unless $points
217 8 2 unless $has
221 0 10 if ($val =~ /^(\xef\xbb\xbf)?<(\?xml|gpx)[\s>]/) { }
0 10 elsif ($val =~ /(\x0d\x0a|\x0d|\x0a)/) { }
228 9 1 if ($et->Open(\*EXIFTOOL_TRKFILE, $val)) { }
1 0 elsif ($val eq 'DATETIMEONLY') { }
231 0 9 unless ($raf->Read($_, 256))
236 4 5 if (/^(\xef\xbb\xbf)?<(\?xml|gpx)[\s>]/) { }
5 0 elsif (/(\x0d\x0a|\x0d|\x0a)/) { }
256 0 9 unless ($from)
273 9 0 unless defined $csvDelim
276 9 388 unless $raf->ReadLine($_)
278 7 381 unless ($format)
280 0 7 if (/^\xff\xfe|\xfe\xff/)
283 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)"\s*:/) { }
0 2 elsif (/"(durationMinutesOffsetFromStartTime|startTime)"\s*:/) { }
295 0 1 $3 >= 70 ? :
318 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|Height)/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) { }
0 2 elsif ($userTag{lc $_}) { }
322 1 0 if ($trackFile and $trackFile =~ m[(\d{4})-(\d{2})-(\d{2})[^/]+(\d{2})-(\d{2})-(\d{2})[^/]*$]) { }
338 0 1 if /ref$/i
341 0 1 if /ref$/i
347 0 0 if (m[\((mph|km/h|m/s)\)]) { }
0 0 elsif ($isColumbus) { }
367 3 2 if ($param) { }
385 0 2 if ++$skipped > 50
392 243 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') { }
394 99 144 if (m[^([^<]+]+>)]) { }
409 63 256 if ($arg =~ /^(\w+:)?(\w+)=(['"])(.*?)\3/g)
411 27 36 unless defined $tag
412 36 27 if ($tag)
414 0 36 if ($keyCategory{$tag}) { }
0 36 elsif ($tag eq 'alt') { }
0 36 elsif ($tag eq 'atemp' or $tag eq 'speed' or $tag eq 'err') { }
418 0 0 if defined $fix->{'alt'} and not $fix->{'alt'} =~ /^[+-]?\d+\.?\d*/
419 0 0 if $fix->{'alt'}
429 92 142 unless defined $tag
431 42 192 if (defined $tag and not $tag)
433 21 21 if (not $2) { }
20 1 elsif ($fix and $lastFix and %$fix) { }
441 0 80 unless defined $lastFix->{$_}
446 71 142 if (length $1) { }
0 142 elsif ($tok eq 'td') { }
447 50 21 if ($tag)
448 3 47 if ($tag eq 'coords') { }
450 0 0 if (defined $fix->{'lon'} and defined $fix->{'lat'} and defined $fix->{'alt'})
455 0 3 if $fix->{'alt'}
457 0 47 if ($tok eq 'when' and $fix->{'time'}) { }
462 0 47 if ($keyCategory{$tag}) { }
20 27 elsif ($tag eq 'alt') { }
0 27 elsif ($tag eq 'atemp' or $tag eq 'speed' or $tag eq 'err') { }
466 0 20 if defined $fix->{'alt'} and not $fix->{'alt'} =~ /^[+-]?\d+\.?\d*/
467 20 0 if $fix->{'alt'}
478 77 65 unless defined $fix->{'lat'} and defined $fix->{'lon'}
479 42 23 unless (defined $fix->{'time'})
480 42 0 unless @saveTime
483 0 23 unless ($fix->{'lat'} =~ /^[+-]?\d+\.?\d*/ and $fix->{'lon'} =~ /^[+-]?\d+\.?\d*/)
484 0 0 unless $e0
487 0 23 unless (defined($time = &GetTime($fix->{'time'})))
488 0 0 unless $e1
492 0 23 if defined $fix->{'pdop'} or defined $fix->{'hdop'} or defined $fix->{'nsats'}
494 0 23 if ($fix->{'begin'})
497 0 0 if (defined $begin and $begin < $time)
502 0 0 unless @saveFix
507 0 0 if not $i and $points->{$t}
522 0 0 if $td and not $fix->{'time'} and /[\s>](\d{4}-\d{2}-\d{2})[T ](\d{2}:\d{2}:\d{2}(\.\d+)?)/
531 0 0 unless m[^TP,D,\s*([-+]?\d+\.\d*),\s*([-+]?\d+\.\d*),\s*(\d+)/(\d+)/(\d{4}),\s*(\d+):(\d+):(\d+)]
548 3 4 unless @parts == 12 and $parts[11] eq "ypr"
551 0 4 unless @d == 3 and @t == 3
577 1 460 unless defined $val and length $val
578 184 276 unless $param
579 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') { }
0 0 elsif ($param =~ /^_/) { }
584 0 0 if ($dateTime)
589 0 0 if ($val =~ m[^(\d{2})/(\d{2})/(\d{4})$]) { }
0 0 elsif ($val =~ /(\d{4}).*?(\d{2}).*?(\d{2})/) { }
0 0 elsif ($val =~ /^(\d{2})(\d{2})(\d{2})$/) { }
597 0 0 if ($val =~ /^(\d{1,2}):(\d{2}):(\d{2}(\.\d+)?).*?(([-+])(\d{1,2}):?(\d{2}))?/) { }
0 0 elsif ($val =~ /^(\d{2})(\d{2})(\d{2})$/) { }
600 0 0 $6 eq '-' ? :
0 0 if $5
607 0 0 if $val =~ /^S/i
609 0 0 if $val =~ /^W/i
616 0 0 if $scaleSpeed and $param eq "speed"
618 0 0 if $sepTags{$param}
623 0 0 unless defined $fix->{$param}
626 92 0 if ($date and defined $secs and defined $fix->{'lat'} and defined $fix->{'lon'})
628 0 92 if defined $fix->{'alt'}
629 0 92 if defined $fix->{'track'}
630 0 92 if defined $fix->{'pitch'}
636 0 0 if (/"(latitudeE7|longitudeE7|latE7|lngE7|timestamp|startTime|point|durationMinutesOffsetFromStartTime|time)"\s*:\s*"?(.*?)"?,?\s*[\x0d\x0a]/)
637 0 0 if ($1 eq 'timestamp' or $1 eq 'time') { }
0 0 elsif ($1 eq 'startTime') { }
0 0 elsif ($1 eq 'latitudeE7' or $1 eq 'latE7') { }
0 0 elsif ($1 eq 'longitudeE7' or $1 eq 'lngE7') { }
0 0 elsif ($1 eq 'point') { }
0 0 elsif ($1 eq 'durationMinutesOffsetFromStartTime' and defined $startTime) { }
639 0 0 if $time and $fix->{'lat'} and $fix->{'lon'}
649 0 0 if @coords == 2
653 0 0 if $time and $fix->{'lat'} and $fix->{'lon'}
659 19 22 if ($format eq "NMEA")
662 1 18 unless /^(.*)\$([A-Z]{2}(RMC|GGA|GLL|GSA|ZDA)|PMGNTRK|PTNTHPR),/
664 0 18 if length $1
669 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') { }
674 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})/
675 10 0 $7 eq 'N' ? :
676 10 0 $11 eq 'E' ? :
677 10 0 $12 eq 'A' ? :
680 10 0 if ($dateFlarm)
681 0 10 if $secs < $lastSecs - &JITTER()
692 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+)/
693 0 3 if $13 > 31 or $14 > 12 or $15 > 99
694 3 0 $7 eq 'N' ? :
695 3 0 $10 eq 'E' ? :
696 3 0 if length $11
697 3 0 if length $12
698 0 3 $15 >= 70 ? :
708 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?/
709 0 0 $7 eq 'N' ? :
710 0 0 $10 eq 'E' ? :
720 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/
721 0 0 $3 eq 'N' ? :
722 0 0 $6 eq 'E' ? :
729 0 0 unless /^\$[A-Z]{2}GSA,[AM],([23]),((?:\d*,){11}(?:\d*)),(\d+\.?\d*|\.\d+)?,(\d+\.?\d*|\.\d+)?,(\d+\.?\d*|\.\d+)?\*/
741 0 0 unless /^\$[A-Z]{2}ZDA,(\d{2})(\d{2})(\d{2}(\.\d*)?),(\d+),(\d+),(\d+)/
750 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+))?/
751 12 0 $3 eq 'N' ? :
752 0 12 $6 eq 'E' ? :
753 12 0 $8 eq 'M' ? :
755 12 0 if (defined $15)
756 0 12 if $13 > 31 or $14 > 12 or $15 > 99
758 0 12 $15 >= 70 ? :
771 0 3 unless /^\$PTNTHPR,(-?[\d.]+),[MNO],(-?[\d.]+),[MNO],(-?[\d.]+),[MNO]/
780 0 25 if (defined $secs and not defined $date and defined $lastDate)
782 0 0 if ($secs < $lastSecs - &JITTER())
787 0 0 if ($secs - $lastSecs < 10) { }
797 25 3 if (defined $date)
809 25 3 if ($nmea eq $nmeaStart or defined $secs and !defined($fixSecs) || $secs >= $fixSecs && $secs - $fixSecs >= 10 || $secs < $fixSecs && $secs + $secPerDay - $fixSecs >= 10) { }
819 25 0 if (defined $date) { }
0 0 elsif (defined $secs) { }
832 9 0 unless defined $fix->{$_}
834 0 3 if (defined $date) { }
0 3 elsif (defined $secs and not defined $fixSecs) { }
835 0 0 if $fix->{'isDate'}
837 0 0 if (defined $fixSecs) { }
839 0 0 if @fixTimes and $fixTimes[-1] == $fixSecs
843 0 0 if $secs < $fixSecs
850 0 0 if $noDateChanged
866 0 9 if ($noDate and not $geotag->{'NoDate'})
867 0 0 if ($isDate) { }
874 9 0 if $isDate
877 0 9 if ($isCut and $canCut)
881 0 0 unless $fix = $points->{$_}
882 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) { }
903 0 9 if $sortFixes
906 0 9 unless $fix = $$points{$fixTimes[0]}
911 1 8 if ($verbose)
913 0 1 unless $format
915 0 1 if $cutPDOP
916 0 1 if $cutHDOP
917 0 1 if $cutSats
918 1 0 if ($numPoints and $verbose > 1)
921 0 1 if $fixTimes[0] > $fixTimes[-1]
923 0 1 if ($verbose > 3)
929 9 0 if ($numPoints)
933 2 7 if $nmea{'GGA'} or $nmea{'PMGNTRK'} or $nmea{'B'}
934 1 8 if $nmea{'RMC'}
935 1 8 if $nmea{'PTNTHPR'}
949 0 23 unless $timeStr =~ /^(\d{4})-(\d+)-(\d+)T(\d+):(\d+):(\d+)(\.\d+)?(.*)/
951 3 20 if $7
956 3 20 if ($tz =~ /^([-+])(\d+):(\d{2})\b/ or $tz =~ /^([-+])(\d{2})(\d{2})?\b/)
958 0 3 if $1 eq "+"
972 3 8 if (ref $sync eq 'HASH') { }
974 2 1 if ($syncTimes) { }
979 0 0 $time < $syncTimes->[$pt] ? :
984 0 2 $t1 == $t0 ? :
1009 2 6 if $i < 0 or $i >= scalar @$times
1011 2 4 if abs $t - $t0 > $maxSecs
1014 0 4 if defined $v
1029 0 2 if ($dir) { }
1034 0 2 if (defined $t1) { }
0 2 elsif (defined $t2) { }
1035 0 0 if (defined $t2) { }
1037 0 0 $t - $t1 < $t2 - $t ? :
1045 0 2 if (defined $p and $et->{'OPTIONS'}{'Verbose'} > 2)
1066 0 11 if $val and $geotag and not $geotag->{'IsDate'}
1073 0 14 unless defined $geoMaxIntSecs
1074 0 14 unless defined $geoMaxExtSecs
1082 0 11 unless (defined $geotag)
1086 10 1 unless ($times)
1091 0 1 unless ($times and @$times or $geotag->{'DateTimeOnly'})
1095 0 11 unless (eval { do { require Time::Local } })
1101 11 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+))?/) { }
1114 10 1 if ($tz) { }
1117 5 5 if ($tz ne "Z")
1119 4 1 $t0 eq '-' ? :
1126 1 10 if $fs and $fs ne "."
1130 0 11 if $noDate
1136 2 9 $time =~ /(\.\d+)$/ ? :
1138 1 10 if ($et->Options("Verbose") > 1 and not $secondTry)
1141 1 0 if defined $sync
1142 0 1 unless ($tz)
1148 1 10 if (not $times && @$times) { }
0 10 elsif ($time < $times->[0]) { }
1 9 elsif ($time > $times->[-1]) { }
1152 0 0 if ($time < $times->[0] - $geoMaxExtSecs) { }
1153 0 0 unless $err
1154 0 0 if $verbose > 2
1155 0 0 if $geotag->{'DateTimeOnly'}
1159 0 0 if $verbose > 2
1163 1 0 if ($time > $times->[-1] + $geoMaxExtSecs) { }
1164 1 0 unless $err
1165 0 1 if $verbose > 2
1166 0 1 if $geotag->{'DateTimeOnly'}
1170 0 0 if $verbose > 2
1178 12 15 $time < $times->[$pt] ? :
1185 0 9 $p1->{'first'} && $geoMaxIntSecs ? :
1187 7 2 if ($time - $t0 < $t1 - $time) { }
1196 0 9 if ($t1 - $t0 > $maxSecs and !($p1->{'span'} && $points->{$t0}{'span'}) || $p1->{'span'} != $points->{$t0}{'span'}) { }
1200 0 0 if (abs $time - $tn > $geoMaxExtSecs) { }
1201 0 0 unless $err
1202 0 0 if $verbose > 2
1204 0 0 if $geotag->{'DateTimeOnly'}
1207 0 0 if $verbose > 2
1211 0 9 $t1 == $t0 ? :
1213 0 9 if $verbose > 2
1222 42 21 unless $has->{$category}
1229 33 6 if (defined $v0 and defined $v1) { }
0 6 elsif (defined $f0b) { }
1234 0 0 unless defined $v0 and defined $v1
1237 6 0 if $sepTags{$key}
1241 0 0 if (defined $v0) { }
1245 0 0 unless defined $t0b
1247 0 0 if (defined $v1) { }
1251 0 0 unless defined $t1b
1254 0 0 $t1b == $t0b ? :
1255 0 0 if $verbose > 2
1259 0 33 if ($cyclical{$key} and abs $v1 - $v0 > 180) { }
1262 0 0 $v0 < $v1 ? :
1265 0 0 $cyc180{$key} ? :
1266 0 0 if $fix->{$key} >= $max
1275 10 1 if ($fix) { }
0 1 elsif ($geotag->{'NoDate'} and not $noDate and $val =~ s/^\S+\s+//) { }
1284 10 4 if ($fix) { }
1289 10 0 unless $noDate
1292 0 4 if (not defined $alt and $has->{'alt'} and defined $iExt)
1294 0 0 if $tFix
1299 1 9 if ($writeGroup)
1307 6 4 if (defined $alt)
1309 0 6 $alt < 0 ? :
1316 1 9 if ($geoloc and $geoloc =~ /\bgeotag\b/i)
1317 1 0 $nvHash->{'WantGroup'} ? :
1320 0 1 if $parms
1325 0 10 if $qt
1331 3 7 if ($has->{'track'} or $has->{'speed'})
1332 3 0 $has->{'track'} ? :
1334 1 2 if (not defined $fix->{$type} and defined $iExt)
1336 0 1 if $p
1339 2 1 defined $tFix->{'track'} ? :
1341 1 2 if (defined($spd = $tFix->{'speed'}))
1344 0 1 if ($ref and defined $speedConv{$ref}) { }
1345 0 0 if $speedConv{$speedConv{$ref}}
1354 3 7 if ($has->{'orient'})
1356 1 2 if (not defined $fix->{'dir'} and defined $iExt)
1358 0 1 if $p
1361 2 1 defined $tFix->{'dir'} ? :
1367 0 10 if ($has->{'atemp'})
1369 0 0 if (not defined $fix->{'atemp'} and defined $iExt)
1372 0 0 if $p
1376 0 10 if ($has->{'err'})
1379 0 10 if ($has->{'dop'})
1381 0 0 if (defined $fix->{'pdop'}) { }
0 0 elsif (defined $fix->{'hdop'}) { }
1385 0 0 if (defined $fix->{'vdop'}) { }
1393 0 0 if (defined $dop)
1398 0 0 if ($hposErr)
1406 0 0 if ($err) { }
1415 9 1 unless ($xmp)
1417 7 1 $fix->{'lat'} > 0 ? :
8 1 if defined $fix->{'lat'}
1418 4 4 $fix->{'lon'} > 0 ? :
8 1 if defined $fix->{'lon'}
1427 10 0 unless ($exif)
1432 0 0 if defined $fix->{$_}
1436 1 3 if defined $val
1442 2 2 if $writeGroup
1474 4 1 if ($val =~ /(.*?)\@(.*)/) { }
0 1 elsif (not $val =~ /^\d/ && $val =~ /:/) { }
1476 0 4 -f $2 ? :
1479 0 0 if -f $val
1481 4 1 if ($gpsTime or defined $syncFile) { }
1483 0 4 if (defined $syncFile)
1489 0 0 if $info->{'Error'}
1490 0 0 unless ($gpsTime)
1492 0 0 if $gpsTime and not $info->{'GPSDateTime'}
1494 0 0 unless $gpsTime
1497 0 0 if ($info->{$tag})
1503 0 0 unless $imgTime
1507 4 0 if ($imgTime =~ /^(\d+:\d+:\d+)\s+\d+/) { }
0 0 elsif ($gpsTime =~ /^(\d+:\d+:\d+)\s+\d+/) { }
1510 4 0 if ($gpsTime =~ /^\d+:\d+:\d+\s+\d+/) { }
1528 0 4 unless defined $imgSecs
1530 0 4 unless defined $gpsSecs
1532 0 4 if $gpsTime =~ /(\.\d+)/
1533 0 4 if $imgTime =~ /(\.\d+)/
1535 0 4 if ($gpsDateTime ne $gpsTime or $imgDateTime ne $imgTime)
1537 0 0 if $diff > 43200
1538 0 0 if $diff < -43200
1539 0 0 if ($gpsDateTime ne $gpsTime) { }
1548 4 0 unless ($noDate)
1549 2 2 unless $sync->{'Points'}
1552 2 2 if ($et->Options("Verbose") > 1)
1560 2 2 if (@times > 1)
1568 0 1 unless @vals
1573 1 1 unless @vals
1576 0 1 $val =~ /^\s*-/ ? :
1604 0 0 if ($fix)
1606 0 0 unless $_ eq "time" or not defined $fix->{$_}
1621 0 14 if ($et->{'OPTIONS'}{'GeoUserTag'})
1623 0 0 unless /^(.+)=(.+)$/
1624 0 0 if $xmlTag{lc $2}