summaryrefslogtreecommitdiffstats
path: root/shotrss
blob: 5ed3eb6676edc257efe4087786a528c6fd1a51dd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/bin/zsh

file="$HOME/.newsbeuter/urls"
lines=$(wc -l $file | cut -d " " -f 1)
linum=$(( $RANDOM%$lines ))
url=$(sed -n -e ${linum}p $file | awk '{ print $1 }')
dbfile="$HOME/.local/share/newsbeuter/cache.db"

material=$(sqlite3 -separator ' # ' $dbfile "select title,url from rss_item where feedurl='$url' ORDER BY pubDate DESC LIMIT 5;" |\
    sed -n -e $(( $RANDOM % 5 + 1 ))p)
echo "$material[(ws:#:)2]"
echo "$material" > ~/.current
exec &>/dev/null
pidof w3m || exit 0
winum=$(~/bin/tux tnum w3m)
#tmux send-keys -t uake:$winum 'C-c' 'o' "${material[(ws:|:)2]}" 'Enter'
tmux send-keys -t uake:$winum 'C-c' 'T' "${material[(ws:|:)2]}" 'Enter'