Control: forwarded -1 https://github.com/feed2imap/feed2imap/pull/22 Control: tags -1 +patch
On Sun, May 15, 2016 at 04:20:28PM +0800, Paul Wise wrote: > Package: feed2imap > Version: 1.2.5-1 > Severity: wishlist > File: /usr/bin/feed2imap-opmlexport > > rss2email has an option to export OPML from the configuration. > Since OPML is the standard interchange format for RSS feed reader > configuration it would be nice if feed2imap could allow export to OPML > for people who want to switch to a different feed reading system. I wrote one, attached. It's in Python, unfortunately, but if you're going to migrate to rss2email, you'll need that anyways. A.
#!/usr/bin/python
from __future__ import division, absolute_import
from __future__ import print_function, unicode_literals
from datetime import datetime
import fileinput
from xml.sax.saxutils import escape
import yaml
def main():
buf = ''
for line in fileinput.input():
buf += line.decode('utf-8')
feeds = yaml.load(buf)
body = ''
xml_tmpl = '''<opml version="1.0">
<head>
<title>{title}</title>
<dateModified>{date}</dateModified>
</head>
<body>
{body}</body>
</opml>'''
outline_tmpl = '<outline title="{name}" type="rss" xmlUrl="{url}" />'
for feed in feeds['feeds']:
body += outline_tmpl.format(name=escape(feed['name']),
url=escape(feed['url'])) + "\n"
output = xml_tmpl.format(title='feed2imap RSS feeds',
date=datetime.now(),
body=body).encode('utf-8')
print(output)
if __name__ == '__main__':
main()
signature.asc
Description: PGP signature
_______________________________________________ Pkg-ruby-extras-maintainers mailing list [email protected] http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-ruby-extras-maintainers
