summaryrefslogtreecommitdiffstats
path: root/.local/bin/mpview
diff options
context:
space:
mode:
authorJoe <rrbo@proton.me>2023-03-13 16:11:54 +0100
committerJoe <rrbo@proton.me>2023-03-13 16:11:54 +0100
commitcd8880e2ebbcfbe6c543a25771d2207542eaa008 (patch)
tree2a7f5584b611d71f5e5fc2eaa0672ecb2c65f477 /.local/bin/mpview
parentup (diff)
downloaddotfiles-bsd-cd8880e2ebbcfbe6c543a25771d2207542eaa008.tar.gz
dotfiles-bsd-cd8880e2ebbcfbe6c543a25771d2207542eaa008.tar.bz2
dotfiles-bsd-cd8880e2ebbcfbe6c543a25771d2207542eaa008.tar.xz
dotfiles-bsd-cd8880e2ebbcfbe6c543a25771d2207542eaa008.tar.zst
dotfiles-bsd-cd8880e2ebbcfbe6c543a25771d2207542eaa008.zip
up
Diffstat (limited to '')
-rwxr-xr-x.local/bin/mpview91
1 files changed, 0 insertions, 91 deletions
diff --git a/.local/bin/mpview b/.local/bin/mpview
deleted file mode 100755
index c1ea734..0000000
--- a/.local/bin/mpview
+++ /dev/null
@@ -1,91 +0,0 @@
-#!/usr/bin/env perl
-
-use strict;
-use warnings;
-use Scalar::Util qw(looks_like_number);
-use Term::ReadKey;
-use Term::ANSIColor;
-
-sub get_size
-{
- my $size;
- my $answer;
-
- $size = 0;
- $answer = 0;
- print
- "1) 0\n" .
- "2) 240\n" .
- "3) 360\n" .
- "4) 480\n" .
- "5) 720\n" .
- "6) 1080\n" .
- "\n" .
- "> ";
- open(TTY, "</dev/tty");
- ReadMode "raw";
- $answer = ReadKey 0, *TTY;
- ReadMode "normal";
- close(TTY);
- print "\n";
- if (
- !looks_like_number($answer) ||
- $answer == 0 ||
- $answer == 1 ||
- $answer > 6
- ) {
- $size = 0;
- }
- elsif ($answer == 2) {
- $size = 240;
- }
- elsif ($answer == 3) {
- $size = 360;
- }
- elsif ($answer == 4) {
- $size = 480;
- }
- elsif ($answer == 5) {
- $size = 720;
- }
- elsif ($answer == 6) {
- $size = 1080;
- }
- return $size;
-}
-
-sub main
-{
- my $size;
-
- if ($#ARGV + 1 == 0) {
- print STDERR "URL needed\n";
- exit 1;
- }
- $size = get_size();
- if ($size != 0) {
- print 'mpv --really-quiet --audio-channels=stereo --ytdl-format=[height<=' . $size . '] ' . $ARGV[0] . "\n";
- exec(
- 'mpv',
- '--really-quiet',
- '--audio-channels=stereo',
- '--ytdl-format=[height<=' . $size . ']',
- $ARGV[0]
- );
- }
- else {
- print 'mpv --really-quiet --audio-channels=stereo ' . $ARGV[0] . "\n";
- exec(
- 'mpv',
- '--really-quiet',
- '--audio-channels=stereo',
- $ARGV[0]
- );
- }
- print "$size\n";
- exit 0;
-}
-
-main();
-
-__END__