summaryrefslogtreecommitdiffstats
path: root/shotrss
blob: e304f5b39665cf3d5ba9b5ee2a79d71d3ed68ac0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/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"
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'