aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Ritter <xeno@thehappy.de>2009-12-03 14:48:20 +0100
committerStefan Ritter <xeno@thehappy.de>2009-12-03 14:48:20 +0100
commit6c778b2e8b67571fd52cf94e7a60f7eafaafe768 (patch)
treeaddc44802199b9514146f2f506d7e6af75b5d281
parent2fb6e1483d8cb60d3139d7728949d061555e8a11 (diff)
RSS:
* Displaying the last 10 entries * Added timestamp of each entry * Title now links to entry instead of blog_url
-rwxr-xr-xblogthon.cgi26
1 files changed, 14 insertions, 12 deletions
diff --git a/blogthon.cgi b/blogthon.cgi
index 3ff5dab..abfaf8d 100755
--- a/blogthon.cgi
+++ b/blogthon.cgi
@@ -228,24 +228,26 @@ if feed_display == "atom":
# Generate rss 2.0 feed
elif feed_display == "rss":
- title = str(entries[0][1]).replace('entries/', '', 1).replace('.' + entries_suffix, '')
- date = entries[0][0]
- blog_title_md5sum = generate_uuid(blog_title)
- title_md5sum = generate_uuid(title)
-
document_header("rss")
print ' <channel>'
print ' <title>' + blog_title + '</title>'
print ' <link>' + blog_url + '</link>'
print ' <description>' + blog_subtitle + '</description>'
- # TODO: Format like: "Tue, 8 Jul 2008 2:43:19"
- #print ' <pubDate>' + date + '<pubDate>'
+ date = time.strftime("%a, %d %b %Y %H:%M:%S", time.gmtime(time.mktime(entries[0][0])))
+ print ' <pubDate>' + date + '</pubDate>'
print ''
- print ' <item>'
- print ' <title>' + title + '</title>'
- print ' <link>' + blog_url + '</link>'
- print ' <guid>' + title_md5sum + '</guid>'
- print ' </item>'
+ j = len(entries)
+ if j > 10: j = 10
+ for i in xrange(0, len(entries)):
+ title = str(entries[i][1]).replace('entries/', '', 1).replace('.' + entries_suffix, '')
+ date = time.strftime("%a, %d %b %Y %H:%M:%S %z", time.gmtime(time.mktime(entries[i][0])))
+ title_md5sum = generate_uuid(title)
+ print ' <item>'
+ print ' <title>' + title + '</title>'
+ print ' <link>' + blog_url + '?p=' + title + '</link>'
+ print ' <guid>' + title_md5sum + '</guid>'
+ print ' <pubDate>' + date + '</pubDate>'
+ print ' </item>'
print ' </channel>'
print '</rss>'