From b71a408f118eb1117dad3c11da8bfd883e6bf28f Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Fri, 28 Nov 2014 23:56:31 +0100 Subject: [Captcha9kw] Option "Captcha per minute" (thx stefanos) --- module/plugins/hooks/Captcha9kw.py | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/Captcha9kw.py b/module/plugins/hooks/Captcha9kw.py index 77375fb8b..38b39b2af 100755 --- a/module/plugins/hooks/Captcha9kw.py +++ b/module/plugins/hooks/Captcha9kw.py @@ -17,19 +17,20 @@ from module.plugins.Hook import Hook class Captcha9kw(Hook): __name__ = "Captcha9kw" __type__ = "hook" - __version__ = "0.24" - - __config__ = [("activated", "bool", "Activated", True), - ("ssl", "bool", "Use HTTPS", True), - ("force", "bool", "Force captcha resolving even if client is connected", True), - ("confirm", "bool", "Confirm Captcha (cost +6 credits)", False), - ("captchaperhour", "int", "Captcha per hour", "9999"), - ("prio", "int", "Priority (max 10)(cost +0 -> +10 credits)", "0"), - ("queue", "int", "Max. Queue (max 999)", "50"), - ("hoster_options", "string", "Hoster options (format: pluginname:prio=1:selfsolfe=1:confirm=1:timeout=900|...)", "ShareonlineBiz:prio=0:timeout=999 | UploadedTo:prio=0:timeout=999"), - ("selfsolve", "bool", "Selfsolve (manually solve your captcha in your 9kw client if active)", "0"), - ("passkey", "password", "API key", ""), - ("timeout", "int", "Timeout in seconds (min 60, max 3999)", "900")] + __version__ = "0.25" + + __config__ = [("activated" , "bool" , "Activated" , True ), + ("ssl" , "bool" , "Use HTTPS" , True ), + ("force" , "bool" , "Force captcha resolving even if client is connected" , True ), + ("confirm" , "bool" , "Confirm Captcha (cost +6 credits)" , False ), + ("captchaperhour", "int" , "Captcha per hour" , "9999" ), + ("captchapermin" , "int" , "Captcha per minute" , "9999" ), + ("prio" , "int" , "Priority (max 10)(cost +0 -> +10 credits)" , "0" ), + ("queue" , "int" , "Max. Queue (max 999)" , "50" ), + ("hoster_options", "string" , "Hoster options (format: pluginname:prio=1:selfsolfe=1:confirm=1:timeout=900|...)", "ShareonlineBiz:prio=0:timeout=999 | UploadedTo:prio=0:timeout=999"), + ("selfsolve" , "bool" , "Selfsolve (manually solve your captcha in your 9kw client if active)" , "0" ), + ("passkey" , "password", "API key" , "" ), + ("timeout" , "int" , "Timeout in seconds (min 60, max 3999)" , "900" )] __description__ = """Send captchas to 9kw.eu""" __license__ = "GPLv3" @@ -85,7 +86,8 @@ class Captcha9kw(Hook): 'confirm' : self.getConfig("confirm"), 'timeout' : min(max(self.getConfig("timeout"), 300), 3999), 'selfsolve' : self.getConfig("selfsolve"), - 'cph' : self.getConfig("captchaperhour")} + 'cph' : self.getConfig("captchaperhour"), + 'cpm' : self.getConfig("captchapermin")} for opt in str(self.getConfig("hoster_options").split('|')): @@ -112,6 +114,7 @@ class Captcha9kw(Hook): 'maxtimeout' : option['timeout'], 'selfsolve' : option['selfsolve'], 'captchaperhour': option['cph'], + 'captchapermin' : option['cpm'], 'case-sensitive': option['case_sensitive'], 'min_len' : option['min'], 'max_len' : option['max'], -- cgit v1.2.3 From 7e44687839660802bf35bd14a82551bae424f7ba Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sun, 30 Nov 2014 19:31:10 +0100 Subject: [UpdateManager] Option autorestart --- module/plugins/hooks/UpdateManager.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/UpdateManager.py b/module/plugins/hooks/UpdateManager.py index 3fda0b5e8..9c26cf5d9 100644 --- a/module/plugins/hooks/UpdateManager.py +++ b/module/plugins/hooks/UpdateManager.py @@ -14,13 +14,14 @@ from module.utils import save_join class UpdateManager(Hook): __name__ = "UpdateManager" __type__ = "hook" - __version__ = "0.39" + __version__ = "0.40" - __config__ = [("activated", "bool", "Activated", True), - ("mode", "pyLoad + plugins;plugins only", "Check updates for", "pyLoad + plugins"), - ("interval", "int", "Check interval in hours", 8), - ("reloadplugins", "bool", "Monitor plugins for code changes (debug mode only)", True), - ("nodebugupdate", "bool", "Don't check for updates in debug mode", True)] + __config__ = [("activated" , "bool" , "Activated" , True ), + ("mode" , "pyLoad + plugins;plugins only", "Check updates for" , "pyLoad + plugins"), + ("interval" , "int" , "Check interval in hours" , 8 ), + ("autorestart" , "bool" , "Automatically restart pyLoad when required" , True ), + ("reloadplugins", "bool" , "Monitor plugins for code changes in debug mode", True ), + ("nodebugupdate", "bool" , "Don't check for updates in debug mode" , True )] __description__ = """ Check for updates """ __license__ = "GPLv3" @@ -123,7 +124,7 @@ class UpdateManager(Hook): status = self.update(onlyplugin=self.getConfig("mode") == "plugins only") - if status == 2: + if status is 2 and self.getConfig("autorestart"): self.core.api.restart() else: self.updating = False -- cgit v1.2.3 From 86d3b6249073947132ed3a9eeb1b1e987d19569a Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Mon, 1 Dec 2014 18:17:13 +0100 Subject: Update some plugins --- module/plugins/hooks/Captcha9kw.py | 2 +- module/plugins/hooks/Checksum.py | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/Captcha9kw.py b/module/plugins/hooks/Captcha9kw.py index 38b39b2af..ead8aec9a 100755 --- a/module/plugins/hooks/Captcha9kw.py +++ b/module/plugins/hooks/Captcha9kw.py @@ -56,7 +56,7 @@ class Captcha9kw(Hook): if res.isdigit(): self.logInfo(_("%s credits left") % res) - credits = self.info["credits"] = int(res) + credits = self.info['credits'] = int(res) return credits else: self.logError(res) diff --git a/module/plugins/hooks/Checksum.py b/module/plugins/hooks/Checksum.py index b746fce5f..eeda2d849 100644 --- a/module/plugins/hooks/Checksum.py +++ b/module/plugins/hooks/Checksum.py @@ -81,10 +81,15 @@ class Checksum(Hook): a) if known, the exact filesize in bytes (e.g. "size": 123456789) b) hexadecimal hash string with algorithm name as key (e.g. "md5": "d76505d0869f9f928a17d42d66326307") """ - if hasattr(pyfile.plugin, "check_data") and (isinstance(pyfile.plugin.check_data, dict)): + if hasattr(pyfile.plugin, "check_data") and isinstance(pyfile.plugin.check_data, dict): data = pyfile.plugin.check_data.copy() - elif hasattr(pyfile.plugin, "api_data") and (isinstance(pyfile.plugin.api_data, dict)): + + elif hasattr(pyfile.plugin, "api_data") and isinstance(pyfile.plugin.api_data, dict): data = pyfile.plugin.api_data.copy() + + # elif hasattr(pyfile.plugin, "info") and isinstance(pyfile.plugin.info, dict): + # data = pyfile.plugin.info.copy() + else: return -- cgit v1.2.3 From 2d77bbe784e5f107a3823f5b780e879478d1b37a Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 2 Dec 2014 12:36:47 +0100 Subject: New addon RestartSlow --- module/plugins/hooks/RestartSlow.py | 39 +++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 module/plugins/hooks/RestartSlow.py (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/RestartSlow.py b/module/plugins/hooks/RestartSlow.py new file mode 100644 index 000000000..0e9e213de --- /dev/null +++ b/module/plugins/hooks/RestartSlow.py @@ -0,0 +1,39 @@ +# -*- coding: utf-8 -*- + +from pycurl import LOW_SPEED_LIMIT, LOW_SPEED_TIME + +from module.plugins.Hook import Hook + + +class RestartSlow(Hook): + __name__ = "RestartSlow" + __type__ = "hook" + __version__ = "0.01" + + __config__ = [("free_limit" , "int", "Transfer speed threshold in kilobytes" , 100 ), + ("free_time" , "int", "Sample interval in minutes" , 5 ), + ("premium_limit", "int", "Transfer speed threshold for premium download in kilobytes", 300 ), + ("premium_time" , "int", "Sample interval for premium download in minutes" , 2 ), + ("safe" , "bool", "Restart if download is resumable" , True)] + + __description__ = """Restart slow downloads""" + __license__ = "GPLv3" + __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] + + + event_list = ["downloadStarts"] + + + def downloadStarts(self, pyfile, url, filename): + if self.getConfig("safe") and not pyfile.plugin.resumeDownload: + return + + type = "premium" if pyfile.plugin.premium else "free" + + pyfile.plugin.req.http.c.setopt(LOW_SPEED_TIME, max(30, self.getConfig("%s_time" % type) * 60)) + pyfile.plugin.req.http.c.setopt(LOW_SPEED_LIMIT, max(5, self.getConfig("%s_limit" % type) * 1024)) + + + def downloadFailed(self, pyfile): + pyfile.plugin.req.http.c.setopt(LOW_SPEED_TIME, 30) + pyfile.plugin.req.http.c.setopt(LOW_SPEED_LIMIT, 5) -- cgit v1.2.3 From 9ad979dc5b3753e2982855495b240b3da37c3be4 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 2 Dec 2014 12:37:56 +0100 Subject: [SkipRev] Updated --- module/plugins/hooks/SkipRev.py | 56 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 module/plugins/hooks/SkipRev.py (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/SkipRev.py b/module/plugins/hooks/SkipRev.py new file mode 100644 index 000000000..3b3b450fe --- /dev/null +++ b/module/plugins/hooks/SkipRev.py @@ -0,0 +1,56 @@ +# -*- coding: utf-8 -*- + +import re + +from module.plugins.Hook import Hook +from module.plugins.Plugin import SkipDownload + + +class SkipRev(Hook): + __name__ = "SkipRev" + __type__ = "hook" + __version__ = "0.08" + + __config__ = [("auto", "bool", "Automatically keep all rev files needed by package", True) + ("tokeep", "int" , "Min number of rev files to keep for package" , 1), + ("unskip", "bool", "Restart a skipped rev when download fails" , True)] + + __description__ = """Skip files ending with extension rev""" + __license__ = "GPLv3" + __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] + + + event_map = [("downloadStarts", skipRev)] + + REV = re.compile(r'\.part(\d+)\.rev$') + + + def skipRev(self, pyfile, url, filename): + if REV.search(pyfile.name) is None or pyfile.getStatusName is "unskipped": + return + + tokeep = self.getConfig("tokeep") + + if tokeep > 0: + saved = [True if link.hasStatus("finished") or link.hasStatus("downloading") and REV.search(link.name) \ + for link in pyfile.package().getChildren()].count(True) + + if saved < tokeep: + return + + raise SkipDownload("SkipRev") + + + def downloadFailed(self, pyfile): + if self.getConfig("auto") is False: + + if self.getConfig("unskip") is False: + return + + if REV.search(pyfile.name) is None: + return + + for link in pyfile.package().getChildren(): + if link.hasStatus("skipped") and REV.search(link.name): + link.setCustomStatus("unskipped", "queued") + break -- cgit v1.2.3 From a611ddfd1d8e4a85b2066cc45bc51682ac10a5f7 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 2 Dec 2014 16:35:12 +0100 Subject: [SkipRev] Fixup 1 --- module/plugins/hooks/SkipRev.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/SkipRev.py b/module/plugins/hooks/SkipRev.py index 3b3b450fe..e9cfa2ec5 100644 --- a/module/plugins/hooks/SkipRev.py +++ b/module/plugins/hooks/SkipRev.py @@ -9,10 +9,10 @@ from module.plugins.Plugin import SkipDownload class SkipRev(Hook): __name__ = "SkipRev" __type__ = "hook" - __version__ = "0.08" + __version__ = "0.09" - __config__ = [("auto", "bool", "Automatically keep all rev files needed by package", True) - ("tokeep", "int" , "Min number of rev files to keep for package" , 1), + __config__ = [("auto", "bool", "Automatically keep all rev files needed by package", True), + ("tokeep", "int" , "Min number of rev files to keep for package" , 1), ("unskip", "bool", "Restart a skipped rev when download fails" , True)] __description__ = """Skip files ending with extension rev""" @@ -53,4 +53,4 @@ class SkipRev(Hook): for link in pyfile.package().getChildren(): if link.hasStatus("skipped") and REV.search(link.name): link.setCustomStatus("unskipped", "queued") - break + return -- cgit v1.2.3 From a5a6cc0643c562a0d3e55a8577b4fc391009ff2b Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 2 Dec 2014 17:00:36 +0100 Subject: [SkipRev] Typo --- module/plugins/hooks/SkipRev.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/SkipRev.py b/module/plugins/hooks/SkipRev.py index e9cfa2ec5..a64f1a83b 100644 --- a/module/plugins/hooks/SkipRev.py +++ b/module/plugins/hooks/SkipRev.py @@ -9,7 +9,7 @@ from module.plugins.Plugin import SkipDownload class SkipRev(Hook): __name__ = "SkipRev" __type__ = "hook" - __version__ = "0.09" + __version__ = "0.10" __config__ = [("auto", "bool", "Automatically keep all rev files needed by package", True), ("tokeep", "int" , "Min number of rev files to keep for package" , 1), @@ -26,7 +26,7 @@ class SkipRev(Hook): def skipRev(self, pyfile, url, filename): - if REV.search(pyfile.name) is None or pyfile.getStatusName is "unskipped": + if REV.search(pyfile.name) is None or pyfile.getStatusName() is "unskipped": return tokeep = self.getConfig("tokeep") -- cgit v1.2.3 From c2a07e6237f46a55212cb2a9da3b07d8ee04812e Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 2 Dec 2014 23:29:49 +0100 Subject: [UpdateManager] Fix https://github.com/pyload/pyload/issues/940 --- module/plugins/hooks/UpdateManager.py | 67 ++++++++++++++++++----------------- 1 file changed, 35 insertions(+), 32 deletions(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/UpdateManager.py b/module/plugins/hooks/UpdateManager.py index 9c26cf5d9..c69052ece 100644 --- a/module/plugins/hooks/UpdateManager.py +++ b/module/plugins/hooks/UpdateManager.py @@ -14,7 +14,7 @@ from module.utils import save_join class UpdateManager(Hook): __name__ = "UpdateManager" __type__ = "hook" - __version__ = "0.40" + __version__ = "0.41" __config__ = [("activated" , "bool" , "Activated" , True ), ("mode" , "pyLoad + plugins;plugins only", "Check updates for" , "pyLoad + plugins"), @@ -30,8 +30,9 @@ class UpdateManager(Hook): # event_list = ["pluginConfigChanged"] - SERVER_URL = "http://updatemanager.pyload.org" - MIN_INTERVAL = 6 * 60 * 60 #: 6h minimum check interval (value is in seconds) + SERVER_URL = "http://updatemanager.pyload.org" + VERSION = re.compile(r'__version__.*=.*("|\')([\d.]+)') + MIN_INTERVAL = 3 * 60 * 60 #: 3h minimum check interval (value is in seconds) def pluginConfigChanged(self, plugin, name, value): @@ -172,21 +173,39 @@ class UpdateManager(Hook): exitcode = 0 updated = [] - vre = re.compile(r'__version__.*=.*("|\')([\d.]+)') - url = updates[0] + url = updates[0] schema = updates[1].split('|') if "BLACKLIST" in updates: + updates = updates[2:updates.index('BLACKLIST')] blacklist = updates[updates.index('BLACKLIST') + 1:] - updates = updates[2:updates.index('BLACKLIST')] else: + updates = updates[2:] blacklist = None - updates = updates[2:] - upgradable = sorted(map(lambda x: dict(zip(schema, x.split('|'))), updates), - key=itemgetter("type", "name")) + upgradable = [dict(zip(schema, x.split('|'))) for x in updates] + blacklisted = [(x.split('|')[0], x.split('|')[1].rsplit('.', 1)[0]) for x in blacklist] if blacklist else [] - for plugin in upgradable: + if blacklist: + # Protect UpdateManager from self-removing + try: + blacklisted.remove(("hook", "UpdateManager")) + except: + pass + + for t, n in blacklisted: + for idx, plugin in enumerate(upgradable): + if n == plugin['name'] and t == plugin['type']: + upgradable.pop(idx) + break + + for t, n in self.removePlugins(sorted(blacklisted)): + self.logInfo(_("Removed blacklisted plugin [%(type)s] %(name)s") % { + 'type': t, + 'name': n, + }) + + for plugin in sorted(upgradable, key=itemgetter("type", "name")): filename = plugin['name'] prefix = plugin['type'] version = plugin['version'] @@ -208,9 +227,9 @@ class UpdateManager(Hook): newver = float(version) if not oldver: - msg = "New plugin: [%(type)s] %(name)s (v%(newver).2f)" + msg = "New plugin [%(type)s] %(name)s (v%(newver).2f)" elif newver > oldver: - msg = "New version of plugin: [%(type)s] %(name)s (v%(oldver).2f -> v%(newver).2f)" + msg = "New version of plugin [%(type)s] %(name)s (v%(oldver).2f -> v%(newver).2f)" else: continue @@ -220,12 +239,12 @@ class UpdateManager(Hook): 'newver': newver}) try: content = getURL(url % plugin) - m = vre.search(content) + m = VERSION.search(content) if m and m.group(2) == version: - f = open(save_join("userplugins", prefix, filename), "wb") - f.write(content) - f.close() + with open(save_join("userplugins", prefix, filename), "wb") as f: + f.write(content) + updated.append((prefix, name)) else: raise Exception, _("Version mismatch") @@ -233,22 +252,6 @@ class UpdateManager(Hook): except Exception, e: self.logError(_("Error updating plugin %s") % filename, str(e)) - if blacklist: - blacklisted = sorted(map(lambda x: (x.split('|')[0], x.split('|')[1].rsplit('.', 1)[0]), blacklist)) - - # Always protect UpdateManager from self-removing - try: - blacklisted.remove(("hook", "UpdateManager")) - except: - pass - - removed = self.removePlugins(blacklisted) - for t, n in removed: - self.logInfo(_("Removed blacklisted plugin [%(type)s] %(name)s") % { - 'type': t, - 'name': n, - }) - if updated: reloaded = self.core.pluginManager.reloadPlugins(updated) if reloaded: -- cgit v1.2.3 From 588e9dd13c18bcacdc4de8bb9106f1aa279d1e27 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Wed, 3 Dec 2014 00:27:34 +0100 Subject: [UpdateManager] Fix https://github.com/pyload/pyload/issues/940 (2) --- module/plugins/hooks/UpdateManager.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/UpdateManager.py b/module/plugins/hooks/UpdateManager.py index c69052ece..a47742ab5 100644 --- a/module/plugins/hooks/UpdateManager.py +++ b/module/plugins/hooks/UpdateManager.py @@ -177,11 +177,11 @@ class UpdateManager(Hook): schema = updates[1].split('|') if "BLACKLIST" in updates: - updates = updates[2:updates.index('BLACKLIST')] blacklist = updates[updates.index('BLACKLIST') + 1:] + updates = updates[2:updates.index('BLACKLIST')] else: - updates = updates[2:] blacklist = None + updates = updates[2:] upgradable = [dict(zip(schema, x.split('|'))) for x in updates] blacklisted = [(x.split('|')[0], x.split('|')[1].rsplit('.', 1)[0]) for x in blacklist] if blacklist else [] @@ -227,9 +227,9 @@ class UpdateManager(Hook): newver = float(version) if not oldver: - msg = "New plugin [%(type)s] %(name)s (v%(newver).2f)" + msg = "New plugin: [%(type)s] %(name)s (v%(newver).2f)" elif newver > oldver: - msg = "New version of plugin [%(type)s] %(name)s (v%(oldver).2f -> v%(newver).2f)" + msg = "New version of plugin: [%(type)s] %(name)s (v%(oldver).2f -> v%(newver).2f)" else: continue @@ -239,7 +239,7 @@ class UpdateManager(Hook): 'newver': newver}) try: content = getURL(url % plugin) - m = VERSION.search(content) + m = self.VERSION.search(content) if m and m.group(2) == version: with open(save_join("userplugins", prefix, filename), "wb") as f: @@ -250,7 +250,7 @@ class UpdateManager(Hook): raise Exception, _("Version mismatch") except Exception, e: - self.logError(_("Error updating plugin %s") % filename, str(e)) + self.logError(_("Error updating plugin: %s") % filename, str(e)) if updated: reloaded = self.core.pluginManager.reloadPlugins(updated) -- cgit v1.2.3 From 69add4e0f3df7f078eafa022e9a59ac21cfaa19b Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Wed, 3 Dec 2014 00:28:06 +0100 Subject: [SkipRev] Syntax fixes --- module/plugins/hooks/SkipRev.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/SkipRev.py b/module/plugins/hooks/SkipRev.py index a64f1a83b..feed16a2b 100644 --- a/module/plugins/hooks/SkipRev.py +++ b/module/plugins/hooks/SkipRev.py @@ -9,7 +9,7 @@ from module.plugins.Plugin import SkipDownload class SkipRev(Hook): __name__ = "SkipRev" __type__ = "hook" - __version__ = "0.10" + __version__ = "0.11" __config__ = [("auto", "bool", "Automatically keep all rev files needed by package", True), ("tokeep", "int" , "Min number of rev files to keep for package" , 1), @@ -20,20 +20,20 @@ class SkipRev(Hook): __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - event_map = [("downloadStarts", skipRev)] + event_list = ["downloadStarts"] REV = re.compile(r'\.part(\d+)\.rev$') - def skipRev(self, pyfile, url, filename): - if REV.search(pyfile.name) is None or pyfile.getStatusName() is "unskipped": + def downloadStarts(self, pyfile, url, filename): + if self.REV.search(pyfile.name) is None or pyfile.getStatusName() is "unskipped": return tokeep = self.getConfig("tokeep") if tokeep > 0: - saved = [True if link.hasStatus("finished") or link.hasStatus("downloading") and REV.search(link.name) \ - for link in pyfile.package().getChildren()].count(True) + saved = [True for link in pyfile.package().getChildren() \ + if link.hasStatus("finished") or link.hasStatus("downloading") and self.REV.search(link.name)].count(True) if saved < tokeep: return @@ -47,10 +47,10 @@ class SkipRev(Hook): if self.getConfig("unskip") is False: return - if REV.search(pyfile.name) is None: + if self.REV.search(pyfile.name) is None: return for link in pyfile.package().getChildren(): - if link.hasStatus("skipped") and REV.search(link.name): + if link.hasStatus("skipped") and self.REV.search(link.name): link.setCustomStatus("unskipped", "queued") return -- cgit v1.2.3 From 01f8144b0e257897e94aa253a033849bdd273e34 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Fri, 5 Dec 2014 18:49:40 +0100 Subject: [UpdateManager] Fix with statement on old env like python 2.5 --- module/plugins/hooks/UpdateManager.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/UpdateManager.py b/module/plugins/hooks/UpdateManager.py index a47742ab5..c72699228 100644 --- a/module/plugins/hooks/UpdateManager.py +++ b/module/plugins/hooks/UpdateManager.py @@ -1,5 +1,7 @@ # -*- coding: utf-8 -*- +from __future__ import with_statement + import re import sys @@ -14,7 +16,7 @@ from module.utils import save_join class UpdateManager(Hook): __name__ = "UpdateManager" __type__ = "hook" - __version__ = "0.41" + __version__ = "0.42" __config__ = [("activated" , "bool" , "Activated" , True ), ("mode" , "pyLoad + plugins;plugins only", "Check updates for" , "pyLoad + plugins"), -- cgit v1.2.3 From 52664e6fe8dd99fc9bb78ea8cf158c17705b6ded Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Fri, 5 Dec 2014 19:18:11 +0100 Subject: Fix with statement on old env like python 2.5 (2) --- module/plugins/hooks/ExtractArchive.py | 4 +++- module/plugins/hooks/HotFolder.py | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/ExtractArchive.py b/module/plugins/hooks/ExtractArchive.py index 11c44a6d1..07db13aa1 100644 --- a/module/plugins/hooks/ExtractArchive.py +++ b/module/plugins/hooks/ExtractArchive.py @@ -1,5 +1,7 @@ # -*- coding: utf-8 -*- +from __future__ import with_statement + import os import sys @@ -57,7 +59,7 @@ from module.utils import save_join, fs_encode class ExtractArchive(Hook): __name__ = "ExtractArchive" __type__ = "hook" - __version__ = "0.17" + __version__ = "0.18" __config__ = [("activated", "bool", "Activated", True), ("fullpath", "bool", "Extract full path", True), diff --git a/module/plugins/hooks/HotFolder.py b/module/plugins/hooks/HotFolder.py index 518bbac2b..b0b59e2ba 100644 --- a/module/plugins/hooks/HotFolder.py +++ b/module/plugins/hooks/HotFolder.py @@ -1,5 +1,7 @@ # -*- coding: utf-8 -*- +from __future__ import with_statement + import time from os import listdir, makedirs @@ -13,7 +15,7 @@ from module.utils import fs_encode, save_join class HotFolder(Hook): __name__ = "HotFolder" __type__ = "hook" - __version__ = "0.11" + __version__ = "0.12" __config__ = [("folder", "str", "Folder to observe", "container"), ("watch_file", "bool", "Observe link file", False), -- cgit v1.2.3 From 2c38c50e936b203183013b7be9907375801b5d3f Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sat, 6 Dec 2014 01:38:05 +0100 Subject: [DebridItaliaCom] Updated --- module/plugins/hooks/DebridItaliaCom.py | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/DebridItaliaCom.py b/module/plugins/hooks/DebridItaliaCom.py index 86d37b3bd..b7f0ef1c7 100644 --- a/module/plugins/hooks/DebridItaliaCom.py +++ b/module/plugins/hooks/DebridItaliaCom.py @@ -1,12 +1,15 @@ # -*- coding: utf-8 -*- +import re + +from module.network.RequestFactory import getURL from module.plugins.internal.MultiHoster import MultiHoster class DebridItaliaCom(MultiHoster): __name__ = "DebridItaliaCom" __type__ = "hook" - __version__ = "0.07" + __version__ = "0.08" __config__ = [("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported)", "all"), ("hosterList", "str", "Hoster list (comma separated)", ""), @@ -15,14 +18,10 @@ class DebridItaliaCom(MultiHoster): __description__ = """Debriditalia.com hook plugin""" __license__ = "GPLv3" - __authors__ = [("stickell", "l.stickell@yahoo.it")] + __authors__ = [("stickell", "l.stickell@yahoo.it"), + ("Walter Purcaro", "vuolter@gmail.com")] def getHoster(self): - return ["netload.in", "hotfile.com", "rapidshare.com", "multiupload.com", - "uploading.com", "megashares.com", "crocko.com", "filepost.com", - "bitshare.com", "share-links.biz", "putlocker.com", "uploaded.to", - "speedload.org", "rapidgator.net", "likeupload.net", "cyberlocker.ch", - "depositfiles.com", "extabit.com", "filefactory.com", "sharefiles.co", - "ryushare.com", "tusfiles.net", "nowvideo.co", "cloudzer.net", "letitbit.net", - "easybytez.com", "uptobox.com", "ddlstorage.com"] + html = getURL("http://www.debriditalia.com/status.php") + return re.findall(r'title="(.+?)"> \1 Date: Sat, 6 Dec 2014 17:09:51 +0100 Subject: [RestartSlow] Temp removed --- module/plugins/hooks/RestartSlow.py | 39 ------------------------------------- 1 file changed, 39 deletions(-) delete mode 100644 module/plugins/hooks/RestartSlow.py (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/RestartSlow.py b/module/plugins/hooks/RestartSlow.py deleted file mode 100644 index 0e9e213de..000000000 --- a/module/plugins/hooks/RestartSlow.py +++ /dev/null @@ -1,39 +0,0 @@ -# -*- coding: utf-8 -*- - -from pycurl import LOW_SPEED_LIMIT, LOW_SPEED_TIME - -from module.plugins.Hook import Hook - - -class RestartSlow(Hook): - __name__ = "RestartSlow" - __type__ = "hook" - __version__ = "0.01" - - __config__ = [("free_limit" , "int", "Transfer speed threshold in kilobytes" , 100 ), - ("free_time" , "int", "Sample interval in minutes" , 5 ), - ("premium_limit", "int", "Transfer speed threshold for premium download in kilobytes", 300 ), - ("premium_time" , "int", "Sample interval for premium download in minutes" , 2 ), - ("safe" , "bool", "Restart if download is resumable" , True)] - - __description__ = """Restart slow downloads""" - __license__ = "GPLv3" - __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - - - event_list = ["downloadStarts"] - - - def downloadStarts(self, pyfile, url, filename): - if self.getConfig("safe") and not pyfile.plugin.resumeDownload: - return - - type = "premium" if pyfile.plugin.premium else "free" - - pyfile.plugin.req.http.c.setopt(LOW_SPEED_TIME, max(30, self.getConfig("%s_time" % type) * 60)) - pyfile.plugin.req.http.c.setopt(LOW_SPEED_LIMIT, max(5, self.getConfig("%s_limit" % type) * 1024)) - - - def downloadFailed(self, pyfile): - pyfile.plugin.req.http.c.setopt(LOW_SPEED_TIME, 30) - pyfile.plugin.req.http.c.setopt(LOW_SPEED_LIMIT, 5) -- cgit v1.2.3 From 7c4c7d4d124b790843ccf6e8150866016e9847a9 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sat, 6 Dec 2014 18:11:58 +0100 Subject: [SkipRev] Update --- module/plugins/hooks/SkipRev.py | 42 ++++++++++++++++++++++++++++++++--------- 1 file changed, 33 insertions(+), 9 deletions(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/SkipRev.py b/module/plugins/hooks/SkipRev.py index feed16a2b..a44d20a3e 100644 --- a/module/plugins/hooks/SkipRev.py +++ b/module/plugins/hooks/SkipRev.py @@ -2,6 +2,9 @@ import re +from urllib import unquote +from urlparse import urljoin, urlparse + from module.plugins.Hook import Hook from module.plugins.Plugin import SkipDownload @@ -9,7 +12,7 @@ from module.plugins.Plugin import SkipDownload class SkipRev(Hook): __name__ = "SkipRev" __type__ = "hook" - __version__ = "0.11" + __version__ = "0.12" __config__ = [("auto", "bool", "Automatically keep all rev files needed by package", True), ("tokeep", "int" , "Min number of rev files to keep for package" , 1), @@ -20,25 +23,46 @@ class SkipRev(Hook): __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - event_list = ["downloadStarts"] + def _setup(self): + super(self.pyfile.plugin, self).setup() + if self.pyfile.hasStatus("skipped"): + raise SkipDownload(self.pyfile.getStatusName()) + + + def pyname(self, pyfile): + plugin = pyfile.plugin + + if hasattr(plugin, "info") and 'name' in plugin.info and plugin.info['name']: + name = plugin.info['name'] + + elif hasattr(plugin, "parseInfo"): + name = next(plugin.parseInfo([pyfile.url]))['name'] + + elif hasattr(plugin, "getInfo"): #@NOTE: if parseInfo was not found, getInfo should be missing too + name = plugin.getInfo(pyfile.url)['name'] + + else: + self.logWarning("Unable to grab file name") + name = urlparse(unquote(pyfile.url)).path.split('/')[-1]) - REV = re.compile(r'\.part(\d+)\.rev$') + return name - def downloadStarts(self, pyfile, url, filename): - if self.REV.search(pyfile.name) is None or pyfile.getStatusName() is "unskipped": + def downloadPreparing(self, pyfile): + if pyfile.getStatusName() is "unskipped" or not pyname(pyfile).endswith(".rev"): return tokeep = self.getConfig("tokeep") if tokeep > 0: saved = [True for link in pyfile.package().getChildren() \ - if link.hasStatus("finished") or link.hasStatus("downloading") and self.REV.search(link.name)].count(True) + if link.name.endswith(".rev") and (link.hasStatus("finished") or link.hasStatus("downloading"))].count(True) if saved < tokeep: return - raise SkipDownload("SkipRev") + pyfile.setCustomStatus("SkipRev", "skipped") + pyfile.plugin.setup = _setup #: work-around: inject status checker inside the preprocessing routine of the plugin def downloadFailed(self, pyfile): @@ -47,10 +71,10 @@ class SkipRev(Hook): if self.getConfig("unskip") is False: return - if self.REV.search(pyfile.name) is None: + if not pyfile.name.endswith(".rev"): return for link in pyfile.package().getChildren(): - if link.hasStatus("skipped") and self.REV.search(link.name): + if link.hasStatus("skipped") and link.name.endswith(".rev"): link.setCustomStatus("unskipped", "queued") return -- cgit v1.2.3 From 67587fbe0335cacfde28a86ba729b9d567ce1da7 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sun, 7 Dec 2014 00:27:18 +0100 Subject: Plugin code cosmetics (3) --- module/plugins/hooks/AlldebridCom.py | 2 +- module/plugins/hooks/EasybytezCom.py | 17 ++++++++++------- module/plugins/hooks/FastixRu.py | 5 +++-- module/plugins/hooks/FreeWayMe.py | 2 +- module/plugins/hooks/LinksnappyCom.py | 2 +- module/plugins/hooks/MegaDebridEu.py | 2 +- module/plugins/hooks/MyfastfileCom.py | 2 +- module/plugins/hooks/OverLoadMe.py | 3 +-- module/plugins/hooks/PremiumizeMe.py | 4 ++-- module/plugins/hooks/RPNetBiz.py | 2 +- module/plugins/hooks/RehostTo.py | 3 ++- module/plugins/hooks/SimplyPremiumCom.py | 2 +- module/plugins/hooks/SimplydebridCom.py | 2 +- module/plugins/hooks/UnrestrictLi.py | 2 +- module/plugins/hooks/ZeveraCom.py | 2 +- 15 files changed, 28 insertions(+), 24 deletions(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/AlldebridCom.py b/module/plugins/hooks/AlldebridCom.py index c06607a28..2d3c8aad7 100644 --- a/module/plugins/hooks/AlldebridCom.py +++ b/module/plugins/hooks/AlldebridCom.py @@ -22,6 +22,6 @@ class AlldebridCom(MultiHoster): def getHoster(self): https = "https" if self.getConfig("https") else "http" - page = getURL(https + "://www.alldebrid.com/api.php?action=get_host").replace("\"", "").strip() + page = getURL(https + "://www.alldebrid.com/api.php", get={'action': "get_host"}).replace("\"", "").strip() return [x.strip() for x in page.split(",") if x.strip()] diff --git a/module/plugins/hooks/EasybytezCom.py b/module/plugins/hooks/EasybytezCom.py index 89deaed2b..3faa4fa1a 100644 --- a/module/plugins/hooks/EasybytezCom.py +++ b/module/plugins/hooks/EasybytezCom.py @@ -23,14 +23,17 @@ class EasybytezCom(MultiHoster): user = self.account.selectAccount()[0] try: - req = self.account.getAccountRequest(user) + req = self.account.getAccountRequest(user) page = req.load("http://www.easybytez.com") - m = re.search(r'\s*Supported sites:(.*)', page) - return m.group(1).split(',') + hosters = re.search(r'\s*Supported sites:(.*)', page).group(1).split(',') + except Exception, e: - self.logDebug(e) self.logWarning(_("Unable to load supported hoster list, using last known")) - return ["bitshare.com", "crocko.com", "ddlstorage.com", "depositfiles.com", "extabit.com", "hotfile.com", - "mediafire.com", "netload.in", "rapidgator.net", "rapidshare.com", "uploading.com", "uload.to", - "uploaded.to"] + self.logDebug(e) + + hosters = ["bitshare.com", "crocko.com", "ddlstorage.com", "depositfiles.com", "extabit.com", "hotfile.com", + "mediafire.com", "netload.in", "rapidgator.net", "rapidshare.com", "uploading.com", "uload.to", + "uploaded.to"] + finally: + return hosters diff --git a/module/plugins/hooks/FastixRu.py b/module/plugins/hooks/FastixRu.py index fe89a190c..cec6c6f1f 100644 --- a/module/plugins/hooks/FastixRu.py +++ b/module/plugins/hooks/FastixRu.py @@ -20,8 +20,9 @@ class FastixRu(MultiHoster): def getHoster(self): - page = getURL( - "http://fastix.ru/api_v2/?apikey=5182964c3f8f9a7f0b00000a_kelmFB4n1IrnCDYuIFn2y&sub=allowed_sources") + page = getURL("http://fastix.ru/api_v2", + get={'apikey': "5182964c3f8f9a7f0b00000a_kelmFB4n1IrnCDYuIFn2y", + 'sub' : "allowed_sources"}) host_list = json_loads(page) host_list = host_list['allow'] return host_list diff --git a/module/plugins/hooks/FreeWayMe.py b/module/plugins/hooks/FreeWayMe.py index 1d7dd369e..5abec29ba 100644 --- a/module/plugins/hooks/FreeWayMe.py +++ b/module/plugins/hooks/FreeWayMe.py @@ -20,6 +20,6 @@ class FreeWayMe(MultiHoster): def getHoster(self): - hostis = getURL("https://www.free-way.me/ajax/jd.php", get={"id": 3}).replace("\"", "").strip() + hostis = getURL("https://www.free-way.me/ajax/jd.php", get={'id': 3}).replace("\"", "").strip() self.logDebug("Hosters", hostis) return [x.strip() for x in hostis.split(",") if x.strip()] diff --git a/module/plugins/hooks/LinksnappyCom.py b/module/plugins/hooks/LinksnappyCom.py index aa130f416..82edc30fd 100644 --- a/module/plugins/hooks/LinksnappyCom.py +++ b/module/plugins/hooks/LinksnappyCom.py @@ -21,7 +21,7 @@ class LinksnappyCom(MultiHoster): def getHoster(self): - json_data = getURL('http://gen.linksnappy.com/lseAPI.php?act=FILEHOSTS') + json_data = getURL("http://gen.linksnappy.com/lseAPI.php", get={'act': "FILEHOSTS"}) json_data = json_loads(json_data) return json_data['return'].keys() diff --git a/module/plugins/hooks/MegaDebridEu.py b/module/plugins/hooks/MegaDebridEu.py index d8e338aec..4f627b7e9 100644 --- a/module/plugins/hooks/MegaDebridEu.py +++ b/module/plugins/hooks/MegaDebridEu.py @@ -18,7 +18,7 @@ class MegaDebridEu(MultiHoster): def getHoster(self): - reponse = getURL('http://www.mega-debrid.eu/api.php?action=getHosters') + reponse = getURL("http://www.mega-debrid.eu/api.php", get={'action': "getHosters"}) json_data = json_loads(reponse) if json_data['response_code'] == "ok": diff --git a/module/plugins/hooks/MyfastfileCom.py b/module/plugins/hooks/MyfastfileCom.py index 07731f1c2..0cf2c6c22 100644 --- a/module/plugins/hooks/MyfastfileCom.py +++ b/module/plugins/hooks/MyfastfileCom.py @@ -21,7 +21,7 @@ class MyfastfileCom(MultiHoster): def getHoster(self): - json_data = getURL('http://myfastfile.com/api.php?hosts', decode=True) + json_data = getURL("http://myfastfile.com/api.php", get={'hosts': ""}, decode=True) self.logDebug("JSON data", json_data) json_data = json_loads(json_data) diff --git a/module/plugins/hooks/OverLoadMe.py b/module/plugins/hooks/OverLoadMe.py index f4cbdd7fe..baa9b0e0a 100644 --- a/module/plugins/hooks/OverLoadMe.py +++ b/module/plugins/hooks/OverLoadMe.py @@ -23,8 +23,7 @@ class OverLoadMe(MultiHoster): def getHoster(self): https = "https" if self.getConfig("https") else "http" page = getURL(https + "://api.over-load.me/hoster.php", - get={"auth": "0001-cb1f24dadb3aa487bda5afd3b76298935329be7700cd7-5329be77-00cf-1ca0135f"} - ).replace("\"", "").strip() + get={'auth': "0001-cb1f24dadb3aa487bda5afd3b76298935329be7700cd7-5329be77-00cf-1ca0135f"}).replace("\"", "").strip() self.logDebug("Hosterlist", page) return [x.strip() for x in page.split(",") if x.strip()] diff --git a/module/plugins/hooks/PremiumizeMe.py b/module/plugins/hooks/PremiumizeMe.py index ec21fbcb4..c18e8cf8e 100644 --- a/module/plugins/hooks/PremiumizeMe.py +++ b/module/plugins/hooks/PremiumizeMe.py @@ -30,8 +30,8 @@ class PremiumizeMe(MultiHoster): # Get supported hosters list from premiumize.me using the # json API v1 (see https://secure.premiumize.me/?show=api) - answer = getURL("https://api.premiumize.me/pm-api/v1.php?method=hosterlist¶ms[login]=%s¶ms[pass]=%s" % ( - user, data['password'])) + answer = getURL("https://api.premiumize.me/pm-api/v1.php" + get={'method': "hosterlist", 'params[login]': user, 'params[pass]': data['password']}) data = json_loads(answer) # If account is not valid thera are no hosters available diff --git a/module/plugins/hooks/RPNetBiz.py b/module/plugins/hooks/RPNetBiz.py index 01591354d..e38aa8ea0 100644 --- a/module/plugins/hooks/RPNetBiz.py +++ b/module/plugins/hooks/RPNetBiz.py @@ -29,7 +29,7 @@ class RPNetBiz(MultiHoster): (user, data) = self.account.selectAccount() res = getURL("https://premium.rpnet.biz/client_api.php", - get={"username": user, "password": data['password'], "action": "showHosterList"}) + get={'username': user, 'password': data['password'], 'action': "showHosterList"}) hoster_list = json_loads(res) # If account is not valid thera are no hosters available diff --git a/module/plugins/hooks/RehostTo.py b/module/plugins/hooks/RehostTo.py index c58abf3f3..1bf7d2555 100644 --- a/module/plugins/hooks/RehostTo.py +++ b/module/plugins/hooks/RehostTo.py @@ -20,7 +20,8 @@ class RehostTo(MultiHoster): def getHoster(self): - page = getURL("http://rehost.to/api.php?cmd=get_supported_och_dl&long_ses=%s" % self.long_ses) + page = getURL("http://rehost.to/api.php", + get={'cmd': "get_supported_och_dl", 'long_ses': self.long_ses}) return [x.strip() for x in page.replace("\"", "").split(",")] diff --git a/module/plugins/hooks/SimplyPremiumCom.py b/module/plugins/hooks/SimplyPremiumCom.py index ba0543691..cc7e9183c 100644 --- a/module/plugins/hooks/SimplyPremiumCom.py +++ b/module/plugins/hooks/SimplyPremiumCom.py @@ -22,7 +22,7 @@ class SimplyPremiumCom(MultiHoster): def getHoster(self): - json_data = getURL('http://www.simply-premium.com/api/hosts.php?format=json&online=1') + json_data = getURL("http://www.simply-premium.com/api/hosts.php", get={'format': "json", 'online': 1}) json_data = json_loads(json_data) host_list = [element['regex'] for element in json_data['result']] diff --git a/module/plugins/hooks/SimplydebridCom.py b/module/plugins/hooks/SimplydebridCom.py index 3fbc0459c..173206e75 100644 --- a/module/plugins/hooks/SimplydebridCom.py +++ b/module/plugins/hooks/SimplydebridCom.py @@ -18,5 +18,5 @@ class SimplydebridCom(MultiHoster): def getHoster(self): - page = getURL("http://simply-debrid.com/api.php?list=1") + page = getURL("http://simply-debrid.com/api.php", get={'list': 1}) return [x.strip() for x in page.rstrip(';').replace("\"", "").split(";")] diff --git a/module/plugins/hooks/UnrestrictLi.py b/module/plugins/hooks/UnrestrictLi.py index 295cfaf5a..d87265ef4 100644 --- a/module/plugins/hooks/UnrestrictLi.py +++ b/module/plugins/hooks/UnrestrictLi.py @@ -22,7 +22,7 @@ class UnrestrictLi(MultiHoster): def getHoster(self): - json_data = getURL('http://unrestrict.li/api/jdownloader/hosts.php?format=json') + json_data = getURL("http://unrestrict.li/api/jdownloader/hosts.php", get={'format': "json"}) json_data = json_loads(json_data) host_list = [element['host'] for element in json_data['result']] diff --git a/module/plugins/hooks/ZeveraCom.py b/module/plugins/hooks/ZeveraCom.py index 6ea05de4f..6fafb9666 100644 --- a/module/plugins/hooks/ZeveraCom.py +++ b/module/plugins/hooks/ZeveraCom.py @@ -18,5 +18,5 @@ class ZeveraCom(MultiHoster): def getHoster(self): - page = getURL("http://www.zevera.com/jDownloader.ashx?cmd=gethosters") + page = getURL("http://www.zevera.com/jDownloader.ashx", get={'cmd': "gethosters"}) return [x.strip() for x in page.replace("\"", "").split(",")] -- cgit v1.2.3 From 2e35201317a88f87b7a0e0ff448f3f55eb1861a9 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sun, 7 Dec 2014 14:54:27 +0100 Subject: [SkipRev] Tiny fixup --- module/plugins/hooks/SkipRev.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/SkipRev.py b/module/plugins/hooks/SkipRev.py index a44d20a3e..76a48a255 100644 --- a/module/plugins/hooks/SkipRev.py +++ b/module/plugins/hooks/SkipRev.py @@ -12,7 +12,7 @@ from module.plugins.Plugin import SkipDownload class SkipRev(Hook): __name__ = "SkipRev" __type__ = "hook" - __version__ = "0.12" + __version__ = "0.13" __config__ = [("auto", "bool", "Automatically keep all rev files needed by package", True), ("tokeep", "int" , "Min number of rev files to keep for package" , 1), @@ -26,24 +26,25 @@ class SkipRev(Hook): def _setup(self): super(self.pyfile.plugin, self).setup() if self.pyfile.hasStatus("skipped"): - raise SkipDownload(self.pyfile.getStatusName()) + raise SkipDownload(self.pyfile.getStatusName() or self.pyfile.pluginname) def pyname(self, pyfile): + url = pyfile.url plugin = pyfile.plugin if hasattr(plugin, "info") and 'name' in plugin.info and plugin.info['name']: name = plugin.info['name'] elif hasattr(plugin, "parseInfo"): - name = next(plugin.parseInfo([pyfile.url]))['name'] + name = next(plugin.parseInfo([url]))['name'] elif hasattr(plugin, "getInfo"): #@NOTE: if parseInfo was not found, getInfo should be missing too - name = plugin.getInfo(pyfile.url)['name'] + name = plugin.getInfo(url)['name'] else: self.logWarning("Unable to grab file name") - name = urlparse(unquote(pyfile.url)).path.split('/')[-1]) + name = urlparse(unquote(url)).path.split('/')[-1]) return name -- cgit v1.2.3