-
Notifications
You must be signed in to change notification settings - Fork 0
/
tumblr2
executable file
·47 lines (44 loc) · 952 Bytes
/
tumblr2
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
#!/bin/bash
c="${1:- 0}"
{
urls=()
while read url title <&3 ; do
urls+=("$url")
titles+=("$title")
done
unset TMOUT
pause=20
for ((; c < ${#urls[@]}; c++)) ; do
i="${urls[c]}"
((c%5 == 0)) && {
while read -sn 1 -t $pause key ; do
case $key in
[sp])
read -sn1 -p $'Paused\n'
;;
'+')
((pause=pause+5))
echo "Delay: $pause"
;;
'-')
((pause > 5)) && ((pause=pause-5))
echo "Delay: $pause"
;;
*)
break;
esac
done
}
echo "$((c+1)) ${titles[c]}"
firefox -new-tab "$i"
done
} 3< <(
q=".separator ' |'\n"
q+="SELECT i.url,f.title,i.title FROM rss_item AS i JOIN rss_feed AS f ON i.feedurl = f.rssurl "
q+="WHERE unread = 1 AND deleted = 0 AND feedurl = '%s' ORDER BY pubDate ASC;"
grep '^http.*tumblr' ~/sync/tumblr.urls | sed 's/ .*//' | \
while read feed ; do
printf "$q" "$feed" | sqlite3 ~/sync/tumblr.cache.db
done
)
# vim:sw=4:ts=4