示例#1
0
    def __getitem__(self, key):
        from flexget.plugin import PluginError

        while self.store.is_lazy(key):
            index = next(
                (i for i, keys in enumerate(self.key_list) if key in keys),
                None)
            if index is None:
                # All lazy lookup functions for this key were tried unsuccessfully
                return None
            func = self.func_list.pop(index)
            self.key_list.pop(index)
            try:
                func(self.store)
            except PluginError as e:
                e.log.info(e)
            except Exception as e:
                log.error('Unhandled error in lazy lookup plugin: %s', e)
                from flexget.manager import manager

                if manager:
                    manager.crash_report()
                else:
                    log.debug('Traceback', exc_info=True)
        return self.store[key]
示例#2
0
 def __getitem__(self, key):
     from flexget.plugin import PluginError
     while self.store.is_lazy(key):
         index = next((i for i, keys in enumerate(self.key_list) if key in keys), None)
         if index is None:
             # All lazy lookup functions for this key were tried unsuccessfully
             raise KeyError(key)
         func = self.func_list.pop(index)
         self.key_list.pop(index)
         try:
             func(self.store)
         except PluginError as e:
             e.log.info(e)
         except Exception as e:
             log.error('Unhandled error in lazy lookup plugin')
             from flexget.manager import manager
             if manager:
                 manager.crash_report()
             else:
                 log.debug('Traceback', exc_info=True)
     return self.store[key]
示例#3
0
    def __getitem__(self, key):
        from flexget.plugin import PluginError

        while self.store.is_lazy(key):
            index = next(
                (i for i, callee in enumerate(self.callee_list) if key in callee.keys), None
            )
            if index is None:
                # All lazy lookup functions for this key were tried unsuccessfully
                return None
            callee = self.callee_list.pop(index)
            try:
                callee.func(self.store, *(callee.args or []), **(callee.kwargs or {}))
            except PluginError as e:
                e.logger.info(e)
            except Exception as e:
                logger.error('Unhandled error in lazy lookup plugin: {}', e)
                from flexget.manager import manager

                if manager:
                    manager.crash_report()
                else:
                    logger.opt(exception=True).debug('Traceback')
        return self.store[key]