From df143e902d00903f16cf32174948f636bda56e4c Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Thu, 8 Jan 2015 22:58:32 +0100 Subject: "New Year" Update: internal plugins --- module/plugins/internal/MultiHook.py | 158 +++++++++++++++++++++-------------- 1 file changed, 96 insertions(+), 62 deletions(-) (limited to 'module/plugins/internal/MultiHook.py') diff --git a/module/plugins/internal/MultiHook.py b/module/plugins/internal/MultiHook.py index ea9f32673..202868175 100644 --- a/module/plugins/internal/MultiHook.py +++ b/module/plugins/internal/MultiHook.py @@ -9,12 +9,15 @@ from module.utils import remove_chars class MultiHook(Hook): __name__ = "MultiHook" __type__ = "hook" - __version__ = "0.29" + __version__ = "0.30" - __config__ = [("mode" , "all;listed;unlisted", "Use for plugins (if supported)" , "all"), - ("pluginlist" , "str" , "Plugin list (comma separated)" , "" ), - ("revertfailed", "bool" , "Revert to standard download if download fails", False), - ("interval" , "int" , "Reload interval in hours (0 to disable)" , 12 )] + __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), + ("pluginlist" , "str" , "Plugin list (comma separated)" , "" ), + ("revertfailed" , "bool" , "Revert to standard download if fails", True ), + ("retry" , "int" , "Number of retries before revert" , 10 ), + ("retryinterval" , "int" , "Retry interval in minutes" , 1 ), + ("reload" , "bool" , "Reload plugin list" , True ), + ("reloadinterval", "int" , "Reload interval in hours" , 12 )] __description__ = """Hook plugin for multi hoster/crypter""" __license__ = "GPLv3" @@ -22,45 +25,68 @@ class MultiHook(Hook): ("Walter Purcaro", "vuolter@gmail.com")] - MIN_INTERVAL = 12 * 60 * 60 #: reload plugins every 12h + MIN_INTERVAL = 1 * 60 * 60 - PLUGIN_REPLACEMENTS = [("1fichier.com" , "onefichier.com"), - ("2shared.com" , "twoshared.com" ), - ("4shared.com" , "fourshared.com"), - ("cloudnator.com" , "shragle.com" ), - ("easy-share.com" , "crocko.com" ), - ("fileparadox.com", "fileparadox.in"), - ("freakshare.net" , "freakshare.com"), - ("hellshare.com" , "hellshare.cz" ), - ("ifile.it" , "filecloud.io" ), - ("nowdownload.ch" , "nowdownload.sx"), - ("nowvideo.co" , "nowvideo.sx" ), - ("putlocker.com" , "firedrive.com" ), - ("share-rapid.cz" , "multishare.cz" ), - ("sharerapid.cz" , "multishare.cz" ), - ("ul.to" , "uploaded.to" ), - ("uploaded.net" , "uploaded.to" )] + DOMAIN_REPLACEMENTS = [(r'\d+.+' , "_\0" ), + (r'bayfiles\.net' , "bayfiles.com" ), + (r'cloudnator\.com' , "shragle.com" ), + (r'dfiles\.eu' , "depositfiles.com"), + (r'easy-share\.com' , "crocko.com" ), + (r'freakshare\.net' , "freakshare.com" ), + (r'hellshare\.com' , "hellshare.cz" ), + (r'ifile\.it' , "filecloud.io" ), + (r'nowdownload\.\w+', "nowdownload.sx" ), + (r'nowvideo\.\w+' , "nowvideo.sx" ), + (r'putlocker\.com' , "firedrive.com" ), + (r'share-?rapid\.cz', "multishare.cz" ), + (r'ul\.to' , "uploaded.to" ), + (r'uploaded\.net' , "uploaded.to" ), + (r'uploadhero\.co' , "uploadhero.com" ), + (r'zshares\.net' , "zshare.net" )] def setup(self): - self.account = None - self.type = self.core.pluginManager.findPlugin(self.__name__)[1] or "hoster" self.plugins = [] self.supported = [] self.new_supported = [] + self.account = None + self.pluginclass = None + self.pluginmodule = None + self.pluginname = None + self.plugintype = None - def coreReady(self): - self.account = self.core.accountManager.getAccountPlugin(self.__name__) + self._initPlugin() + + + def _initPlugin(self): + plugin, type = self.core.pluginManager.findPlugin(self.__name__) + + if not plugin: + self.logWarning("Hook plugin will be deactivated due missing plugin reference") + self.setConfig('activated', False) + else: + self.pluginname = self.__name__ + self.plugintype = type + self.pluginmodule = self.core.pluginManager.loadModule(type, self.__name__) + self.pluginclass = getattr(self.pluginmodule, self.__name__) + + + def _loadAccount(self): + self.account = self.core.accountManager.getAccountPlugin(self.pluginname) if self.account and not self.account.canUse(): self.account = None - if not self.account: - self.logWarning("MultiHook will be deactivated due missing account reference") + if not self.account and hasattr(self.pluginclass, "LOGIN_ACCOUNT") and not self.pluginclass.LOGIN_ACCOUNT: + self.logWarning("Hook plugin will be deactivated due missing account reference") self.setConfig('activated', False) + def coreReady(self): + self._loadAccount() + + def getURL(self, *args, **kwargs): #@TODO: Remove in 0.4.10 """ see HTTPRequest for argument list """ h = pyreq.getHTTPRequest(timeout=120) @@ -81,19 +107,19 @@ class MultiHook(Hook): return default - def pluginCached(self): + def pluginsCached(self): if not self.plugins: try: - pluginset = self.pluginSet(self.getHosters() if self.type == "hoster" else self.getCrypters()) + pluginset = self._pluginSet(self.getHosters() if self.plugintype == "hoster" else self.getCrypters()) except Exception, e: self.logError(e) return [] try: - configmode = self.getConfig("mode", 'all') + configmode = self.getConfig("pluginmode", 'all') if configmode in ("listed", "unlisted"): pluginlist = self.getConfig("pluginlist", '').replace('|', ',').replace(';', ',').split(',') - configset = self.pluginSet(pluginlist) + configset = self._pluginSet(pluginlist) if configmode == "listed": pluginset &= configset @@ -108,13 +134,14 @@ class MultiHook(Hook): return self.plugins - def pluginSet(self, plugins): + def _pluginSet(self, plugins): plugins = set((str(x).strip().lower() for x in plugins)) - for rep in self.PLUGIN_REPLACEMENTS: - if rep[0] in plugins: - plugins.remove(rep[0]) - plugins.add(rep[1]) + for rf, rt in self.DOMAIN_REPLACEMENTS: + regex = re.compile(rf) + for p in filter(lambda x: regex.match(x), plugins): + plugins.remove(p) + plugins.add(re.sub(rf, rt, p)) plugins.discard('') @@ -139,9 +166,7 @@ class MultiHook(Hook): def periodical(self): """reload plugin list periodically""" - self.interval = max(self.getConfig("interval", 0), self.MIN_INTERVAL) - - self.logInfo(_("Reloading supported %s list") % self.type) + self.logInfo(_("Reloading supported %s list") % self.plugintype) old_supported = self.supported @@ -158,18 +183,24 @@ class MultiHook(Hook): for plugin in old_supported: self.unloadPlugin(plugin) + if self.getConfig("reload", True): + self.interval = max(self.getConfig("reloadinterval", 12), self.MIN_INTERVAL) + else: + self.core.scheduler.removeJob(self.cb) + self.cb = None + def overridePlugins(self): excludedList = [] - if self.type == "hoster": + if self.plugintype == "hoster": pluginMap = dict((name.lower(), name) for name in self.core.pluginManager.hosterPlugins.iterkeys()) accountList = [account.type.lower() for account in self.core.api.getAccounts(False) if account.valid and account.premium] else: pluginMap = {} accountList = [name[::-1].replace("Folder"[::-1], "", 1).lower()[::-1] for name in self.core.pluginManager.crypterPlugins.iterkeys()] - for plugin in self.pluginCached(): + for plugin in self.pluginsCached(): name = remove_chars(plugin, "-.") if name in accountList: @@ -181,42 +212,39 @@ class MultiHook(Hook): self.new_supported.append(plugin) if not self.supported and not self.new_supported: - self.logError(_("No %s loaded") % self.type) + self.logError(_("No %s loaded") % self.plugintype) return - module = self.core.pluginManager.getPlugin(self.__name__) - klass = getattr(module, self.__name__) - # inject plugin plugin - self.logDebug("Overwritten %ss: %s" % (self.type, ", ".join(sorted(self.supported)))) + self.logDebug("Overwritten %ss: %s" % (self.plugintype, ", ".join(sorted(self.supported)))) for plugin in self.supported: - hdict = self.core.pluginManager.plugins[self.type][plugin] - hdict['new_module'] = module - hdict['new_name'] = self.__name__ + hdict = self.core.pluginManager.plugins[self.plugintype][plugin] + hdict['new_module'] = self.pluginmodule + hdict['new_name'] = self.pluginname if excludedList: - self.logInfo(_("%ss not overwritten: %s") % (self.type.capitalize(), ", ".join(sorted(excludedList)))) + self.logInfo(_("%ss not overwritten: %s") % (self.plugintype.capitalize(), ", ".join(sorted(excludedList)))) if self.new_supported: plugins = sorted(self.new_supported) - self.logDebug("New %ss: %s" % (self.type, ", ".join(plugins))) + self.logDebug("New %ss: %s" % (self.plugintype, ", ".join(plugins))) # create new regexp regexp = r'.*(%s).*' % "|".join([x.replace(".", "\.") for x in plugins]) - if hasattr(klass, "__pattern__") and isinstance(klass.__pattern__, basestring) and '://' in klass.__pattern__: - regexp = r'%s|%s' % (klass.__pattern__, regexp) + if hasattr(self.pluginclass, "__pattern__") and isinstance(self.pluginclass.__pattern__, basestring) and '://' in self.pluginclass.__pattern__: + regexp = r'%s|%s' % (self.pluginclass.__pattern__, regexp) self.logDebug("Regexp: %s" % regexp) - hdict = self.core.pluginManager.plugins[self.type][self.__name__] + hdict = self.core.pluginManager.plugins[self.plugintype][self.pluginname] hdict['pattern'] = regexp hdict['re'] = re.compile(regexp) def unloadPlugin(self, plugin): - hdict = self.core.pluginManager.plugins[self.type][plugin] + hdict = self.core.pluginManager.plugins[self.plugintype][plugin] if "module" in hdict: del hdict['module'] @@ -231,18 +259,24 @@ class MultiHook(Hook): self.unloadPlugin(plugin) # reset pattern - klass = getattr(self.core.pluginManager.getPlugin(self.__name__), self.__name__) - hdict = self.core.pluginManager.plugins[self.type][self.__name__] + hdict = self.core.pluginManager.plugins[self.plugintype][self.pluginname] - hdict['pattern'] = getattr(klass, "__pattern__", r'^unmatchable$') + hdict['pattern'] = getattr(self.pluginclass, "__pattern__", r'^unmatchable$') hdict['re'] = re.compile(hdict['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("revertfailed", True): - hdict = self.core.pluginManager.plugins[self.type][pyfile.pluginname] - if "new_name" in hdict and hdict['new_name'] == self.__name__: + if pyfile.status != 8 or not self.getConfig("revertfailed", True): + return + + hdict = self.core.pluginManager.plugins[self.plugintype][pyfile.pluginname] + if "new_name" in hdict and hdict['new_name'] == self.pluginname: + if pyfile.error == "MultiHook": self.logDebug("Unload MultiHook", pyfile.pluginname, hdict) self.unloadPlugin(pyfile.pluginname) pyfile.setStatus("queued") + else: + retries = max(self.getConfig("retry", 10), 0) + wait_time = max(self.getConfig("retryinterval", 1), 0) + pyfile.plugin.retry(retries, wait_time, "MultiHook") -- cgit v1.2.3 From ea2d07843d369d8b8fd2aa02930bf549ce94a661 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Fri, 9 Jan 2015 03:25:42 +0100 Subject: Spare fixes --- module/plugins/internal/MultiHook.py | 36 ++++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-) (limited to 'module/plugins/internal/MultiHook.py') diff --git a/module/plugins/internal/MultiHook.py b/module/plugins/internal/MultiHook.py index 202868175..82a0a68ea 100644 --- a/module/plugins/internal/MultiHook.py +++ b/module/plugins/internal/MultiHook.py @@ -27,22 +27,26 @@ class MultiHook(Hook): MIN_INTERVAL = 1 * 60 * 60 - DOMAIN_REPLACEMENTS = [(r'\d+.+' , "_\0" ), - (r'bayfiles\.net' , "bayfiles.com" ), - (r'cloudnator\.com' , "shragle.com" ), - (r'dfiles\.eu' , "depositfiles.com"), - (r'easy-share\.com' , "crocko.com" ), - (r'freakshare\.net' , "freakshare.com" ), - (r'hellshare\.com' , "hellshare.cz" ), - (r'ifile\.it' , "filecloud.io" ), - (r'nowdownload\.\w+', "nowdownload.sx" ), - (r'nowvideo\.\w+' , "nowvideo.sx" ), - (r'putlocker\.com' , "firedrive.com" ), - (r'share-?rapid\.cz', "multishare.cz" ), - (r'ul\.to' , "uploaded.to" ), - (r'uploaded\.net' , "uploaded.to" ), - (r'uploadhero\.co' , "uploadhero.com" ), - (r'zshares\.net' , "zshare.net" )] + DOMAIN_REPLACEMENTS = [(r'180upload.com' , "hundredeightyupload.com"), + (r'1fichier.com' , "onefichier.com" ), + (r'2shared.com' , "twoshared.com" ), + (r'4shared.com' , "fourshared.com" ), + (r'bayfiles\.net' , "bayfiles.com" ), + (r'cloudnator\.com' , "shragle.com" ), + (r'dfiles\.eu' , "depositfiles.com" ), + (r'easy-share\.com' , "crocko.com" ), + (r'freakshare\.net' , "freakshare.com" ), + (r'hellshare\.com' , "hellshare.cz" ), + (r'ifile\.it' , "filecloud.io" ), + (r'nowdownload\.\w+', "nowdownload.sx" ), + (r'nowvideo\.\w+' , "nowvideo.sx" ), + (r'putlocker\.com' , "firedrive.com" ), + (r'share-?rapid\.cz', "multishare.cz" ), + (r'ul\.to' , "uploaded.to" ), + (r'uploaded\.net' , "uploaded.to" ), + (r'uploadhero\.co' , "uploadhero.com" ), + (r'zshares\.net' , "zshare.net" ), + (r'\d+.+' , "X\0" )] def setup(self): -- cgit v1.2.3 From 7950463dbd5cc062f89a1b69bbc1464a8e0ad1b7 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Fri, 9 Jan 2015 17:31:46 +0100 Subject: [MultiHook] Fix auto-deactivation --- module/plugins/internal/MultiHook.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins/internal/MultiHook.py') diff --git a/module/plugins/internal/MultiHook.py b/module/plugins/internal/MultiHook.py index 82a0a68ea..9acf3744f 100644 --- a/module/plugins/internal/MultiHook.py +++ b/module/plugins/internal/MultiHook.py @@ -9,7 +9,7 @@ from module.utils import remove_chars class MultiHook(Hook): __name__ = "MultiHook" __type__ = "hook" - __version__ = "0.30" + __version__ = "0.31" __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), ("pluginlist" , "str" , "Plugin list (comma separated)" , "" ), @@ -82,7 +82,7 @@ class MultiHook(Hook): if self.account and not self.account.canUse(): self.account = None - if not self.account and hasattr(self.pluginclass, "LOGIN_ACCOUNT") and not self.pluginclass.LOGIN_ACCOUNT: + if not self.account and hasattr(self.pluginclass, "LOGIN_ACCOUNT") and self.pluginclass.LOGIN_ACCOUNT: self.logWarning("Hook plugin will be deactivated due missing account reference") self.setConfig('activated', False) -- cgit v1.2.3 From 8f46ca7012fd9f17a99ae9baa3394be747f26a7e Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Fri, 9 Jan 2015 21:07:41 +0100 Subject: [MultiHook] Fix encoding in _pluginSet --- module/plugins/internal/MultiHook.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'module/plugins/internal/MultiHook.py') diff --git a/module/plugins/internal/MultiHook.py b/module/plugins/internal/MultiHook.py index 9acf3744f..bb132252f 100644 --- a/module/plugins/internal/MultiHook.py +++ b/module/plugins/internal/MultiHook.py @@ -3,13 +3,13 @@ import re from module.plugins.Hook import Hook -from module.utils import remove_chars +from module.utils import decode, remove_chars class MultiHook(Hook): __name__ = "MultiHook" __type__ = "hook" - __version__ = "0.31" + __version__ = "0.32" __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), ("pluginlist" , "str" , "Plugin list (comma separated)" , "" ), @@ -95,6 +95,8 @@ class MultiHook(Hook): """ see HTTPRequest for argument list """ h = pyreq.getHTTPRequest(timeout=120) try: + if not 'decode' in kwargs: + kwargs['decode'] = True rep = h.load(*args, **kwargs) finally: h.close() @@ -139,7 +141,7 @@ class MultiHook(Hook): def _pluginSet(self, plugins): - plugins = set((str(x).strip().lower() for x in plugins)) + plugins = set((decode(x).strip().lower() for x in plugins)) for rf, rt in self.DOMAIN_REPLACEMENTS: regex = re.compile(rf) -- cgit v1.2.3 From 502c1437e838282aa56a286bb3751382c3aaf65e Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sat, 10 Jan 2015 16:01:38 +0100 Subject: Improve getInfo --- module/plugins/internal/MultiHook.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'module/plugins/internal/MultiHook.py') diff --git a/module/plugins/internal/MultiHook.py b/module/plugins/internal/MultiHook.py index bb132252f..4408ebf0e 100644 --- a/module/plugins/internal/MultiHook.py +++ b/module/plugins/internal/MultiHook.py @@ -9,7 +9,7 @@ from module.utils import decode, remove_chars class MultiHook(Hook): __name__ = "MultiHook" __type__ = "hook" - __version__ = "0.32" + __version__ = "0.33" __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), ("pluginlist" , "str" , "Plugin list (comma separated)" , "" ), @@ -27,10 +27,10 @@ class MultiHook(Hook): MIN_INTERVAL = 1 * 60 * 60 - DOMAIN_REPLACEMENTS = [(r'180upload.com' , "hundredeightyupload.com"), - (r'1fichier.com' , "onefichier.com" ), - (r'2shared.com' , "twoshared.com" ), - (r'4shared.com' , "fourshared.com" ), + DOMAIN_REPLACEMENTS = [(r'180upload\.com' , "hundredeightyupload.com"), + (r'1fichier\.com' , "onefichier.com" ), + (r'2shared\.com' , "twoshared.com" ), + (r'4shared\.com' , "fourshared.com" ), (r'bayfiles\.net' , "bayfiles.com" ), (r'cloudnator\.com' , "shragle.com" ), (r'dfiles\.eu' , "depositfiles.com" ), -- cgit v1.2.3 From 398a0dd02df28b6bbdb8c7f950db3131e77d8183 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sat, 10 Jan 2015 19:50:54 +0100 Subject: [MultiHook] Fix downloadFailed routine --- module/plugins/internal/MultiHook.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'module/plugins/internal/MultiHook.py') diff --git a/module/plugins/internal/MultiHook.py b/module/plugins/internal/MultiHook.py index 4408ebf0e..ac53c0c9c 100644 --- a/module/plugins/internal/MultiHook.py +++ b/module/plugins/internal/MultiHook.py @@ -9,7 +9,7 @@ from module.utils import decode, remove_chars class MultiHook(Hook): __name__ = "MultiHook" __type__ = "hook" - __version__ = "0.33" + __version__ = "0.34" __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), ("pluginlist" , "str" , "Plugin list (comma separated)" , "" ), @@ -285,4 +285,9 @@ class MultiHook(Hook): else: retries = max(self.getConfig("retry", 10), 0) wait_time = max(self.getConfig("retryinterval", 1), 0) - pyfile.plugin.retry(retries, wait_time, "MultiHook") + + if 0 < retries > pyfile.plugin.retries: + pyfile.plugin.retries += 1 + pyfile.plugin.setCustomStatus("MultiHook", "queued") + pyfile.plugin.setWait(wait_time) + pyfile.plugin.wait() -- cgit v1.2.3 From aac6063859b9036612e86fb4029dc010d5c5d1e0 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sat, 10 Jan 2015 19:53:09 +0100 Subject: Code cosmetics --- module/plugins/internal/MultiHook.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/internal/MultiHook.py') diff --git a/module/plugins/internal/MultiHook.py b/module/plugins/internal/MultiHook.py index ac53c0c9c..8bf72f21b 100644 --- a/module/plugins/internal/MultiHook.py +++ b/module/plugins/internal/MultiHook.py @@ -285,7 +285,7 @@ class MultiHook(Hook): else: retries = max(self.getConfig("retry", 10), 0) wait_time = max(self.getConfig("retryinterval", 1), 0) - + if 0 < retries > pyfile.plugin.retries: pyfile.plugin.retries += 1 pyfile.plugin.setCustomStatus("MultiHook", "queued") -- cgit v1.2.3 From 4747e1d7958c9fb1180da6f3a21f3093220a6655 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sat, 10 Jan 2015 21:17:27 +0100 Subject: Code improvements --- module/plugins/internal/MultiHook.py | 49 ++++++++++++++++++++++-------------- 1 file changed, 30 insertions(+), 19 deletions(-) (limited to 'module/plugins/internal/MultiHook.py') diff --git a/module/plugins/internal/MultiHook.py b/module/plugins/internal/MultiHook.py index 8bf72f21b..a3b266679 100644 --- a/module/plugins/internal/MultiHook.py +++ b/module/plugins/internal/MultiHook.py @@ -2,6 +2,8 @@ import re +from time import sleep + from module.plugins.Hook import Hook from module.utils import decode, remove_chars @@ -9,7 +11,7 @@ from module.utils import decode, remove_chars class MultiHook(Hook): __name__ = "MultiHook" __type__ = "hook" - __version__ = "0.34" + __version__ = "0.35" __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), ("pluginlist" , "str" , "Plugin list (comma separated)" , "" ), @@ -114,34 +116,43 @@ class MultiHook(Hook): def pluginsCached(self): - if not self.plugins: + if self.plugins: + return self.plugins + + for _i in xrange(3): try: pluginset = self._pluginSet(self.getHosters() if self.plugintype == "hoster" else self.getCrypters()) + except Exception, e: - self.logError(e) - return [] + self.logError(e, "Waiting 1 minute and retry") + sleep(60) + + else: + break + else: + return list() - try: - configmode = self.getConfig("pluginmode", 'all') - if configmode in ("listed", "unlisted"): - pluginlist = self.getConfig("pluginlist", '').replace('|', ',').replace(';', ',').split(',') - configset = self._pluginSet(pluginlist) + try: + configmode = self.getConfig("pluginmode", 'all') + if configmode in ("listed", "unlisted"): + pluginlist = self.getConfig("pluginlist", '').replace('|', ',').replace(';', ',').split(',') + configset = self._pluginSet(pluginlist) - if configmode == "listed": - pluginset &= configset - else: - pluginset -= configset + if configmode == "listed": + pluginset &= configset + else: + pluginset -= configset - except Exception, e: - self.logError(e) + except Exception, e: + self.logError(e) - self.plugins = list(pluginset) + self.plugins = list(pluginset) return self.plugins def _pluginSet(self, plugins): - plugins = set((decode(x).strip().lower() for x in plugins)) + plugins = set((decode(x).strip().lower() for x in plugins if '.' in x)) for rf, rt in self.DOMAIN_REPLACEMENTS: regex = re.compile(rf) @@ -238,7 +249,7 @@ class MultiHook(Hook): self.logDebug("New %ss: %s" % (self.plugintype, ", ".join(plugins))) # create new regexp - regexp = r'.*(%s).*' % "|".join([x.replace(".", "\.") for x in plugins]) + regexp = r'.*(?P%s).*' % "|".join([x.replace(".", "\.") for x in plugins]) if hasattr(self.pluginclass, "__pattern__") and isinstance(self.pluginclass.__pattern__, basestring) and '://' in self.pluginclass.__pattern__: regexp = r'%s|%s' % (self.pluginclass.__pattern__, regexp) @@ -287,7 +298,7 @@ class MultiHook(Hook): wait_time = max(self.getConfig("retryinterval", 1), 0) if 0 < retries > pyfile.plugin.retries: + pyfile.setCustomStatus("MultiHook", "queued") pyfile.plugin.retries += 1 - pyfile.plugin.setCustomStatus("MultiHook", "queued") pyfile.plugin.setWait(wait_time) pyfile.plugin.wait() -- cgit v1.2.3