photo-stats

statistics processor for the terminal
git clone https://git.clttr.info/photo-stats.git
Log (Feed) | Files | Refs (Tags) | README | LICENSE

commit 02d07dced46152a426dd6e7fba44b599e8de4cc9
parent 09a46abda398e5d4d20f63925851b0bd1dd923c1
Author: René Wagner <rwagner@rw-net.de>
Date:   Sat, 26 Sep 2020 12:33:42 +0200

fix lens replacement

Diffstat:
Mphosta.pl | 20++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/phosta.pl b/phosta.pl @@ -62,14 +62,14 @@ exit 0; sub validate { my @group_params = ('year', 'month', 'week', 'hour'); - !defined($opt_g) || $opt_g ~~ @group_params or return 0; + !defined($opt_g) || grep /$opt_g/, @group_params or return 0; my @select_params = ('file', 'maker', 'model', 'lensmake', 'lens', 'aperture', 'exposuretime', 'iso', 'focallength', 'focallength35mm', ''); if (defined($opt_s)) { foreach (split (/,/, $opt_s)) { - $_ ~~ @select_params or return 0; + grep /$_/, @select_params or return 0; } } @@ -78,7 +78,7 @@ sub validate { foreach (split (/,/, $opt_o)) { - $_ ~~ @order_params or return 0; + grep /$_/, @order_params or return 0; } } (!defined($opt_n) || (looks_like_number($opt_n) && $opt_n > 0)) or return 0; @@ -99,11 +99,11 @@ sub getconfig sub writeconfig { - open(my $filehandle, '>', $configfile) or die "Could not open file '$configfile': $!"; + open(my $filehandle, '>', $configfile) or die "Could not open file '$configfile': $!"; say $filehandle '$opt_D="'. $opt_D .'";'; say $filehandle '$opt_E="'. $opt_E .'";'; say $filehandle '$opt_W="'. $opt_W .'";'; - close $filehandle; + close $filehandle; } sub getaliases @@ -166,12 +166,12 @@ sub populate 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', '-', ''); + my @forbidden_content = ('Unknown', 'N/A', ''); - $maker !~ @forbidden_content or $maker = '-'; - $model !~ @forbidden_content or $model = '-'; - $lens = ($lens ~~ @forbidden_content) ? $lensmodel : $lens; - $lens !~ @forbidden_content or $lens = '-'; + 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; $fl = ($fl ne '-') ? sprintf("%.1f", $fl) : $fl; $fl35 = ($fl35 ne '-') ? POSIX::lround($fl35) : $fl35;