compare media example (exiftool, ffprobe)
[barcat.git] / barcat
diff --git a/barcat b/barcat
index 5181143fe9bdd92d1544dc49b69f07e52ddaa754..37445908b20682e1d56c06fc962a989c750c78bf 100755 (executable)
--- a/barcat
+++ b/barcat
@@ -20,7 +20,9 @@ GetOptions(\%opt,
                eval {
                        local $_ = $_[1];
                        s/\A[0-9]+\z/(?:\\S*\\h+){$_}\\K/;
-                       s/\A[+]([0-9]*)\z/(?:\\d+\\D+\\b){$1}\\K \\s* (?=\\d)/;
+                       s{\A[+]([0-9]*)\z}{
+                               (!!$1 && '(?:\d+\D+\b){'.$1.'}\K') . '\s* (?=\d)'
+                       }e;
                        $opt{anchor} = qr/$_/;
                } or die $@ =~ s/(?:\ at\ \N+)?\Z/ for option $_[0]/r;
        },
@@ -605,7 +607,17 @@ Compare file sizes (with human-readable numbers):
 
 Same from formatted results, selecting the first numeric value:
 
-    tree -s --noreport | barcat -H -f+0
+    tree -s --noreport | barcat -H -f+
+
+Compare media metadata, like image size or play time:
+
+    exiftool -T -p '$megapixels ($imagesize) $filename' * | barcat
+
+    exiftool -T -p '$duration# $avgbitrate# $filename' * | barcat -H
+
+    find -type f -print0 | xargs -0 -L1 \
+    ffprobe -show_format -of json -v error |
+    jq -r '[.format|.duration,.bit_rate,.filename]|join(" ")' | barcat -H
 
 Memory usage of user processes with long names truncated: