photo-stats

Unnamed repository; edit this file 'description' to name the repository.
git clone git://code.clttr.info/photo-stats.git
Log | Files | Refs | README | LICENSE

commit 56449e6cc0d261bd5dbbbd5d6469ef3ef52550ef
parent 7f71a7de0532ed4a48f22b6cdb93957666779649
Author: René Wagner <rwa@clttr.info>
Date:   Wed, 23 Jun 2021 19:32:54 +0200

really fix lens replacement on import

Diffstat:
Mphosta | 17++++++++---------
1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/phosta b/phosta @@ -14,6 +14,7 @@ use Cwd; use Getopt::Std; use File::Spec::Functions; use File::HomeDir; +use Data::Dumper; $Getopt::Std::STANDARD_HELP_VERSION = 'true'; @@ -166,18 +167,16 @@ sub populate foreach (@lines) { chomp $_; - my @line = split(/#/, $_); + map { s/^\s+|\s+$//g; } @line; my ($file, $maker, $model, $lensmake, $lens, $lensmodel, $fl, $fl35, $apert, $exposuretime, $ss, $iso, $flash, $datetimeoriginal) = @line; - - my @forbidden_content = ('Unknown', 'N/A', ''); - - grep /$maker/i, @forbidden_content or $maker = '-'; - grep /$model/i, @forbidden_content or $model = '-'; - $lens = grep /$lens/i,@forbidden_content ? $lensmodel : $lens; - grep /$lens/i, @forbidden_content or $lens = '-'; - $apert = ($apert ne '-') ? sprintf("%.1f", $apert) : $apert; + my @forbidden_content = ('Unknown', 'N/A', '', '-'); + if (!defined($maker) || $maker ~~ @forbidden_content) { $maker = '-'}; + if (!defined($model) || $model ~~ @forbidden_content) { $model = '-'}; + if (!defined($lens) || $lens ~~ @forbidden_content) { $lens = $lensmodel }; + if (!defined($lens) || $lens ~~ @forbidden_content) { $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;