diff feedupdate-main.py @ 4:e0199f383442

retrieve a feed for the given URL, store entries as feed_entry rows into the database
author Dirk Olmes <dirk@xanthippe.ping.de>
date Mon, 26 Apr 2010 19:33:07 +0200
parents 8a624ee48a74
children bfd47f55d85b
line wrap: on
line diff
--- a/feedupdate-main.py	Mon Apr 26 17:43:48 2010 +0200
+++ b/feedupdate-main.py	Mon Apr 26 19:33:07 2010 +0200
@@ -2,6 +2,7 @@
 
 from ConfigParser import ConfigParser
 from Feed import Feed
+from FeedUpdater import updateAllFeeds
 import Mapping
 import socket
 from sqlalchemy import create_engine
@@ -20,6 +21,13 @@
     session.add(newFeed)
     session.commit()
 
+def listFeeds(session):
+    allFeeds = session.query(Feed)
+    for feed in allFeeds:
+        print "\n\nfeed: " + feed.name
+        for entry in feed.entries:
+            print entry.title
+
 if __name__ == "__main__":
     databaseUrl = loadDatabaseProperties()
     engine = create_engine(databaseUrl,echo=True)
@@ -27,4 +35,6 @@
     SessionMaker = sessionmaker(bind = engine)
     session = SessionMaker()
     
-    createFeed(session)
+    #createFeed(session)
+    updateAllFeeds(session)
+    #listFeeds(session)