def update_feeds(self): """Updates instances of all configured feeds from config""" from flexget.feed import Feed if not isinstance(self.config['feeds'], dict): log.critical('Feeds is in wrong datatype, please read configuration guides') return # construct feed list for name in self.config.get('feeds', {}): if not isinstance(self.config['feeds'][name], dict): continue if name in self.feeds: # This feed already has an instance, update it self.feeds[name].config = deepcopy(self.config['feeds'][name]) if not name.startswith('_'): self.feeds[name].enabled = True else: # Create feed feed = Feed(self, name, deepcopy(self.config['feeds'][name])) # If feed name is prefixed with _ it's disabled if name.startswith('_'): feed.enabled = False self.feeds[name] = feed # Delete any feed instances that are no longer in the config for name in [n for n in self.feeds if n not in self.config['feeds']]: del self.feeds[name]
def create_feeds(self): """Creates instances of all configured feeds""" from flexget.feed import Feed # Clear feeds dict self.feeds = {} if not 'feeds' in self.config: log.critical('There are no feeds in the configuration file!') return if not isinstance(self.config['feeds'], dict): log.critical('Feeds is in wrong datatype, please read configuration guides') return # construct feed list feeds = self.config.get('feeds', {}).keys() for name in feeds: # validate (TODO: make use of validator?) if not isinstance(self.config['feeds'][name], dict): if isinstance(self.config['feeds'][name], basestring): from flexget.plugin import plugins if name in plugins: log.error('\'%s\' is known keyword, but in wrong indentation level. \ Please indent it correctly under a feed. Reminder: keyword should have 2 \ more spaces than feed name.' % name) continue log.error('\'%s\' is not a properly configured feed, please check indentation levels.' % name) continue # create feed feed = Feed(self, name, self.config['feeds'][name]) # if feed name is prefixed with _ it's disabled if name.startswith('_'): feed.enabled = False self.feeds[name] = feed
def create_feeds(self): """Creates instances of all configured feeds""" from flexget.feed import Feed # Clear feeds dict self.feeds = {} # construct feed list feeds = self.config.get('feeds', {}).keys() for name in feeds: # create feed feed = Feed(self, name, self.config['feeds'][name]) # if feed name is prefixed with _ it's disabled if name.startswith('_'): feed.enabled = False self.feeds[name] = feed