blob: e5d984851cba4e4f7e3f145c64c38c4e64fd4f88 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
#!/usr/bin/env perl
use strict;
use warnings;
use Capture::Tiny qw(capture);
use constant {
NEWSBOAT_PATH => 'newsboat',
NOTIFYSEND_PATH => 'herbe'
};
sub notify
{
my ($str) = @_;
my $pid = fork();
if (not $pid) {
exec(NOTIFYSEND_PATH, $str);
}
return;
};
sub main
{
my $stdout;
my $nb;
$nb = NEWSBOAT_PATH;
if (system(
$nb,
'-x',
'reload'
) != 0) {
exit 1;
}
$stdout = qx($nb -x print-unread);
$stdout =~ s/\s.+//;
chomp $stdout;
if ($stdout != 0) {
notify(' ' . $stdout . ' new articles');
}
return;
}
main();
__END__
|