diff options
Diffstat (limited to 'module/plugins/internal/MultiHoster.py')
-rw-r--r-- | module/plugins/internal/MultiHoster.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/module/plugins/internal/MultiHoster.py b/module/plugins/internal/MultiHoster.py index 4ef43bc31..5aadf6f2e 100644 --- a/module/plugins/internal/MultiHoster.py +++ b/module/plugins/internal/MultiHoster.py @@ -28,6 +28,7 @@ class MultiHoster(Hook): self.supported = [] self.new_supported = [] + def getConfig(self, option, default=''): """getConfig with default value - sublass may not implements all config options""" try: @@ -35,6 +36,7 @@ class MultiHoster(Hook): except KeyError: return default + def getHosterCached(self): if not self.hosters: @@ -61,6 +63,7 @@ class MultiHoster(Hook): return self.hosters + def toHosterSet(self, hosters): hosters = set((str(x).strip().lower() for x in hosters)) @@ -72,6 +75,7 @@ class MultiHoster(Hook): hosters.discard('') return hosters + def getHoster(self): """Load list of supported hoster @@ -79,6 +83,7 @@ class MultiHoster(Hook): """ raise NotImplementedError + def coreReady(self): if self.cb: self.core.scheduler.removeJob(self.cb) @@ -94,9 +99,11 @@ class MultiHoster(Hook): else: self.periodical() + def initPeriodical(self): pass + def periodical(self): """reload hoster list periodically""" self.logInfo(_("Reloading supported hoster list")) @@ -112,6 +119,7 @@ class MultiHoster(Hook): for hoster in old_supported: self.unloadHoster(hoster) + def overridePlugins(self): pluginMap = {} for name in self.core.pluginManager.hosterPlugins.keys(): @@ -162,6 +170,7 @@ class MultiHoster(Hook): dict['pattern'] = regexp dict['re'] = re.compile(regexp) + def unloadHoster(self, hoster): dict = self.core.pluginManager.hosterPlugins[hoster] if "module" in dict: @@ -171,6 +180,7 @@ class MultiHoster(Hook): del dict['new_module'] del dict['new_name'] + def unload(self): """Remove override for all hosters. Scheduler job is removed by hookmanager""" for hoster in self.supported: @@ -182,6 +192,7 @@ class MultiHoster(Hook): dict['pattern'] = getattr(klass, "__pattern__", r'^unmatchable$') dict['re'] = re.compile(dict['pattern']) + def downloadFailed(self, pyfile): """remove plugin override if download fails but not if file is offline/temp.offline""" if pyfile.hasStatus("failed") and self.getConfig("unloadFailing", True): |