def __init__(self, taemin): plugin.TaeminPlugin.__init__(self, taemin) self.conf = taemin.conf.get("RSS", {}) if not self.conf: taemin.log.warning("Your RSS parser is not configure") self.feeds = [] for rss, params in self.conf.iteritems(): self.feeds.append(FeedThread(params.get("url", ""), self.on_newfeed, regex=params.get("regex", None), refresh=params.get("refresh", 60), name=rss)) for feed in Feed.select().where(Feed.conf == False): self.feeds.append(FeedThread(feed.url, self.on_newfeed, name=feed.name)) for feed in self.feeds: feed.start()
def get_feed(self, feed): if feed.regex: feed, test = Feed.get_or_create(name=feed.name, url=feed.rss, regex=feed.regex) else: feed, test = Feed.get_or_create(name=feed.name, url=feed.rss) return feed