Change feed URL.
[planet-ucc.git] / OPMLWriter.py
1 #
2 # OPMPWriter
3 #
4 # A plugin to XMLWriter to output OPML
5 #
6 # This is apparently the most horrific abuse of XML known to man.
7 #
8 # (c) 2004, Davyd Madeley <[email protected]>
9 #
10
11 import time
12
13 class OPMLWriter:
14         def __init__(self, planet):
15                 self.parent     = None
16         
17         def write(self):
18                 output  =       ''
19                 output  +=      '<opml version="1.1">\n'
20                 output  +=      ' <head>\n'
21                 output  +=      '  <title>Planet UCC</title>\n'
22                 date    = time.strftime("%a, %d %b %Y %H:%M:%S +0800", time.localtime())
23                 output  +=      '  <dateCreated>%s</dateCreated>\n' % date
24                 output  +=      '  <dateModified>%s</dateModified>\n' % date
25                 output  +=      '  <ownerName>Planetmaster</ownerName>\n'
26                 output  +=      '  <ownerEmail>[email protected]</ownerEmail>\n'
27                 output  +=      ' </head>\n'
28                 output  +=      ' <body>\n'
29                 for blog in self.parent.blogs:
30                         output  +=      '  <outline text="%s" xmlURL="%s" />\n' % (blog.blogName, blog.feedURL)
31                 output  +=      ' </body>\n'
32                 output  +=      '</opml>'
33                 return output

UCC git Repository :: git.ucc.asn.au