summaryrefslogtreecommitdiff
path: root/blib/script
diff options
context:
space:
mode:
authorjake <jake@jakes-mail.top>2022-09-03 17:13:08 -0400
committerjake <jake@jakes-mail.top>2022-09-03 17:13:08 -0400
commit934fd7f7c56cb22173d32dcd7ffb1389cddd2011 (patch)
treee32f575f86e0dce69bfc4c02993ba64fe68c2a44 /blib/script
initial commitHEADmaster
Diffstat (limited to 'blib/script')
-rw-r--r--blib/script/.exists0
-rwxr-xr-xblib/script/webx_type60
2 files changed, 60 insertions, 0 deletions
diff --git a/blib/script/.exists b/blib/script/.exists
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/blib/script/.exists
diff --git a/blib/script/webx_type b/blib/script/webx_type
new file mode 100755
index 0000000..88c6f93
--- /dev/null
+++ b/blib/script/webx_type
@@ -0,0 +1,60 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+use 5.010;
+
+sub checktype_filename {
+ # reads in 1kb of selected file, or returns undef if can't open,
+ # then checks contents
+
+ my($filename) = @_;
+ my $fh = IO::File->new($filename) || return;
+ my $data;
+ $fh->sysread($data, 1024);
+ $fh->close;
+ return $data;
+}
+
+
+sub personal_check {
+ my ($read) = @_;
+ if ($read =~ m/V_VP9/) {
+ return "WebM V9 detected.";
+ }
+ elsif ($read =~ m/V_VP8/) {
+ return "WebM V8 detected.";
+ }
+ elsif ($read =~ m/WEBPVP8L/) {
+ return "WebP V8 (Lossless) detected.";
+ }
+ elsif ($read =~ m/WEBPVP8/) {
+ return "WebP V8 (Not Lossless) detected.";
+ }
+ elsif ($read =~ m{google/video-file}) {
+ # Guess which mime is impossible to find info for?
+ # I happen to know that iPhone's can't play it.
+ return "WebM google/video-file.";
+ }
+ else {
+ return;
+ }
+}
+
+for (my $i = 0; $i < @ARGV; $i++) {
+ if (! -e $ARGV[$i]) {
+ warn "$ARGV[$i] doesn't exist or is not a file.";
+ next;
+ }
+
+ my $read = checktype_filename($ARGV[$i]). "\n";
+ my $matched = personal_check($read);
+
+ if ($matched) {
+ say "$ARGV[$i]: $matched";
+ #say "$matched";
+ }
+ else {
+ say "$ARGV[$i]: $read";
+ }
+}