guest@dotshare [~/groups/misc/misc] $ ls synthwave-newsbeuter/ | cat

synthwave newsbeuter (scrot)

fs0ciety Sep 05, 2016 (misc/misc)

config(raw, dl)

SCROT

 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
49
50
51
52
53
54
55
56
57
58
59
60
61
#                                  __                    __                  
#                                 /\ \                  /\ \__               
#    ___      __  __  __  __   ___\ \ \____    __  __  _\ \ ,_\    __  _ __  
#  /' _ `\  /'__`/\ \/\ \/\ \ /',__\ \ '__`\ /'__`/\ \/\ \ \ \/  /'__`/\`'__\
#  /\ \/\ \/\  __\ \ \_/ \_/ /\__, `\ \ \L\ /\  __\ \ \_\ \ \ \_/\  __\ \ \/ 
#  \ \_\ \_\ \____\ \___x___/\/\____/\ \_,__\ \____\ \____/\ \__\ \____\ \_\ 
#  \/_/\/_/\/____/\/__//__/  \/___/  \/___/ \/____/\/___/  \/__/\/____/\/_/ 

# /--------------------------\
# | Newsbeuter Configuration |
# | 2016 fs0ciety            |
# | https://fsociety.info    |
# \--------------------------/                                                                         

urls-source     "ttrss"
ttrss-url       ""
ttrss-login     ""
ttrss-password  ""

auto-reload "yes"
browser "[[ -n \"$( pgrep qutebrowser )\"  ]] && qutebrowser %u || w3m -M %u &> /dev/null "
html-renderer "w3m -dump -T text/html"
player "mpv"
feed-sort-order name

# <element>                 <fg>        <bg>         <attr>
color info                  white       magenta       bold
color listnormal_unread     magenta     default
color listfocus_unread      color255    green
color listfocus             color255    green
color listnormal            cyan        default
color article               white       default

# highlight feedlist    "^  *[0-9]+  *N  .*"    red    default
# highlight articlelist "^  *[0-9]+  *N  .*"    red    default

highlight article "(^Feed:|^Title:|^Author:|^Link:|^Date:|^Podcast Download URL:)"    red default

# Blacklist articles
# ----------------------------------------------------------

ignore-article "http://lwn.net/headlines/rss" "title =~ \"[$]\""

# Keybindings
# ----------------------------------------------------------

bind-key j next
bind-key k prev
bind-key J next-feed
bind-key K prev-feed
bind-key j down article
bind-key k up article
bind-key J next article
bind-key K prev article

macro o set browser open-in-browser

notify-format "%d %n %f"
notify-program "~/.newsbeuter/newsbeuter-notify"

# vim: set ft=config

CLICK TO VIEW

x

newsbeuty-notify(raw, dl)

  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
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
#!/usr/bin/env perl
#    */
#    Copyright 2010 Mikael Fridh
#
#    This program is free software: you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation, either version 3 of the License, or
#    (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
# */

use strict;
use warnings;

use DBI qw(:sql_types);

# defaults
my $new_articles = 0;
my $unread_articles = 0;
my $unread_feeds = 0;
my $notify_format = "%d new articles (%d unread, %d unread feeds)";
my $notify_string;
my $cache_file = $ENV{HOME} . "/.newsbeuter/cache.db";

if (defined ($ARGV[0])) {
    ($new_articles, $unread_articles, $unread_feeds) = split(/\s+/, $ARGV[0]);
}

if ($new_articles == 0) {
    if ($unread_articles+$unread_feeds == 0) {
        # All values are zero, notification pointless
        exit(0);
    } else {
        $notify_string = sprintf($notify_format, $new_articles, $unread_articles,
        $unread_feeds);
    }
} elsif ($new_articles > 0) {
    $notify_string = newsbeuter_cache_fetch($new_articles);
}

print $notify_string . "\n";

exec("notify-send", "newsbeuter", $notify_string);
exit(0);

sub newsbeuter_cache_fetch {
    my $limit = shift;
    my $more = 0;

    if ($limit > 5) { 
        $more = $limit - 5;
        $limit = 5;
    }

    my $dbh = DBI->connect("dbi:SQLite:dbname=$cache_file","","");
    my $sth = $dbh->prepare("select i.id, i.title, i.author, i.url, \
                            f.title as feed_url \
                            from rss_item as i \
                            join rss_feed as f \
                            on (i.feedurl = f.rssurl)
                            where i.unread=1 \
                            order by i.pubDate desc limit ?");
    $sth->bind_param(1, $limit, SQL_INTEGER);
    $sth->execute();

    my @posts;
    # id, author, url is unused, but I keep it here for reference.
    # Extending or changing the output format is easy.
    while (my ($id, $title, $author, $url, $ftitle) = $sth->fetchrow_array) {
        push(@posts, sprintf("<b>%s</b>: %s", $ftitle, $title) );
    }

    if ($more) {
        push(@posts, sprintf("... %d more articles", $more));
    }

    $sth->finish();
    $dbh->disconnect();

    my $notify_string = join("\n", @posts);
    return $notify_string;
}

=head1 NAME

newsbeuter-notify - Newsbeuter Notify

=head1 SYNOPSIS

=over 4

=item * Copy this script to F<~/.newsbeuter/newsbeuter-notify>.

=item * Add the following to your F<~/.newsbeuter/config>:

    notify-format "%d %n %f"
    notify-program "~/.newsbeuter/newsbeuter-notify"

=back

=head1 REQUIREMENTS

This version of newsbeuter-notify requires B<libnotify-bin>, B<libdbd-sqlite3-perl>

=head1 BUGS

None if set up correctly ;-).

=head1 TODO

Make it more generic, support more notification frameworks.

=head1 AUTHOR

Mikael Fridh 

=cut
 

x

Notes

Synthwave theme for Newsbeuter

Also added Newsbeuter-notify in case you use libnotify (written by Mikael Fridh)