# minutes, where N is the shortest feed period value specified below.
userefresh 1
+# Whether to show the list of active feeds in the generated HTML.
+showfeeds 1
+
# The feeds you want to watch, in the format "feed period url".
# The period is the minimum time in minutes between updates; if less
# than period minutes have passed, "rawdog update" will skip that feed.
if hash.has_key(key): return hash[key]
return None
+def format_time(secs, config):
+ """Format a time and date nicely."""
+ t = time.localtime(secs)
+ return time.strftime(config["timeformat"], t) + ", " + time.strftime(config["dayformat"], t)
+
class Feed:
"""An RSS feed."""
f.write('</div>\n')
dw.close()
-
- print >>f, """</div>
-<div id="footer">
+ print >>f, '</div>'
+
+ if config["showfeeds"]:
+ print >>f, """<h2 id="feedstatsheader">Feeds</h2>
+<div id="feedstats">
+<table id="feeds">
+<tr id="feedsheader">
+<th>Feed</th><th>RSS</th><th>Last update</th><th>Next update</th>
+</tr>"""
+ feeds = self.feeds.values()
+ feeds.sort(lambda a, b: cmp(a.get_html_name().lower(), b.get_html_name().lower()))
+ for feed in feeds:
+ print >>f, '<tr class="feedsrow">'
+ print >>f, '<td>' + feed.get_html_link() + '</td>'
+ print >>f, '<td><a class="xmlbutton" href="' + feed.url + '">XML</a></td>'
+ print >>f, '<td>' + format_time(feed.last_update, config) + '</td>'
+ print >>f, '<td>' + format_time(feed.last_update + 60 * feed.period, config) + '</td>'
+ print >>f, '</tr>'
+ print >>f, """</table>
+</div>"""
+
+ print >>f, """<div id="footer">
<p id="aboutrawdog">Generated by rawdog version """ + VERSION + """
by <a href="mailto:azz@us-lot.org">Adam Sampson</a>.</p>
</div>
"dayformat" : "%A, %d %B %Y",
"timeformat" : "%I:%M %p",
"userefresh" : 0,
+ "showfeeds" : 1,
}
for line in f.readlines():
line = line.strip()
config["timeformat"] = l[1]
elif l[0] == "userefresh":
config["userefresh"] = int(l[1])
+ elif l[0] == "showfeeds":
+ config["showfeeds"] = int(l[1])
else:
print "Unknown config command: " + l[0]
return 1