-
Notifications
You must be signed in to change notification settings - Fork 0
/
tumblr
executable file
·45 lines (41 loc) · 956 Bytes
/
tumblr
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
#!/bin/bash
c="${1:- 0}"
urls=$(
grep 'http.*tumblr' /mnt/sda1/tumblr.urls \
| sed 's/ .*//' | sed "s/^/'/;s/\$/'/" \
| tr '\n' ',' | sed 's/,$//'
)
{
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< <( printf ".separator ' |'\nSELECT i.url,f.title,i.title FROM rss_item AS i JOIN rss_feed AS f ON i.feedurl = f.rssurl WHERE unread = 1 AND deleted = 0 AND feedurl IN (%s) ORDER BY pubDate ASC;" "$urls" \
| sqlite3 /mnt/sda1/tumblr.cache.db )