summaryrefslogtreecommitdiffstats
path: root/.local/bin
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-x.local/bin/linkview38
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;
}