2021-05-11 18:12:41 +02:00
|
|
|
#!/bin/sh
|
|
|
|
CACHE="${XDG_DATA_HOME:-$HOME/.local/share}/newsboat/cache.db"
|
2021-05-12 00:08:52 +02:00
|
|
|
ALREADY_NOTIFIED="${XDG_DATA_HOME:-$HOME/.local/share}/newsboat/notified"
|
|
|
|
[ -f "$ALREADY_NOTIFIED" ] || touch "$ALREADY_NOTIFIED"
|
|
|
|
|
2021-05-11 18:12:41 +02:00
|
|
|
unread="$(sqlite3 "$CACHE" "SELECT unread,pubDate,title FROM rss_item;" |
|
2021-05-12 00:08:52 +02:00
|
|
|
grep -vE '^0' | sort -t'|' -k2 -gr |
|
|
|
|
grep -vf "$ALREADY_NOTIFIED")"
|
2021-05-11 18:12:41 +02:00
|
|
|
|
2021-05-12 00:08:52 +02:00
|
|
|
echo "$unread" >> "$ALREADY_NOTIFIED"
|
|
|
|
[ "$( echo "$unread" | wc -l)" -gt 1 ] && plural=s
|
|
|
|
formatted="$(echo "$unread" | sed 's/[0-9]*|[0-9]*|//')"
|
|
|
|
notify-send "newsboat" "$(printf 'new article%s:\n %s' "$plural" "$formatted")"
|