summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Walter Purcaro <vuolter@users.noreply.github.com> 2015-03-18 13:39:07 +0100
committerGravatar Walter Purcaro <vuolter@users.noreply.github.com> 2015-03-18 13:39:07 +0100
commit2bc144adb6bc2759b635e09687b27bf96074827f (patch)
tree7f33ba4952b37c6c81425786f103524084975bd7
parent[UpdateManager] Dispatch Event on plugins update (diff)
downloadpyload-2bc144adb6bc2759b635e09687b27bf96074827f.tar.xz
Spare code cosmetics
-rw-r--r--module/plugins/hooks/AntiVirus.py4
-rw-r--r--module/plugins/hooks/Checksum.py3
-rw-r--r--module/plugins/hooks/ClickAndLoad.py4
-rw-r--r--module/plugins/hooks/DeleteFinished.py5
-rw-r--r--module/plugins/hooks/DownloadScheduler.py3
-rw-r--r--module/plugins/hooks/HotFolder.py1
-rw-r--r--module/plugins/hooks/JustPremium.py9
-rw-r--r--module/plugins/hooks/MergeFiles.py3
-rw-r--r--module/plugins/hooks/MultiHome.py5
-rw-r--r--module/plugins/hooks/RestartFailed.py1
-rw-r--r--module/plugins/hooks/SkipRev.py4
-rw-r--r--module/plugins/hooks/UnSkipOnFail.py3
-rw-r--r--module/plugins/hooks/XFileSharingPro.py20
-rw-r--r--module/plugins/hoster/AlldebridCom.py25
-rw-r--r--module/plugins/hoster/FastixRu.py23
-rw-r--r--module/plugins/hoster/MegaDebridEu.py49
-rw-r--r--module/plugins/hoster/NitroflareCom.py9
-rw-r--r--module/plugins/hoster/OverLoadMe.py26
-rw-r--r--module/plugins/internal/Extractor.py3
-rw-r--r--module/plugins/internal/MultiHook.py2
-rw-r--r--module/plugins/internal/SimpleCrypter.py6
-rw-r--r--module/plugins/internal/SimpleHoster.py4
22 files changed, 71 insertions, 141 deletions
diff --git a/module/plugins/hooks/AntiVirus.py b/module/plugins/hooks/AntiVirus.py
index b8a659f99..ffed86836 100644
--- a/module/plugins/hooks/AntiVirus.py
+++ b/module/plugins/hooks/AntiVirus.py
@@ -30,6 +30,10 @@ class AntiVirus(Hook):
pass
+ def setup(self):
+ self.info = {} #@TODO: Remove in 0.4.10
+
+
@Expose
@threaded
def scan(self, pyfile, thread):
diff --git a/module/plugins/hooks/Checksum.py b/module/plugins/hooks/Checksum.py
index 9474f6968..42a4ca236 100644
--- a/module/plugins/hooks/Checksum.py
+++ b/module/plugins/hooks/Checksum.py
@@ -75,9 +75,12 @@ class Checksum(Hook):
def setup(self):
+ self.info = {} #@TODO: Remove in 0.4.10
self.algorithms = sorted(
getattr(hashlib, "algorithms", ("md5", "sha1", "sha224", "sha256", "sha384", "sha512")), reverse=True)
+
self.algorithms.extend(["crc32", "adler32"])
+
self.formats = self.algorithms + ["sfv", "crc", "hash"]
diff --git a/module/plugins/hooks/ClickAndLoad.py b/module/plugins/hooks/ClickAndLoad.py
index 731c8bd7e..812f969f9 100644
--- a/module/plugins/hooks/ClickAndLoad.py
+++ b/module/plugins/hooks/ClickAndLoad.py
@@ -41,6 +41,10 @@ class ClickAndLoad(Hook):
pass
+ def setup(self):
+ self.info = {} #@TODO: Remove in 0.4.10
+
+
def coreReady(self):
if not self.config['webinterface']['activated']:
return
diff --git a/module/plugins/hooks/DeleteFinished.py b/module/plugins/hooks/DeleteFinished.py
index 5d2b78d50..e2ad12adb 100644
--- a/module/plugins/hooks/DeleteFinished.py
+++ b/module/plugins/hooks/DeleteFinished.py
@@ -44,7 +44,7 @@ class DeleteFinished(Hook):
def coreReady(self):
- self.info = {'sleep': True}
+ self.info['sleep'] = True
interval = self.getConfig('interval')
self.pluginConfigChanged(self.__name__, 'interval', interval)
self.addEvent('packageFinished', self.wakeup)
@@ -75,5 +75,6 @@ class DeleteFinished(Hook):
def setup(self):
- self.m = self.manager
+ self.info = {} #@TODO: Remove in 0.4.10
+ self.m = self.manager
self.removeEvent = self.m.removeEvent
diff --git a/module/plugins/hooks/DownloadScheduler.py b/module/plugins/hooks/DownloadScheduler.py
index f24faa684..5f9388b57 100644
--- a/module/plugins/hooks/DownloadScheduler.py
+++ b/module/plugins/hooks/DownloadScheduler.py
@@ -27,7 +27,8 @@ class DownloadScheduler(Hook):
def setup(self):
- self.cb = None # callback to scheduler job; will be by removed hookmanager when hook unloaded
+ self.info = {} #@TODO: Remove in 0.4.10
+ self.cb = None # callback to scheduler job; will be by removed hookmanager when hook unloaded
def coreReady(self):
diff --git a/module/plugins/hooks/HotFolder.py b/module/plugins/hooks/HotFolder.py
index 60ddf1621..f771cf232 100644
--- a/module/plugins/hooks/HotFolder.py
+++ b/module/plugins/hooks/HotFolder.py
@@ -27,6 +27,7 @@ class HotFolder(Hook):
def setup(self):
+ self.info = {} #@TODO: Remove in 0.4.10
self.interval = 30
diff --git a/module/plugins/hooks/JustPremium.py b/module/plugins/hooks/JustPremium.py
index 3064743e2..b82af3e78 100644
--- a/module/plugins/hooks/JustPremium.py
+++ b/module/plugins/hooks/JustPremium.py
@@ -23,6 +23,15 @@ class JustPremium(Hook):
event_list = ["linksAdded"]
+ #@TODO: Remove in 0.4.10
+ def initPeriodical(self):
+ pass
+
+
+ def setup(self):
+ self.info = {} #@TODO: Remove in 0.4.10
+
+
def linksAdded(self, links, pid):
hosterdict = self.core.pluginManager.hosterPlugins
linkdict = self.core.api.checkURLs(links)
diff --git a/module/plugins/hooks/MergeFiles.py b/module/plugins/hooks/MergeFiles.py
index 9f1348485..74bcbe3c1 100644
--- a/module/plugins/hooks/MergeFiles.py
+++ b/module/plugins/hooks/MergeFiles.py
@@ -32,8 +32,7 @@ class MergeFiles(Hook):
def setup(self):
- # nothing to do
- pass
+ self.info = {} #@TODO: Remove in 0.4.10
@threaded
diff --git a/module/plugins/hooks/MultiHome.py b/module/plugins/hooks/MultiHome.py
index 7ea3378ec..94c671340 100644
--- a/module/plugins/hooks/MultiHome.py
+++ b/module/plugins/hooks/MultiHome.py
@@ -23,9 +23,12 @@ class MultiHome(Hook):
def setup(self):
- self.register = {}
+ self.info = {} #@TODO: Remove in 0.4.10
+ self.register = {}
self.interfaces = []
+
self.parseInterfaces(self.getConfig('interfaces').split(";"))
+
if not self.interfaces:
self.parseInterfaces([self.config['download']['interface']])
self.setConfig("interfaces", self.toConfig())
diff --git a/module/plugins/hooks/RestartFailed.py b/module/plugins/hooks/RestartFailed.py
index d0424bd1f..6eef90ffe 100644
--- a/module/plugins/hooks/RestartFailed.py
+++ b/module/plugins/hooks/RestartFailed.py
@@ -37,6 +37,7 @@ class RestartFailed(Hook):
def setup(self):
+ self.info = {} #@TODO: Remove in 0.4.10
self.interval = self.MIN_CHECK_INTERVAL
diff --git a/module/plugins/hooks/SkipRev.py b/module/plugins/hooks/SkipRev.py
index dc45a2e6d..9109d4f80 100644
--- a/module/plugins/hooks/SkipRev.py
+++ b/module/plugins/hooks/SkipRev.py
@@ -29,6 +29,10 @@ class SkipRev(Hook):
pass
+ def setup(self):
+ self.info = {} #@TODO: Remove in 0.4.10
+
+
@staticmethod
def _setup(self):
self.pyfile.plugin._setup()
diff --git a/module/plugins/hooks/UnSkipOnFail.py b/module/plugins/hooks/UnSkipOnFail.py
index a2665663c..f1f2288fe 100644
--- a/module/plugins/hooks/UnSkipOnFail.py
+++ b/module/plugins/hooks/UnSkipOnFail.py
@@ -20,6 +20,9 @@ class UnSkipOnFail(Hook):
def initPeriodical(self):
pass
+ def setup(self):
+ self.info = {} #@TODO: Remove in 0.4.10
+
def downloadFailed(self, pyfile):
#: Check if pyfile is still "failed",
diff --git a/module/plugins/hooks/XFileSharingPro.py b/module/plugins/hooks/XFileSharingPro.py
index d9552051e..69a49fba0 100644
--- a/module/plugins/hooks/XFileSharingPro.py
+++ b/module/plugins/hooks/XFileSharingPro.py
@@ -8,7 +8,7 @@ from module.plugins.Hook import Hook
class XFileSharingPro(Hook):
__name__ = "XFileSharingPro"
__type__ = "hook"
- __version__ = "0.33"
+ __version__ = "0.34"
__config__ = [("activated" , "bool", "Activated" , True ),
("use_hoster_list" , "bool", "Load listed hosters only" , False),
@@ -22,11 +22,11 @@ class XFileSharingPro(Hook):
__authors__ = [("Walter Purcaro", "vuolter@gmail.com")]
- # event_list = ["pluginConfigChanged"]
- regexp = {'hoster' : (r'https?://(?:www\.)?(?P<DOMAIN>[\w\-.^_]{3,63}(?:\.[a-zA-Z]{2,})(?:\:\d+)?)/(?:embed-)?\w{12}(?:\W|$)',
- r'https?://(?:[^/]+\.)?(?P<DOMAIN>%s)/(?:embed-)?\w+'),
- 'crypter': (r'https?://(?:www\.)?(?P<DOMAIN>[\w\-.^_]{3,63}(?:\.[a-zA-Z]{2,})(?:\:\d+)?)/(?:user|folder)s?/\w+',
- r'https?://(?:[^/]+\.)?(?P<DOMAIN>%s)/(?:user|folder)s?/\w+')}
+ event_list = ["pluginConfigChanged"]
+ regexp = {'hoster' : (r'https?://(?:www\.)?(?P<DOMAIN>[\w\-.^_]{3,63}(?:\.[a-zA-Z]{2,})(?:\:\d+)?)/(?:embed-)?\w{12}(?:\W|$)',
+ r'https?://(?:[^/]+\.)?(?P<DOMAIN>%s)/(?:embed-)?\w+'),
+ 'crypter': (r'https?://(?:www\.)?(?P<DOMAIN>[\w\-.^_]{3,63}(?:\.[a-zA-Z]{2,})(?:\:\d+)?)/(?:user|folder)s?/\w+',
+ r'https?://(?:[^/]+\.)?(?P<DOMAIN>%s)/(?:user|folder)s?/\w+')}
HOSTER_BUILTIN = [#WORKING HOSTERS:
"backin.net", "eyesfile.ca", "file4safe.com", "fileband.com", "filedwon.com", "fileparadox.in",
@@ -41,8 +41,8 @@ class XFileSharingPro(Hook):
CRYPTER_BUILTIN = ["junocloud.me", "rapidfileshare.net"]
- # def pluginConfigChanged(self.__name__, plugin, name, value):
- # self.loadPattern()
+ def pluginConfigChanged(self.__name__, plugin, name, value):
+ self.loadPattern()
#@TODO: Remove in 0.4.10
@@ -50,6 +50,10 @@ class XFileSharingPro(Hook):
pass
+ def setup(self):
+ self.info = {} #@TODO: Remove in 0.4.10
+
+
def coreReady(self):
self.loadPattern()
diff --git a/module/plugins/hoster/AlldebridCom.py b/module/plugins/hoster/AlldebridCom.py
index 0a35ae2be..163e4e0d2 100644
--- a/module/plugins/hoster/AlldebridCom.py
+++ b/module/plugins/hoster/AlldebridCom.py
@@ -13,7 +13,7 @@ from module.utils import parseFileSize
class AlldebridCom(MultiHoster):
__name__ = "AlldebridCom"
__type__ = "hoster"
- __version__ = "0.45"
+ __version__ = "0.46"
__pattern__ = r'https?://(?:www\.|s\d+\.)?alldebrid\.com/dl/[\w^_]+'
@@ -22,18 +22,6 @@ class AlldebridCom(MultiHoster):
__authors__ = [("Andy Voigt", "spamsales@online.de")]
- def getFilename(self, url):
- try:
- name = unquote(url.rsplit("/", 1)[1])
- except IndexError:
- name = "Unknown_Filename..."
-
- if name.endswith("..."): # incomplete filename, append random stuff
- name += "%s.tmp" % randrange(100, 999)
-
- return name
-
-
def setup(self):
self.chunkLimit = 16
@@ -63,16 +51,5 @@ class AlldebridCom(MultiHoster):
else:
self.link = self.link.replace("https://", "http://")
- if pyfile.name.startswith("http") or pyfile.name.startswith("Unknown"):
- #only use when name wasnt already set
- pyfile.name = self.getFilename(self.link)
-
-
- def checkFile(self, rules={}):
- if self.checkDownload({'error': "<title>An error occured while processing your request</title>"}) == "error":
- self.retry(wait_time=60, reason=_("An error occured while generating link"))
-
- return super(AlldebridCom, self).checkFile(rules)
-
getInfo = create_getInfo(AlldebridCom)
diff --git a/module/plugins/hoster/FastixRu.py b/module/plugins/hoster/FastixRu.py
index 759b9bfec..2d36ad4a4 100644
--- a/module/plugins/hoster/FastixRu.py
+++ b/module/plugins/hoster/FastixRu.py
@@ -12,7 +12,7 @@ from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo
class FastixRu(MultiHoster):
__name__ = "FastixRu"
__type__ = "hoster"
- __version__ = "0.10"
+ __version__ = "0.11"
__pattern__ = r'http://(?:www\.)?fastix\.(ru|it)/file/\w{24}'
@@ -21,16 +21,6 @@ class FastixRu(MultiHoster):
__authors__ = [("Massimo Rosamilia", "max@spiritix.eu")]
- def getFilename(self, url):
- try:
- name = unquote(url.rsplit("/", 1)[1])
- except IndexError:
- name = "Unknown_Filename..."
- if name.endswith("..."): # incomplete filename, append random stuff
- name += "%s.tmp" % randrange(100, 999)
- return name
-
-
def setup(self):
self.chunkLimit = 3
@@ -51,16 +41,5 @@ class FastixRu(MultiHoster):
else:
self.link = data['downloadlink']
- if pyfile.name.startswith("http") or pyfile.name.startswith("Unknown"):
- #only use when name wasnt already set
- pyfile.name = self.getFilename(self.link)
-
-
- def checkFile(self, rules={}):
- if self.checkDownload({"error": "<title>An error occurred while processing your request</title>"}):
- self.retry(wait_time=60, reason=_("An error occurred while generating link"))
-
- return super(FastixRu, self).checkFile(rules)
-
getInfo = create_getInfo(FastixRu)
diff --git a/module/plugins/hoster/MegaDebridEu.py b/module/plugins/hoster/MegaDebridEu.py
index fa66e74e6..05102d60f 100644
--- a/module/plugins/hoster/MegaDebridEu.py
+++ b/module/plugins/hoster/MegaDebridEu.py
@@ -11,7 +11,7 @@ from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo
class MegaDebridEu(MultiHoster):
__name__ = "MegaDebridEu"
__type__ = "hoster"
- __version__ = "0.46"
+ __version__ = "0.47"
__pattern__ = r'http://((?:www\d+\.|s\d+\.)?mega-debrid\.eu|\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})/download/file/[\w^_]+'
@@ -23,24 +23,6 @@ class MegaDebridEu(MultiHoster):
API_URL = "https://www.mega-debrid.eu/api.php"
- def getFilename(self, url):
- try:
- return unquote_plus(url.rsplit("/", 1)[1])
- except IndexError:
- return ""
-
-
- def handlePremium(self, pyfile):
- if not self.api_load():
- self.exitOnFail("Unable to connect to Mega-debrid.eu")
-
- self.link = self.debridLink(pyfile.url)
-
- filename = self.getFilename(self.link)
- if filename:
- pyfile.name = filename
-
-
def api_load(self):
"""
Connexion to the mega-debrid API
@@ -58,32 +40,21 @@ class MegaDebridEu(MultiHoster):
return False
- def debridLink(self, linkToDebrid):
+ def handlePremium(self, pyfile):
"""
Debrid a link
Return The debrided link if succeed or original link if fail
"""
- jsonResponse = self.load(self.API_URL, get={'action': 'getLink', 'token': self.token},
- post={"link": linkToDebrid})
- res = json_loads(jsonResponse)
-
- if res['response_code'] == "ok":
- debridedLink = res['debridLink'][1:-1]
- return debridedLink
- else:
- self.exitOnFail("Unable to debrid %s" % linkToDebrid)
+ if not self.api_load():
+ self.error("Unable to connect to remote API")
+ jsonResponse = self.load(self.API_URL,
+ get={'action': 'getLink', 'token': self.token},
+ post={'link': pyfile.url})
- def exitOnFail(self, msg):
- """
- exit the plugin on fail case
- And display the reason of this failure
- """
- if self.getConfig('unloadFailing'):
- self.logError(_(msg))
- self.resetAccount()
- else:
- self.fail(_(msg))
+ res = json_loads(jsonResponse)
+ if res['response_code'] == "ok":
+ self.link = res['debridLink'][1:-1]
getInfo = create_getInfo(MegaDebridEu)
diff --git a/module/plugins/hoster/NitroflareCom.py b/module/plugins/hoster/NitroflareCom.py
index 6196e0862..cffa0e9a5 100644
--- a/module/plugins/hoster/NitroflareCom.py
+++ b/module/plugins/hoster/NitroflareCom.py
@@ -1,14 +1,7 @@
# -*- coding: utf-8 -*-
-#
-# Note:
-# Right now premium support is not added
-# Thus, any file that require premium support
-# cannot be downloaded. Only the file that is free to
-# download can be downloaded.
import re
-from module.common.json_layer import json_loads
from module.plugins.internal.CaptchaService import ReCaptcha
from module.plugins.internal.SimpleHoster import SimpleHoster
@@ -36,7 +29,7 @@ class NitroflareCom(SimpleHoster):
RECAPTCHA_KEY = "6Lenx_USAAAAAF5L1pmTWvWcH73dipAEzNnmNLgy"
PREMIUM_ONLY_PATTERN = r'This file is available with Premium only'
- WAIT_PATTERN = r'You have to wait .+'
+ WAIT_PATTERN = r'You have to wait .+?<'
ERROR_PATTERN = r'downloading is not possible'
diff --git a/module/plugins/hoster/OverLoadMe.py b/module/plugins/hoster/OverLoadMe.py
index 7b444c3ca..4e88710b8 100644
--- a/module/plugins/hoster/OverLoadMe.py
+++ b/module/plugins/hoster/OverLoadMe.py
@@ -13,7 +13,7 @@ from module.utils import parseFileSize
class OverLoadMe(MultiHoster):
__name__ = "OverLoadMe"
__type__ = "hoster"
- __version__ = "0.10"
+ __version__ = "0.11"
__pattern__ = r'https?://.*overload\.me/.+'
@@ -22,18 +22,6 @@ class OverLoadMe(MultiHoster):
__authors__ = [("marley", "marley@over-load.me")]
- def getFilename(self, url):
- try:
- name = unquote(url.rsplit("/", 1)[1])
- except IndexError:
- name = "Unknown_Filename..."
-
- if name.endswith("..."): #: incomplete filename, append random stuff
- name += "%s.tmp" % randrange(100, 999)
-
- return name
-
-
def setup(self):
self.chunkLimit = 5
@@ -60,17 +48,5 @@ class OverLoadMe(MultiHoster):
http_repl = ["http://", "https://"]
self.link = data['downloadlink'].replace(*http_repl if self.getConfig('ssl') else *http_repl[::-1])
- if pyfile.name.startswith("http") or pyfile.name.startswith("Unknown") or pyfile.name.endswith('..'):
- # only use when name wasn't already set
- pyfile.name = self.getFilename(self.link)
-
-
- def checkFile(self, rules={}):
- if self.checkDownload({"error": "<title>An error occured while processing your request</title>"})
- # usual this download can safely be retried
- self.retry(wait_time=60, reason=_("An error occured while generating link."))
-
- return super(OverLoadMe, self).checkFile(rules)
-
getInfo = create_getInfo(OverLoadMe)
diff --git a/module/plugins/internal/Extractor.py b/module/plugins/internal/Extractor.py
index 79864818e..f32329e37 100644
--- a/module/plugins/internal/Extractor.py
+++ b/module/plugins/internal/Extractor.py
@@ -23,8 +23,7 @@ class Extractor:
__description__ = """Base extractor plugin"""
__license__ = "GPLv3"
- __authors__ = [("RaNaN" , "ranan@pyload.org" ),
- ("Walter Purcaro", "vuolter@gmail.com"),
+ __authors__ = [("Walter Purcaro", "vuolter@gmail.com"),
("Immenz" , "immenz@gmx.net" )]
diff --git a/module/plugins/internal/MultiHook.py b/module/plugins/internal/MultiHook.py
index d4369da9b..35bb9c65d 100644
--- a/module/plugins/internal/MultiHook.py
+++ b/module/plugins/internal/MultiHook.py
@@ -57,6 +57,8 @@ class MultiHook(Hook):
def setup(self):
+ self.info = {} #@TODO: Remove in 0.4.10
+
self.plugins = []
self.supported = []
self.new_supported = []
diff --git a/module/plugins/internal/SimpleCrypter.py b/module/plugins/internal/SimpleCrypter.py
index 696cc0848..ef6d3fc0e 100644
--- a/module/plugins/internal/SimpleCrypter.py
+++ b/module/plugins/internal/SimpleCrypter.py
@@ -15,14 +15,12 @@ class SimpleCrypter(Crypter, SimpleHoster):
__version__ = "0.43"
__pattern__ = r'^unmatchable$'
- __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), #: Overrides core.config['general']['folder_per_package']
+ __config__ = [("use_subfolder" , "bool", "Save package to subfolder" , True), #: Overrides core.config['general']['folder_per_package']
("subfolder_per_package", "bool", "Create a subfolder for each package", True)]
__description__ = """Simple decrypter plugin"""
__license__ = "GPLv3"
- __authors__ = [("stickell" , "l.stickell@yahoo.it"),
- ("zoidberg" , "zoidberg@mujmail.cz"),
- ("Walter Purcaro", "vuolter@gmail.com" )]
+ __authors__ = [("Walter Purcaro", "vuolter@gmail.com" )]
"""
diff --git a/module/plugins/internal/SimpleHoster.py b/module/plugins/internal/SimpleHoster.py
index 5defd028d..103dc9a19 100644
--- a/module/plugins/internal/SimpleHoster.py
+++ b/module/plugins/internal/SimpleHoster.py
@@ -252,9 +252,7 @@ class SimpleHoster(Hoster):
__description__ = """Simple hoster plugin"""
__license__ = "GPLv3"
- __authors__ = [("zoidberg" , "zoidberg@mujmail.cz"),
- ("stickell" , "l.stickell@yahoo.it"),
- ("Walter Purcaro", "vuolter@gmail.com" )]
+ __authors__ = [("Walter Purcaro", "vuolter@gmail.com" )]
"""