diff options
| author | 2013-04-12 15:30:17 +0200 | |
|---|---|---|
| committer | 2013-04-12 15:30:17 +0200 | |
| commit | c235e869a50d8783b01f5a46d5b93e171cbbb71e (patch) | |
| tree | cda559f8ae2bc88b0a6e20e0a55188bafd9a6f86 | |
| parent | New crypter: MBLinkInfo (diff) | |
| download | pyload-c235e869a50d8783b01f5a46d5b93e171cbbb71e.tar.xz | |
New debrid: MultiDebridCom
http://forum.pyload.org/viewtopic.php?f=13&t=2426
| -rw-r--r-- | module/plugins/accounts/MultiDebridCom.py | 47 | ||||
| -rw-r--r-- | module/plugins/hooks/MultiDebridCom.py | 42 | ||||
| -rw-r--r-- | module/plugins/hoster/MultiDebridCom.py | 57 | 
3 files changed, 146 insertions, 0 deletions
| diff --git a/module/plugins/accounts/MultiDebridCom.py b/module/plugins/accounts/MultiDebridCom.py new file mode 100644 index 000000000..904be5ee7 --- /dev/null +++ b/module/plugins/accounts/MultiDebridCom.py @@ -0,0 +1,47 @@ +# -*- coding: utf-8 -*- + +############################################################################ +# This program is free software: you can redistribute it and/or modify     # +# it under the terms of the GNU Affero General Public License as           # +# published by the Free Software Foundation, either version 3 of the       # +# License, or (at your option) any later version.                          # +#                                                                          # +# This program is distributed in the hope that it will be useful,          # +# but WITHOUT ANY WARRANTY; without even the implied warranty of           # +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            # +# GNU Affero General Public License for more details.                      # +#                                                                          # +# You should have received a copy of the GNU Affero General Public License # +# along with this program.  If not, see <http://www.gnu.org/licenses/>.    # +############################################################################ + +from time import time + +from module.plugins.Account import Account +from module.common.json_layer import json_loads + + +class MultiDebridCom(Account): +    __name__ = "MultiDebridCom" +    __version__ = "0.01" +    __type__ = "account" +    __description__ = """Multi-debrid.com account plugin""" +    __author_name__ = ("stickell") +    __author_mail__ = ("l.stickell@yahoo.it") + +    def loadAccountInfo(self, user, req): +        if 'days_left' in self.json_data: +            validuntil = int(time() + self.json_data['days_left'] * 86400) +            return {"premium": True, "validuntil": validuntil, "trafficleft": -1} +        else: +            self.logError('Unable to get account information') + +    def login(self, user, data, req): +        # Password to use is the API-Password written in http://multi-debrid.com/myaccount +        self.html = req.load("http://multi-debrid.com/api.php", +                             get={"user": user, "pass": data["password"]}) +        self.logDebug('JSON data: ' + self.html) +        self.json_data = json_loads(self.html) +        if self.json_data['status'] != 'ok': +            self.logError('Invalid login. The password to use is the API-Password you find in your "My Account" page') +            self.wrongPassword() diff --git a/module/plugins/hooks/MultiDebridCom.py b/module/plugins/hooks/MultiDebridCom.py new file mode 100644 index 000000000..c95138648 --- /dev/null +++ b/module/plugins/hooks/MultiDebridCom.py @@ -0,0 +1,42 @@ +# -*- coding: utf-8 -*- + +############################################################################ +# This program is free software: you can redistribute it and/or modify     # +# it under the terms of the GNU Affero General Public License as           # +# published by the Free Software Foundation, either version 3 of the       # +# License, or (at your option) any later version.                          # +#                                                                          # +# This program is distributed in the hope that it will be useful,          # +# but WITHOUT ANY WARRANTY; without even the implied warranty of           # +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            # +# GNU Affero General Public License for more details.                      # +#                                                                          # +# You should have received a copy of the GNU Affero General Public License # +# along with this program.  If not, see <http://www.gnu.org/licenses/>.    # +############################################################################ + +from module.plugins.internal.MultiHoster import MultiHoster +from module.network.RequestFactory import getURL +from module.common.json_layer import json_loads + + +class MultiDebridCom(MultiHoster): +    __name__ = "MultiDebridCom" +    __version__ = "0.01" +    __type__ = "hook" +    __config__ = [("activated", "bool", "Activated", "False"), +                  ("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported)", "all"), +                  ("hosterList", "str", "Hoster list (comma separated)", ""), +                  ("unloadFailing", "bool", "Revert to standard download if download fails", "False"), +                  ("interval", "int", "Reload interval in hours (0 to disable)", "24")] + +    __description__ = """Multi-debrid.com hook plugin""" +    __author_name__ = ("stickell") +    __author_mail__ = ("l.stickell@yahoo.it") + +    def getHoster(self): +        json_data = getURL('http://multi-debrid.com/api.php?hosts', decode=True) +        self.logDebug('JSON data: ' + json_data) +        json_data = json_loads(json_data) + +        return json_data['hosts'] diff --git a/module/plugins/hoster/MultiDebridCom.py b/module/plugins/hoster/MultiDebridCom.py new file mode 100644 index 000000000..ca98e8a0e --- /dev/null +++ b/module/plugins/hoster/MultiDebridCom.py @@ -0,0 +1,57 @@ +# -*- coding: utf-8 -*- + +############################################################################ +# This program is free software: you can redistribute it and/or modify     # +# it under the terms of the GNU Affero General Public License as           # +# published by the Free Software Foundation, either version 3 of the       # +# License, or (at your option) any later version.                          # +#                                                                          # +# This program is distributed in the hope that it will be useful,          # +# but WITHOUT ANY WARRANTY; without even the implied warranty of           # +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            # +# GNU Affero General Public License for more details.                      # +#                                                                          # +# You should have received a copy of the GNU Affero General Public License # +# along with this program.  If not, see <http://www.gnu.org/licenses/>.    # +############################################################################ + +import re + +from module.plugins.Hoster import Hoster +from module.common.json_layer import json_loads + + +class MultiDebridCom(Hoster): +    __name__ = "MultiDebridCom" +    __version__ = "0.01" +    __type__ = "hoster" +    __pattern__ = r"http://\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/dl/" +    __description__ = """Multi-debrid.com hoster plugin""" +    __author_name__ = ("stickell") +    __author_mail__ = ("l.stickell@yahoo.it") + +    def init(self): +        self.chunkLimit = -1 +        self.resumeDownload = True + +    def process(self, pyfile): +        if not self.account: +            self.logError("Please enter your Multi-debrid.com account or deactivate this plugin") +            self.fail("No Multi-debrid.com account provided") + +        self.logDebug("Original URL: %s" % pyfile.url) +        if re.match(self.__pattern__, pyfile.url): +            new_url = pyfile.url +        else: +            page = self.req.load('http://multi-debrid.com/api.php', +                                 get={'user': self.user, 'pass': self.account.getAccountData(self.user)['password'], +                                      'link': pyfile.url}) +            self.logDebug("JSON data: " + page) +            page = json_loads(page) +            if page['status'] != 'ok': +                self.fail('Unable to unrestrict link') +            new_url = page['link'] + +        self.logDebug("Unrestricted URL: " + new_url) + +        self.download(new_url, disposition=True) | 
