From 36b5bfedc2e57bd000831559ca8fb4d7e7899e24 Mon Sep 17 00:00:00 2001 From: tjeh Date: Sun, 20 Jul 2014 21:49:27 +0200 Subject: Added support for Multihosters.com multihoster. --- module/plugins/hoster/MultihostersCom.py | 41 ++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 module/plugins/hoster/MultihostersCom.py (limited to 'module/plugins/hoster') diff --git a/module/plugins/hoster/MultihostersCom.py b/module/plugins/hoster/MultihostersCom.py new file mode 100644 index 000000000..04192cd8e --- /dev/null +++ b/module/plugins/hoster/MultihostersCom.py @@ -0,0 +1,41 @@ +# -*- coding: utf-8 -*- + +import re +from module.plugins.Hoster import Hoster + +class MultihostersCom(Hoster): + __name__ = "MultihostersCom" + __version__ = "0.01" + __type__ = "hoster" + __pattern__ = r'http://(?:www\.)?multihosters.com/.*' + __description__ = """Multihosters.com hoster plugin""" + __author_name__ = "tjeh" + __author_mail__ = "tjeh@gmx.net" + + def setup(self): + self.resumeDownload = self.multiDL = True + self.chunkLimit = 1 + + def process(self, pyfile): + if re.match(self.__pattern__, pyfile.url): + new_url = pyfile.url + elif not self.account: + self.logError(("Please enter your %s account or deactivate this plugin") % "multihosters.com") + self.fail("No multihosters.com account provided") + else: + self.logDebug("Old URL: %s" % pyfile.url) + new_url = "http://multihosters.com/getFiles.aspx?ourl=" + pyfile.url + pyfile.url = new_url + self.logDebug("New URL: %s" % new_url) + + if self.account.getAPIData(self.req, cmd="checklink", olink=pyfile.url) != "Alive": + self.fail("Offline or not downloadable - contact Multihosters support") + + header = self.account.getAPIData(self.req, just_header=True, cmd="generatedownloaddirect", olink=pyfile.url) + if not "location" in header: + self.fail("Unable to initialize download - contact Multihosters support") + self.download(header['location'], disposition=True) + + check = self.checkDownload({"error": 'action="ErrorDownload.aspx'}) + if check == "error": + self.fail("Error response received - contact Multihosters support") -- cgit v1.2.3