Hello!
After we had another issue with Ubuntu upgrades, and because that was on
our TODO list anyway, I decided to implement a channels.xml =>
channels.opml migration function in gPodder. The code is in SVN already,
and I have sent in a patch to the Ubuntu package[1].
For all of you who have not yet got the new package, but already
upgraded, here's the standalone tool which should also work. It simply
converts the channels.xml file to channels.opml and then exists. After
that, you can use gPodder 0.10.0 or newer with the migrated channel list
from gPodder 0.9.4 or earlier.
Thanks,
Thomas
[1] https://bugs.launchpad.net/ubuntu/+source/gpodder/+bug/179256
#!/usr/bin/python
from xml.dom import minidom
import os.path
def channels_xml_iter(filename='channels.xml'):
for e in minidom.parse(filename).getElementsByTagName('url'):
yield ''.join(n.data for n in e.childNodes if n.nodeType==n.TEXT_NODE)
def create_outline(doc, url):
outline = doc.createElement('outline')
outline.setAttribute('title', '')
outline.setAttribute('text', '')
outline.setAttribute('xmlUrl', url)
outline.setAttribute('type', 'rss')
return outline
def export_opml(urls, filename='channels.opml'):
doc = minidom.Document()
opml = doc.createElement('opml')
opml.setAttribute('version', '1.1')
doc.appendChild(opml)
body = doc.createElement('body')
for url in urls:
body.appendChild(create_outline(doc, url))
opml.appendChild(body)
open(filename,'w').write(doc.toxml(encoding='utf-8'))
infile = os.path.expanduser('~/.config/gpodder/channels.xml')
outfile = os.path.expanduser('~/.config/gpodder/channels.opml')
if os.path.exists(infile) and not os.path.exists(outfile):
export_opml(channels_xml_iter(infile), outfile)
print 'yippie!'
print 'converted ', infile
print 'to ', outfile
else:
print 'something went kind of wrong'
print 'maybe channels.opml already exists or channels.xml does not'
_______________________________________________
gpodder-devel mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/gpodder-devel