summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Walter Purcaro <vuolter@users.noreply.github.com> 2015-03-10 01:16:29 +0100
committerGravatar Walter Purcaro <vuolter@users.noreply.github.com> 2015-03-10 01:16:29 +0100
commitf85e28e565a1e0a76e6271d0b0853d6d48b4a043 (patch)
tree62d09fa71ebd1f25226f8cb02e531e9247096110
parent[ExtractArchive] Fix https://github.com/pyload/pyload/issues/1241 (diff)
downloadpyload-f85e28e565a1e0a76e6271d0b0853d6d48b4a043.tar.xz
[MultiHook] Fix _pluginSet (fix LinkdecrypterCom issue)
-rw-r--r--module/plugins/crypter/XFileSharingProFolder.py5
-rw-r--r--module/plugins/hooks/LinkdecrypterCom.py4
-rw-r--r--module/plugins/hoster/XFileSharingPro.py5
-rw-r--r--module/plugins/internal/MultiHook.py48
4 files changed, 30 insertions, 32 deletions
diff --git a/module/plugins/crypter/XFileSharingProFolder.py b/module/plugins/crypter/XFileSharingProFolder.py
index 1d001772d..7d5cc9c6d 100644
--- a/module/plugins/crypter/XFileSharingProFolder.py
+++ b/module/plugins/crypter/XFileSharingProFolder.py
@@ -8,7 +8,7 @@ from module.plugins.internal.XFSCrypter import XFSCrypter, create_getInfo
class XFileSharingProFolder(XFSCrypter):
__name__ = "XFileSharingProFolder"
__type__ = "crypter"
- __version__ = "0.04"
+ __version__ = "0.05"
__pattern__ = r'^unmatchable$'
__config__ = [("use_subfolder", "bool", "Save package to subfolder", True),
@@ -33,9 +33,6 @@ class XFileSharingProFolder(XFSCrypter):
self.HOSTER_DOMAIN = re.match(self.__pattern__, self.pyfile.url).group("DOMAIN").lower()
self.HOSTER_NAME = "".join(part.capitalize() for part in re.split(r'(\.|\d+)', self.HOSTER_DOMAIN) if part != '.')
- if self.HOSTER_NAME[0].isdigit():
- self.HOSTER_NAME = 'X' + self.HOSTER_NAME
-
account = self.core.accountManager.getAccountPlugin(self.HOSTER_NAME)
if account and account.canUse():
diff --git a/module/plugins/hooks/LinkdecrypterCom.py b/module/plugins/hooks/LinkdecrypterCom.py
index f85a598bc..769e63e81 100644
--- a/module/plugins/hooks/LinkdecrypterCom.py
+++ b/module/plugins/hooks/LinkdecrypterCom.py
@@ -8,7 +8,7 @@ from module.plugins.internal.MultiHook import MultiHook
class LinkdecrypterCom(MultiHook):
__name__ = "LinkdecrypterCom"
__type__ = "hook"
- __version__ = "1.02"
+ __version__ = "1.03"
__config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"),
("pluginlist" , "str" , "Plugin list (comma separated)" , "" ),
@@ -22,4 +22,4 @@ class LinkdecrypterCom(MultiHook):
def getCrypters(self):
return re.search(r'>Supported\(\d+\)</b>: <i>(.[\w.\-, ]+)',
- self.getURL("http://linkdecrypter.com/").replace("(g)", "")).group(1).split(', ')
+ self.getURL("http://linkdecrypter.com/", decode=True).replace("(g)", "")).group(1).split(', ')
diff --git a/module/plugins/hoster/XFileSharingPro.py b/module/plugins/hoster/XFileSharingPro.py
index c66f25ad4..1bfb504b7 100644
--- a/module/plugins/hoster/XFileSharingPro.py
+++ b/module/plugins/hoster/XFileSharingPro.py
@@ -8,7 +8,7 @@ from module.plugins.internal.XFSHoster import XFSHoster, create_getInfo
class XFileSharingPro(XFSHoster):
__name__ = "XFileSharingPro"
__type__ = "hoster"
- __version__ = "0.44"
+ __version__ = "0.45"
__pattern__ = r'^unmatchable$'
@@ -34,9 +34,6 @@ class XFileSharingPro(XFSHoster):
self.HOSTER_DOMAIN = re.match(self.__pattern__, self.pyfile.url).group("DOMAIN").lower()
self.HOSTER_NAME = "".join(part.capitalize() for part in re.split(r'(\.|\d+)', self.HOSTER_DOMAIN) if part != '.')
- if self.HOSTER_NAME[0].isdigit():
- self.HOSTER_NAME = 'X' + self.HOSTER_NAME
-
account = self.core.accountManager.getAccountPlugin(self.HOSTER_NAME)
if account and account.canUse():
diff --git a/module/plugins/internal/MultiHook.py b/module/plugins/internal/MultiHook.py
index 7e6462d9d..e69f56c32 100644
--- a/module/plugins/internal/MultiHook.py
+++ b/module/plugins/internal/MultiHook.py
@@ -11,7 +11,7 @@ from module.utils import decode, remove_chars
class MultiHook(Hook):
__name__ = "MultiHook"
__type__ = "hook"
- __version__ = "0.38"
+ __version__ = "0.39"
__config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"),
("pluginlist" , "str" , "Plugin list (comma separated)" , "" ),
@@ -23,16 +23,13 @@ class MultiHook(Hook):
__description__ = """Hook plugin for multi hoster/crypter"""
__license__ = "GPLv3"
- __authors__ = [("pyLoad Team", "admin@pyload.org"),
+ __authors__ = [("pyLoad Team" , "admin@pyload.org" ),
("Walter Purcaro", "vuolter@gmail.com")]
- MIN_INTERVAL = 1 * 60 * 60 #: 1 hour
+ MIN_RELOAD_INTERVAL = 1 * 60 * 60 #: 1 hour
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" ),
@@ -48,7 +45,16 @@ class MultiHook(Hook):
(r'uploaded\.net' , "uploaded.to" ),
(r'uploadhero\.co' , "uploadhero.com" ),
(r'zshares\.net' , "zshare.net" ),
- (r'(\d+.+)' , "X\1" )]
+ (r'^1' , "one" ),
+ (r'^2' , "two" ),
+ (r'^3' , "three" ),
+ (r'^4' , "four" ),
+ (r'^5' , "five" ),
+ (r'^6' , "six" ),
+ (r'^7' , "seven" ),
+ (r'^8' , "eight" ),
+ (r'^9' , "nine" ),
+ (r'^0' , "zero" )]
def setup(self):
@@ -129,7 +135,7 @@ class MultiHook(Hook):
sleep(60)
else:
self.logWarning(_("Fallback to default reload interval due plugin"))
- self.interval = self.MIN_INTERVAL
+ self.interval = self.MIN_RELOAD_INTERVAL
return list()
try:
@@ -152,17 +158,15 @@ class MultiHook(Hook):
def _pluginSet(self, plugins):
- plugins = set((decode(x).strip().lower() for x in plugins if '.' in x))
+ regexp = re.compile(r'^[\w\-.^_]{3,63}\.[a-zA-Z]{2,}$', re.U)
+ plugins = [decode(p.strip()).lower() for p in plugins if regexp.match(p.strip())]
- 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))
+ for r in self.DOMAIN_REPLACEMENTS:
+ rf, rt = r
+ repr = re.compile(rf, re.I|re.U)
+ plugins = [re.sub(rf, rt, p) if repr.match(p) else p for p in plugins]
- plugins.discard('')
-
- return plugins
+ return set(plugins)
def getHosters(self):
@@ -198,7 +202,7 @@ class MultiHook(Hook):
def periodical(self):
"""reload plugin list periodically"""
if self.getConfig("reload", True):
- self.interval = max(self.getConfig("reloadinterval", 12) * 60 * 60, self.MIN_INTERVAL)
+ self.interval = max(self.getConfig("reloadinterval", 12) * 60 * 60, self.MIN_RELOAD_INTERVAL)
else:
self.core.scheduler.removeJob(self.cb)
self.cb = None
@@ -263,7 +267,7 @@ class MultiHook(Hook):
self.logDebug("New %ss: %s" % (self.plugintype, ", ".join(plugins)))
# create new regexp
- regexp = r'.*(?P<DOMAIN>%s).*' % "|".join([x.replace(".", "\.") for x in plugins])
+ regexp = r'.*(?P<DOMAIN>%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)
@@ -277,11 +281,11 @@ class MultiHook(Hook):
def unloadPlugin(self, plugin):
hdict = self.core.pluginManager.plugins[self.plugintype][plugin]
if "module" in hdict:
- del hdict['module']
+ hdict.pop('module', None)
if "new_module" in hdict:
- del hdict['new_module']
- del hdict['new_name']
+ hdict.pop('new_module', None)
+ hdict.pop('new_name', None)
def unload(self):