commit d405c300310ddeaba9ccb1bdbd6e57b7d2691915
parent 11aa35b6305752b6b75902f20e91d8fb072d1766
Author: René Wagner <rwa@clttr.info>
Date: Mon, 3 Apr 2023 19:24:37 +0200
add grouping and sorting info to query output
Diffstat:
M | phosta | | | 22 | ++++++++++++++++------ |
1 file changed, 16 insertions(+), 6 deletions(-)
diff --git a/phosta b/phosta
@@ -77,7 +77,7 @@ sub validate
{
foreach (split (/,/, $opt_s))
{
- grep /$_/, @select_params or return 0;
+ grep /$_/, @select_params or return 1;
}
}
@@ -118,7 +118,7 @@ sub writeconfig
close $filehandle;
}
-sub getaliases
+sub get_aliases
{
my @aliases;
if ( -f $aliasfile )
@@ -162,7 +162,7 @@ sub populate
say "Scanning $opt_p images...this may take a while...";
my $extensions = ' -ext ' . join(' -ext ', split(/\,/, $opt_E)) .' ';
- my @aliases = getaliases();
+ my @aliases = get_aliases();
my $cmd = "exiftool -fast2 -r -m -f -p '\$filepath##\$make##\$model##\$lensmake##\$lens##\$lensmodel##\$focallength##\$focallengthin35mmformat##\$aperture##\$exposuretime##\$shutterspeed##\$iso##\$flash##\$datetimeoriginal' -d \"%Y-%m-%d %H:%M:%S\" " . $extensions . "\"$opt_p\"";
!$opt_v or say "### Exiftool command: $cmd";
@@ -376,7 +376,7 @@ sub limit_results
sub print_filterinfo
{
my ($currentlines, $skippedlines, $sum) = @_;
- if (defined($opt_f) || defined($opt_t))
+ if (defined($opt_f) || defined($opt_t) || defined($opt_g))
{
say 'Applied filters:';
if ($opt_t)
@@ -388,16 +388,26 @@ sub print_filterinfo
}
foreach (get_filters())
{
- say ' - ' .color('italic') . @{$_}[0] .color('reset') . (@{$_}[1] =~ /!/ ? ' NOT' : '') . ' LIKE ' .color('bold') .@{$_}[2]. color('reset');;
+ say ' - ' .color('italic') . @{$_}[0] .color('reset') . (@{$_}[1] =~ /!/ ? ' NOT' : '') .' LIKE '.color('bold') .@{$_}[2]. color('reset');
}
+ if ($opt_g) {
+ foreach (split(/\,/, $opt_g)) {
+ say ' - group by '.color('italic'). $_ .color('reset');
+ }
+ }
say '';
}
+ say 'A total of '. color('bold'). "$sum images". color('reset') .' matched your criteria.';
+ if (defined($opt_o) || defined($opt_r))
+ {
+ say 'Sorted in '.color('bold'). ($opt_r ? 'ascending' : 'descending') .color('reset').' order by '. color('italic') . join(color('reset').', '.color('italic'), split(/\,/, $opt_o)). color('reset').'.';
+ }
+
if (defined($opt_n) || $opt_e)
{
say 'Showing '. color('bold'). "$currentlines". color('reset'). ' results, skipping '. color('italic') . "$skippedlines results".color('reset') .' due to empty fields.';
}
- say 'A total of '. color('bold'). "$sum images". color('reset') .' matched your criteria.';
say '';
}