From eb642efc03065f9f2b7a6d867b5c3034fdadc5df Mon Sep 17 00:00:00 2001 From: Jeix Date: Fri, 29 Oct 2010 16:29:01 +0200 Subject: closed #168 --- module/plugins/hoster/HotfileCom.py | 2 +- module/plugins/hoster/ShareCx.py | 4 ++-- module/plugins/hoster/Xdcc.py | 47 +++++++++++++++++++++++++++---------- 3 files changed, 38 insertions(+), 15 deletions(-) (limited to 'module/plugins') diff --git a/module/plugins/hoster/HotfileCom.py b/module/plugins/hoster/HotfileCom.py index 7e576cb61..228f31649 100644 --- a/module/plugins/hoster/HotfileCom.py +++ b/module/plugins/hoster/HotfileCom.py @@ -33,7 +33,7 @@ def getInfo(urls): class HotfileCom(Hoster): __name__ = "HotfileCom" __type__ = "hoster" - __pattern__ = r"http://(www.)?hotfile\.com/dl/\d+/.*" + __pattern__ = r"http://(www.)?hotfile\.com/dl/\d+/[0-9a-zA-Z]+/" __version__ = "0.3" __description__ = """Hotfile.com Download Hoster""" __author_name__ = ("sitacuisses","spoob","mkaay") diff --git a/module/plugins/hoster/ShareCx.py b/module/plugins/hoster/ShareCx.py index adebb1c77..2615c6e11 100644 --- a/module/plugins/hoster/ShareCx.py +++ b/module/plugins/hoster/ShareCx.py @@ -80,8 +80,7 @@ class ShareCx(Hoster): "referer" : referer, "method_free" : method_free }) - - + m = re.search(r'startTimer\((\d+)\)', self.html) if m is not None: wait_time = int(m.group(1)) @@ -89,6 +88,7 @@ class ShareCx(Hoster): self.wantReconnect = True self.log.debug("%s: IP blocked wait %d seconds." % (self.__name__, wait_time)) self.wait() + self.retry() m = re.search(r'countdown">.*?(\d+).*?', self.html) if m is None: diff --git a/module/plugins/hoster/Xdcc.py b/module/plugins/hoster/Xdcc.py index d04d65857..e0f5c38cc 100644 --- a/module/plugins/hoster/Xdcc.py +++ b/module/plugins/hoster/Xdcc.py @@ -46,13 +46,33 @@ class Xdcc(Hoster): __author_mail__ = ("jeix@hasnomail.com") def setup(self): - self.debug = 0#2 #0,1,2 + self.debug = 0 #0,1,2 self.timeout = 10 self.multiDL = False def process(self, pyfile): - self.req = pyfile.m.core.requestFactory.getRequest(self.__name__, type="XDCC") - self.doDownload(pyfile.url) + self.pyfile = pyfile + self.req = pyfile.m.core.requestFactory.getRequest(self.__name__, type="XDCC") + for i in range(0,3): + try: + self.doDownload(pyfile.url) + return + except socket.error, e: + if hasattr(e, "errno"): + errno = e.errno + else: + errno = e.args[0] + + if errno in (10054,): + self.log.debug("XDCC: Server blocked our ip, retry in 5 min") + self.setWait(300) + self.wait() + continue + + self.fail("Failed due to socket errors. Code: %d" % errno) + + self.fail("Server blocked our ip, retry again later manually") + def doDownload(self, url): self.pyfile.setStatus("waiting") # real link @@ -91,7 +111,7 @@ class Xdcc(Hoster): nick = "pyload-%d" % (time.time() % 1000) # last 3 digits sock.send("NICK %s\r\n" % nick) sock.send("USER %s %s bla :%s\r\n" % (ident, host, real)) - + time.sleep(3) sock.send("JOIN #%s\r\n" % chan) sock.send("PRIVMSG %s :xdcc send #%s\r\n" % (bot, pack)) @@ -103,17 +123,19 @@ class Xdcc(Hoster): # done is set if we got our real link if done: break - if not retry: - if dl_time + self.timeout < time.time(): # todo: add in config + if retry: + if time.time() > retry: + retry = None + dl_time = time.time() + sock.send("PRIVMSG %s :xdcc send #%s\r\n" % (bot, pack)) + + else: + if (dl_time + self.timeout) < time.time(): # todo: add in config sock.send("QUIT :byebye\r\n") sock.close() self.fail("XDCC Bot did not answer") - - if time.time() > retry: - retry = None - dl_time = time.time() - sock.send("PRIVMSG %s :xdcc send #%s\r\n" % (bot, pack)) - + + fdset = select([sock], [], [], 0) if sock not in fdset[0]: continue @@ -181,6 +203,7 @@ class Xdcc(Hoster): if len(m.groups()) > 3: self.req.dl_size = int(m.group(4)) + self.pyfile.name = packname self.log.debug("XDCC: Downloading %s from %s:%d" % (packname, ip, port)) self.pyfile.setStatus("downloading") -- cgit v1.2.3