t/examples: optional sample/media as exiftool input
authorMischa POSLAWSKY <perl@shiar.org>
Sat, 19 Nov 2022 18:49:59 +0000 (19:49 +0100)
committerMischa POSLAWSKY <perl@shiar.org>
Mon, 21 Nov 2022 18:49:29 +0000 (19:49 +0100)
.gitignore
sample/media/Makefile [new file with mode: 0644]
t/examples.t

index 9239659f8258d29ecf15f7406b695f460546fc95..398e4923266f52fbdad2e9258cfbd403b241535c 100644 (file)
@@ -3,3 +3,6 @@
 
 # review test results
 /sample/out
+
+# random cat videos
+/sample/media/*.*
diff --git a/sample/media/Makefile b/sample/media/Makefile
new file mode 100644 (file)
index 0000000..c9f7600
--- /dev/null
@@ -0,0 +1,23 @@
+DL = curl -sSf -o $@
+YTDL = yt-dlp -o $@
+DLV = $(YTDL) -S codec,+size
+DLA = $(YTDL) -x --audio-format opus
+
+media: utrecht-pub.jpg nyan.gif taddy-skates.webm serbia-bike.webm alugalug-intl.webm
+
+utrecht-pub.jpg:
+       # https://www.flickr.com/photos/albatz/25540736521
+       $(DL) https://live.staticflickr.com/1502/25540736521_b42ff96bc8_c.jpg
+
+nyan.gif:
+       # https://prguitarman.tumblr.com/post/4281177195
+       $(DL) https://64.media.tumblr.com/tumblr_lj0wls8poh1qb9bjho1_400.gifv
+
+taddy-skates.webm:
+       $(DLV) https://www.youtube.com/watch?v=YiE8V7sqjvw
+
+serbia-bike.webm:
+       $(DLV) https://www.youtube.com/watch?v=uAV2XE1d2Bo # 1bike1world
+
+alugalug-intl.opus:
+       $(DLA) https://www.youtube.com/watch?v=S61ENc51Z1Q # The Kiffness
index cfe0e3f73e2c75e76618c47389933c1306015b55..0f313ece5b636417432a3382653e4f7f705eed8f 100755 (executable)
@@ -11,8 +11,10 @@ use Test::More;
 }
 
 my %CMDARGS = (
-       ping => '-c 1',
+       ping => '-c 1 ',
        'cat \Khttpd/' => '/var/log/apache2/',
+       ' \K\*(?=\h*\|)' => 'sample/media/*.*',
+       find => 'sample/media -name \*.\* ',
 );
 
 my $filename = 'barcat';
@@ -68,8 +70,8 @@ SKIP: {
 
        # prepare shell command to execute
        while (my ($subcmd, $args) = each %CMDARGS) {
-               $subcmd .= " \\K", $args .= ' ' unless $subcmd =~ m/\\K/;
-               $cmd =~ s/\b$subcmd/$args/;
+               $subcmd .= " \\K" unless $subcmd =~ m/\\K/;
+               $cmd =~ s/$subcmd/$args/;
        }
 
        for my $param ($cmd =~ m{^[(\h]* (\w\S*)}gx) {