view OpmlImport.py @ 217:bb3c851b18b1

add source file endcoding header
author Dirk Olmes <dirk@xanthippe.ping.de>
date Sun, 27 Apr 2014 05:33:34 +0200
parents b8d209fdad14
children 699d8f1cebd4
line wrap: on
line source

# -*- coding: utf-8 -*-
from Feed import Feed
from xml.dom.minidom import parse

def createFeedsFromOPML(session=None, filename=None):
    document = parse(filename)
    outlines = document.getElementsByTagName("outline")
    for outline in outlines:
        url = outline.getAttribute("xmlUrl")
        title = outline.getAttribute("title")
        
        feed = Feed(title, url)
        session.add(feed)
    session.commit()