def createFeed(self, attrs): # Normalize attribute names to lower case attrs = dict([(k.lower(), v) for k, v in attrs.items()]) # get common attributes name = attrs.get('text') or attrs.get('title') if not name: return nick = attrs['nick'] = attrs.get('nick', name.lower()) # select by nickname if self.nicks and nick not in self.nicks: return # observe hours (in UTC!) unless only some feeds are requested hours = attrs.get('hours') if hours and not self.nicks and not _matchHours(hours, time.gmtime()[3]): return # create a feed instance based on the OPML type attribute kind = attrs.get('type', 'rss').lower() if kind == 'rss': uri = attrs.get('xmlurl') if not uri: return feed = RSSFeed(attrs, name, uri) elif kind == 'x-plagg-html': uri = attrs.get('htmlurl') if not uri: return feed = HTMLFeed(attrs, name, uri) elif kind == 'x-plagg-computed': uri, suite = attrs.get('htmlurl'), attrs.get('commands') if not suite: return feed = ComputedFeed(attrs, name, uri, suite) else: return feed.path = os.path.join(self.newspath, nick) # disable the cache if only some feeds are requested if self.nicks: feed.use_cache = False return feed