Mercurial > hg > Feedworm
comparison feedupdate-main.py @ 35:aaec263f07ca
Feeds manage the point in time when the next update should happen. FeedUpdater only updates feeds that are due.
author | Dirk Olmes <dirk@xanthippe.ping.de> |
---|---|
date | Wed, 05 May 2010 03:07:59 +0200 |
parents | 5813e3c10f14 |
children | d21f5025034d |
comparison
equal
deleted
inserted
replaced
34:5813e3c10f14 | 35:aaec263f07ca |
---|---|
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 | 2 |
3 import Database | 3 import Database |
4 from Feed import Feed | 4 from Feed import Feed |
5 from FeedUpdater import updateAllFeeds | 5 import FeedUpdater |
6 import logging | 6 import logging |
7 import util | 7 import util |
8 | 8 |
9 logger = logging.getLogger("feedupdater") | 9 logger = logging.getLogger("feedupdater") |
10 | |
11 def createFeed(session): | |
12 if len(session.query(Feed).all()) == 0: | |
13 newFeed = Feed("Joel on Software", "http://www.joelonsoftware.com/rss.xml") | |
14 session.add(newFeed) | |
15 session.commit() | |
16 | 10 |
17 def listFeeds(session): | 11 def listFeeds(session): |
18 allFeeds = session.query(Feed) | 12 allFeeds = session.query(Feed) |
19 for feed in allFeeds: | 13 for feed in allFeeds: |
20 logger.info("feed: " + feed.name) | 14 logger.info("feed: " + feed.name) |
23 | 17 |
24 if __name__ == "__main__": | 18 if __name__ == "__main__": |
25 util.configureLogging() | 19 util.configureLogging() |
26 session = Database.createSession() | 20 session = Database.createSession() |
27 | 21 |
28 #createFeed(session) | 22 #util.loadFeeds(session) |
29 #updateAllFeeds(session) | 23 #util.forceUpdateAllFeeds(session) |
30 #listFeeds(session) | 24 #listFeeds(session) |
31 #session.close() | 25 FeedUpdater.updateAllFeeds(session) |
26 | |
27 session.close() |