當前位置: 首頁>>代碼示例>>Python>>正文


Python Task.enabled方法代碼示例

本文整理匯總了Python中flexget.task.Task.enabled方法的典型用法代碼示例。如果您正苦於以下問題:Python Task.enabled方法的具體用法?Python Task.enabled怎麽用?Python Task.enabled使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在flexget.task.Task的用法示例。


在下文中一共展示了Task.enabled方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: create_tasks

# 需要導入模塊: from flexget.task import Task [as 別名]
# 或者: from flexget.task.Task import enabled [as 別名]
    def create_tasks(self):
        """Creates instances of all configured tasks"""
        from flexget.task import Task
        # Clear tasks dict
        self.tasks = {}

        # Backwards compatibility with feeds key
        if 'feeds' in self.config:
            log.warning('`feeds` key has been deprecated and replaced by `tasks`. Please update your config.')
            if 'tasks' in self.config:
                log.error('You have defined both `feeds` and `tasks`. Stop that.')
            self.config['tasks'] = self.config.pop('feeds')
        # construct task list
        tasks = self.config.get('tasks', {}).keys()
        for name in tasks:
            # Make sure numeric task names are turned into strings. #1763, #1961
            if not isinstance(name, basestring):
                self.config['tasks'][unicode(name)] = self.config['tasks'].pop(name)
                name = unicode(name)
            # create task
            task = Task(self, name, self.config['tasks'][name])
            # if task name is prefixed with _ it's disabled
            if name.startswith('_'):
                task.enabled = False
            self.tasks[name] = task
開發者ID:Klaboe,項目名稱:Flexget,代碼行數:27,代碼來源:manager.py

示例2: update_tasks

# 需要導入模塊: from flexget.task import Task [as 別名]
# 或者: from flexget.task.Task import enabled [as 別名]
    def update_tasks(self):
        """Updates instances of all configured tasks from config"""
        from flexget.task import Task

        if not isinstance(self.config['tasks'], dict):
            log.critical('Tasks is in wrong datatype, please read configuration guides')
            return

        # construct task list
        for name in self.config.get('tasks', {}):
            if not isinstance(self.config['tasks'][name], dict):
                continue
            if name in self.tasks:
                # This task already has an instance, update it
                self.tasks[name].config = deepcopy(self.config['tasks'][name])
                if not name.startswith('_'):
                    self.tasks[name].enabled = True
            else:
                # Create task
                task = Task(self, name, deepcopy(self.config['tasks'][name]))
                # If task name is prefixed with _ it's disabled
                if name.startswith('_'):
                    task.enabled = False
                self.tasks[name] = task
        # Delete any task instances that are no longer in the config
        for name in [n for n in self.tasks if n not in self.config['tasks']]:
            del self.tasks[name]
開發者ID:Donavan,項目名稱:Flexget,代碼行數:29,代碼來源:manager.py


注:本文中的flexget.task.Task.enabled方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。