view feedupdate-main.py @ 21:c8bb3cee7935

pull out DisplayModel into its own file, add the scaffolding for the add feed menu entry
author Dirk Olmes <dirk@xanthippe.ping.de>
date Thu, 29 Apr 2010 05:03:38 +0200
parents 42a225be7e56
children 5813e3c10f14
line wrap: on
line source

#!/usr/bin/env python

from Feed import Feed
from FeedUpdater import updateAllFeeds
import logging
from util import configureLogging, createSession

logger = logging.getLogger("feedupdater")

def createFeed(session):
    if len(session.query(Feed).all()) == 0:
        newFeed = Feed("Joel on Software", "http://www.joelonsoftware.com/rss.xml")
        session.add(newFeed)
        session.commit()

def listFeeds(session):
    allFeeds = session.query(Feed)
    for feed in allFeeds:
        logger.info("feed: " + feed.name)
        for entry in feed.entries:
            print entry.title

if __name__ == "__main__":
    configureLogging()
    session = createSession()
    
    createFeed(session)
    updateAllFeeds(session)
    #listFeeds(session)