diff --git a/phosta.pl b/phosta.pl
index df8ecb3621ebcaebe01f47da1264778c3ec93f00..09f6f52934e64e3bfeb779666d831fb58029ca40 100755
--- a/phosta.pl
+++ b/phosta.pl
@@ -125,31 +125,28 @@ my @lines = `$cmd`;
my $dbh = DBI->connect($dsn, '', '', { RaiseError => 1 }) or die $DBI::errstr;
my $errorcount = 0;
- my $emptycount = 0;
foreach (@lines)
{
chomp $_;
my ($file, $maker, $model, $lensmake, $lens, $lensmodel, $fl, $fl35, $apert, $exposuretime, $ss, $iso, $flash, $datetimeoriginal) = split(/#/, $_);
my @forbidden_content = ('Unknown', 'N/A', '-', '');
- #if ($model eq '-') { $emptycount++; next; }
- if ( $maker ~~ @forbidden_content) { $maker = '-'; }
- if ( $model ~~ @forbidden_content) { $model = '-'; }
+ $maker !~ @forbidden_content or $maker = '-';
+ $model !~ @forbidden_content or $model = '-';
$lens = ($lens ~~ @forbidden_content) ? $lensmodel : $lens;
- if ( $lens ~~ @forbidden_content) { $lens = '-'; }
+ $lens !~ @forbidden_content or $lens = '-';
$apert = ($apert ne '-') ? sprintf("%.1f", $apert) : $apert;
$fl = ($fl ne '-') ? sprintf("%.1f", $fl) : $fl;
$fl35 = ($fl35 ne '-') ? POSIX::lround($fl35) : $fl35;
$exposuretime = (looks_like_number($exposuretime) && $exposuretime < 1 && $exposuretime != 0) ? "1/". POSIX::lround(1/$exposuretime) : $exposuretime;
- if ($datetimeoriginal eq '0000:00:00 00:00:00') { $datetimeoriginal = '-'; }
+ $datetimeoriginal =~ /\d{4}\-\d{2}\-\d{2}\s\d{2}:\d{2}:\d{2}$/ or $datetimeoriginal = '-';
my $stmt = "INSERT OR REPLACE INTO photos (file, maker, model, lensmake, lens, focallength, focallength35mm, aperture, exposuretime, iso, flash, datetimeoriginal)
VALUES ('$file', '$maker', '$model', '$lensmake', '$lens', '$fl', '$fl35', '$apert', '$exposuretime', '$iso', '$flash', '$datetimeoriginal')";
my $rv = $dbh->do($stmt) or $errorcount++;
}
$dbh->disconnect();
- say sprintf('%5d', $emptycount). ' image files skipped due to missing EXIF data';
say sprintf('%5d', $errorcount). ' image files skipped due to errors';
say "Updated database $opt_D.";
}