From b5fd218d84c8604453da6aa237f28055a742a645 Mon Sep 17 00:00:00 2001 From: joe Date: Tue, 19 Aug 2025 18:33:49 +0200 Subject: up --- .local/bin/linkview | 38 ++++++++++++++++++++++++++++++++------ 1 file changed, 32 insertions(+), 6 deletions(-) (limited to '.local/bin') 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 ' . $url . '' + ' playing ' . $article_name . '' ); 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 ' . $article_name . '' + ); + if (system(TERMINAL_PATH, "-e", MPV_PATH, $url) != 0) { + exec( + NOTIFYSEND_PATH, + '-u', 'critical', + '-t', '10000', + 'playback failed', + ' failed to open ' . $url . '' + ); + } + 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 ' . $article_name . '' ); ($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 ' . $article_name . '' ); 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; } -- cgit v1.2.3