diff options
author | joe <rbo@gmx.us> | 2025-08-19 18:33:49 +0200 |
---|---|---|
committer | joe <rbo@gmx.us> | 2025-08-19 18:33:49 +0200 |
commit | b5fd218d84c8604453da6aa237f28055a742a645 (patch) | |
tree | ff2beaf0b20ed4e7bda571e02cc9a257368c3f5b /.local/bin/linkview | |
parent | up (diff) | |
download | dotfiles-bsd-b5fd218d84c8604453da6aa237f28055a742a645.tar.gz dotfiles-bsd-b5fd218d84c8604453da6aa237f28055a742a645.tar.bz2 dotfiles-bsd-b5fd218d84c8604453da6aa237f28055a742a645.tar.xz dotfiles-bsd-b5fd218d84c8604453da6aa237f28055a742a645.tar.zst dotfiles-bsd-b5fd218d84c8604453da6aa237f28055a742a645.zip |
up
Diffstat (limited to '.local/bin/linkview')
-rwxr-xr-x | .local/bin/linkview | 38 |
1 files changed, 32 insertions, 6 deletions
diff --git a/.local/bin/linkview b/.local/bin/linkview index 1141c9d..bc53897 100755 --- a/.local/bin/linkview +++ b/.local/bin/linkview @@ -35,6 +35,7 @@ use constant PROG_LIST => "" . "play" . "\n" . "img" . "\n" . "dl" . "\n" . +"pod" . "\n" . "pdf" . "\n" . "w3m" . "\n" . "browser" . "\n" . @@ -51,7 +52,7 @@ use constant QUAL_LIST => "" . sub open_link { - my ($a, $url) = @_; + my ($a, $url, $article_name) = @_; my $count; my $file_name; my $i; @@ -78,7 +79,7 @@ sub open_link '-u', 'low', '-t', '2000', 'playing media', - ' playing <b>' . $url . '</b>' + ' playing <b>' . $article_name . '</b>' ); if (system(MPV_PATH, $url) != 0) { exec( @@ -265,6 +266,31 @@ sub open_link } return; } + elsif ($a eq "pod") { + $pid = fork(); + if (not $pid) { + setsid(); + close_io(); + system( + NOTIFYSEND_PATH, + '-u', 'low', + '-t', '2000', + 'playing media', + ' playing <b>' . $article_name . '</b>' + ); + if (system(TERMINAL_PATH, "-e", MPV_PATH, $url) != 0) { + exec( + NOTIFYSEND_PATH, + '-u', 'critical', + '-t', '10000', + 'playback failed', + ' failed to open <b>' . $url . '</b>' + ); + } + return; + } + return; + } elsif ($a eq "img" || $a eq "pdf") { $pid = fork(); if (not $pid) { @@ -278,8 +304,8 @@ sub open_link NOTIFYSEND_PATH, '-u', 'low', '-t', '5000', - 'download started', - ' fetching thumbnail' + 'fetching thumbnail', + ' fetching thumbnail for <b>' . $article_name . '</b>' ); ($tmp, undef, $ret) = capture { system(YTDL_PATH, '--get-thumbnail', $url); @@ -290,7 +316,7 @@ sub open_link NOTIFYSEND_PATH, '-u', 'critical', 'failed to get thumbnail', - ' failed to get thumbail' + ' failed to get thumbail for <b>' . $article_name . '</b>' ); return; } @@ -439,7 +465,7 @@ sub linkview exit 1; } $answer = fzf_prompt($ARGV[0]); - open_link($answer, $ARGV[0]); + open_link($answer, $ARGV[0], $ARGV[1]); return; } |