sfeed_frames_categories.sh - randomcrap - random crap programs of varying quality
HTML git clone git://git.codemadness.org/randomcrap
DIR Log
DIR Files
DIR Refs
DIR README
DIR LICENSE
---
sfeed_frames_categories.sh (1141B)
---
1 #!/bin/sh
2
3 feed() {
4 echo "$category $1"
5 }
6
7 # menu.html but with categories.
8
9 cat <<!__EOF__
10 <html>
11 <head>
12 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
13 <link rel="stylesheet" type="text/css" href="style.css" />
14 </head>
15 <body class="frame">
16 <div id="sidebar">
17 !__EOF__
18
19 prevcat=""
20 IFS=" "
21 LC_CTYPE="C"
22 (category=""
23 . ~/.sfeed/sfeedrc
24 feeds
25
26 category=""
27 . ~/.sfeed/sfeedrc.daily
28 feeds) | \
29 sort -k1,1 -k2,2 | \
30 while read -r cat feed; do
31
32 # hack: count new
33 # NOTE: change to feed dir.
34 #file="$HOME/.sfeed/feeds/$feed"
35 file="$HOME/.sfeed/thisweek/$feed"
36 # file must exists and be non-zero filesize.
37 test -s "$file" || continue
38
39 if test x"$prevcat" != x"$cat"; then
40 echo ""
41 echo "<h2>$cat</h2>"
42 fi
43
44 new=$(cat "$file" 2>/dev/null | sfeed_plain | awk 'BEGIN { lines = 0; } /^N/ { lines++; } END { print lines; }')
45 if test x"$new" = x"0"; then
46 echo '<a href="items.html#'$feed'" target="items">'$feed' ('$new')</a><br/>'
47 else
48 echo '<a class="n" href="items.html#'$feed'" target="items"><b><u>'$feed' ('$new')</u></b></a><br/>'
49 fi
50
51 prevcat="$cat"
52 done
53
54 cat <<!__EOF__
55
56 </div>
57 </body>
58 </html>
59 !__EOF__