more reliable rss notifs, seperating into notifs

This commit is contained in:
Alexander Bocken 2021-07-12 17:28:48 +02:00
parent 2043eeb7bb
commit 3e63093b5d
Signed by: Alexander
GPG Key ID: 1D237BE83F9B05E8

View File

@ -12,7 +12,7 @@ unread="$(sqlite3 "$CACHE" "SELECT unread,pubDate,title,feedurl FROM rss_item;"
echo "$unread" >> "$ALREADY_NOTIFIED"
[ "$( echo "$unread" | wc -l)" -gt 1 ] && plural=s
articles="$(echo "$unread" | cut -d'|' -f3,4)"
output="$(echo "$articles" | while read -r article; do
echo "$articles" | while read -r article; do
#remove '?' queries from URL
title="$(echo "$article" | cut -d'|' -f1)"
feed="$(echo "$article" | cut -d'|' -f2 | sed 's/?.*//')"
@ -20,13 +20,13 @@ output="$(echo "$articles" | while read -r article; do
name="$(grep "$feed" "$CONFIG" | grep '~' |
perl -pe "s/[^~\"]*\"~([^\"]*).*/\1/")"
#If no custom name present, use name from CACHE
echo "$feed"
if [ -z "$name" ]; then
name="$(sqlite3 "$CACHE" "SELECT url,title FROM rss_feed;" |
name="$(sqlite3 "$CACHE" "SELECT rssurl,title FROM rss_feed;" |
grep -F "$feed" | cut -d'|' -f2)"
fi
printf '%s:\n%s\n' "$name" "$title"
done)"
notify-send "new article${plural}" "$output"
notify-send "${name}:" "$title"
done
#update statusbar to account for new articles
pkill -RTMIN+13 dwmblocks