From cc7109dd0c7f12c1b6a1ec0525951112a2a1b98b Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sat, 27 Dec 2014 13:49:06 +0100 Subject: [MegaDebridEu] Improve __pattern__ --- module/plugins/hoster/MegaDebridEu.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins/hoster/MegaDebridEu.py') diff --git a/module/plugins/hoster/MegaDebridEu.py b/module/plugins/hoster/MegaDebridEu.py index ebef7969c..6b9f463d5 100644 --- a/module/plugins/hoster/MegaDebridEu.py +++ b/module/plugins/hoster/MegaDebridEu.py @@ -11,9 +11,9 @@ from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo class MegaDebridEu(MultiHoster): __name__ = "MegaDebridEu" __type__ = "hoster" - __version__ = "0.43" + __version__ = "0.44" - __pattern__ = r'^https?://(?:w{3}\d+\.mega-debrid\.eu|\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})/download/file/[^/]+/.+$' + __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^_]+' __description__ = """mega-debrid.eu hoster plugin""" __license__ = "GPLv3" -- cgit v1.2.3 From 88568cf127542e2757d25705ecfdb2342b7c51b8 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 30 Dec 2014 19:31:19 +0100 Subject: Update some MultiHoster __pattern__ --- module/plugins/hoster/MegaDebridEu.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins/hoster/MegaDebridEu.py') diff --git a/module/plugins/hoster/MegaDebridEu.py b/module/plugins/hoster/MegaDebridEu.py index 6b9f463d5..6e24cc7ba 100644 --- a/module/plugins/hoster/MegaDebridEu.py +++ b/module/plugins/hoster/MegaDebridEu.py @@ -11,9 +11,9 @@ from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo class MegaDebridEu(MultiHoster): __name__ = "MegaDebridEu" __type__ = "hoster" - __version__ = "0.44" + __version__ = "0.45" - __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^_]+' + __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^_]+' __description__ = """mega-debrid.eu hoster plugin""" __license__ = "GPLv3" -- cgit v1.2.3 From fd105f8e51768ec1943cda2375bdfdbe5b0a3951 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Fri, 9 Jan 2015 00:35:51 +0100 Subject: "New Year" Update: hoster plugins --- module/plugins/hoster/MegaDebridEu.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'module/plugins/hoster/MegaDebridEu.py') diff --git a/module/plugins/hoster/MegaDebridEu.py b/module/plugins/hoster/MegaDebridEu.py index 6e24cc7ba..8bbc733e0 100644 --- a/module/plugins/hoster/MegaDebridEu.py +++ b/module/plugins/hoster/MegaDebridEu.py @@ -11,11 +11,11 @@ from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo class MegaDebridEu(MultiHoster): __name__ = "MegaDebridEu" __type__ = "hoster" - __version__ = "0.45" + __version__ = "0.46" __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^_]+' - __description__ = """mega-debrid.eu hoster plugin""" + __description__ = """mega-debrid.eu multi-hoster plugin""" __license__ = "GPLv3" __authors__ = [("D.Ducatel", "dducatel@je-geek.fr")] @@ -30,19 +30,19 @@ class MegaDebridEu(MultiHoster): return "" - def handlePremium(self): - if not self.connectToApi(): + def handlePremium(self, pyfile): + if not self.api_load(): self.exitOnFail("Unable to connect to Mega-debrid.eu") - self.link = self.debridLink(self.pyfile.url) + self.link = self.debridLink(pyfile.url) self.logDebug("New URL: " + self.link) filename = self.getFilename(self.link) if filename != "": - self.pyfile.name = filename + pyfile.name = filename - def connectToApi(self): + def api_load(self): """ Connexion to the mega-debrid API Return True if succeed -- cgit v1.2.3 From b25bc61dd47d8d3c42969bd0f72443b21c4b059e Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sun, 8 Feb 2015 02:09:45 +0100 Subject: Spare code cosmetics --- module/plugins/hoster/MegaDebridEu.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'module/plugins/hoster/MegaDebridEu.py') diff --git a/module/plugins/hoster/MegaDebridEu.py b/module/plugins/hoster/MegaDebridEu.py index 8bbc733e0..b42362800 100644 --- a/module/plugins/hoster/MegaDebridEu.py +++ b/module/plugins/hoster/MegaDebridEu.py @@ -35,10 +35,9 @@ class MegaDebridEu(MultiHoster): self.exitOnFail("Unable to connect to Mega-debrid.eu") self.link = self.debridLink(pyfile.url) - self.logDebug("New URL: " + self.link) filename = self.getFilename(self.link) - if filename != "": + if filename: pyfile.name = filename -- cgit v1.2.3 From 7beb65e991bc6d1913c3b5bb2ef69e659d5b8342 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 10 Mar 2015 01:55:52 +0100 Subject: Spare code cosmetics --- module/plugins/hoster/MegaDebridEu.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/hoster/MegaDebridEu.py') diff --git a/module/plugins/hoster/MegaDebridEu.py b/module/plugins/hoster/MegaDebridEu.py index b42362800..fa66e74e6 100644 --- a/module/plugins/hoster/MegaDebridEu.py +++ b/module/plugins/hoster/MegaDebridEu.py @@ -79,7 +79,7 @@ class MegaDebridEu(MultiHoster): exit the plugin on fail case And display the reason of this failure """ - if self.getConfig("unloadFailing"): + if self.getConfig('unloadFailing'): self.logError(_(msg)) self.resetAccount() else: -- cgit v1.2.3 From 2bc144adb6bc2759b635e09687b27bf96074827f Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Wed, 18 Mar 2015 13:39:07 +0100 Subject: Spare code cosmetics --- module/plugins/hoster/MegaDebridEu.py | 49 +++++++---------------------------- 1 file changed, 10 insertions(+), 39 deletions(-) (limited to 'module/plugins/hoster/MegaDebridEu.py') 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) -- cgit v1.2.3 From 7d90803262ccbb4fc5296a4dc3ce30fe98f55631 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Wed, 25 Mar 2015 23:10:07 +0100 Subject: __config__ cosmetics --- module/plugins/hoster/MegaDebridEu.py | 1 + 1 file changed, 1 insertion(+) (limited to 'module/plugins/hoster/MegaDebridEu.py') diff --git a/module/plugins/hoster/MegaDebridEu.py b/module/plugins/hoster/MegaDebridEu.py index 05102d60f..3a8d8b080 100644 --- a/module/plugins/hoster/MegaDebridEu.py +++ b/module/plugins/hoster/MegaDebridEu.py @@ -14,6 +14,7 @@ class MegaDebridEu(MultiHoster): __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^_]+' + __config__ = [("use_premium", "bool", "Use premium account if available", True)] __description__ = """mega-debrid.eu multi-hoster plugin""" __license__ = "GPLv3" -- cgit v1.2.3 From 1ef93e913238275f7657d496ba3d2e7eeb5a30a2 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Fri, 1 May 2015 01:06:01 +0200 Subject: Use 'import' instead 'from' --- module/plugins/hoster/MegaDebridEu.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'module/plugins/hoster/MegaDebridEu.py') diff --git a/module/plugins/hoster/MegaDebridEu.py b/module/plugins/hoster/MegaDebridEu.py index 3a8d8b080..9c8cc2a90 100644 --- a/module/plugins/hoster/MegaDebridEu.py +++ b/module/plugins/hoster/MegaDebridEu.py @@ -1,8 +1,7 @@ # -*- coding: utf-8 -*- import re - -from urllib import unquote_plus +import urllib from module.common.json_layer import json_loads from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo -- cgit v1.2.3