Mercurial > hg > Feedworm
comparison backend/couchdb/FeedUpdater.py @ 161:2940e74c9663
Creating a feed via the GUI works now.
author | dirk |
---|---|
date | Mon, 29 Aug 2011 03:08:05 +0200 |
parents | b290e29a94b5 |
children | 04c3b9796b89 |
comparison
equal
deleted
inserted
replaced
160:86f828096aaf | 161:2940e74c9663 |
---|---|
1 | 1 |
2 from Feed import Feed | |
2 from FeedEntry import FeedEntry | 3 from FeedEntry import FeedEntry |
3 from backend.AbstractFeedUpdater import AbstractFeedUpdater | 4 from backend.AbstractFeedUpdater import AbstractFeedUpdater |
4 import logging | 5 import logging |
6 import feedparser | |
5 | 7 |
6 log = logging.getLogger("FeedUpdater") | 8 log = logging.getLogger("FeedUpdater") |
7 | 9 |
8 class FeedUpdater(AbstractFeedUpdater): | 10 class FeedUpdater(AbstractFeedUpdater): |
11 @staticmethod | |
12 def createFeed(url, database): | |
13 feedDict = feedparser.parse(url) | |
14 if feedDict.has_key("title"): | |
15 title = feedDict["feed"].title | |
16 else: | |
17 title = url | |
18 feed = Feed.create(url, title) | |
19 feed.store(database) | |
20 FeedUpdater(feed, database).update(feedDict) | |
21 | |
9 def __init__(self, feed, database): | 22 def __init__(self, feed, database): |
10 AbstractFeedUpdater.__init__(self, feed) | 23 AbstractFeedUpdater.__init__(self, feed) |
11 self.database = database | 24 self.database = database |
12 | 25 |
13 def _processEntry(self, entry): | 26 def _processEntry(self, entry): |