summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Jeix <devnull@localhost> 2010-11-05 16:13:51 +0100
committerGravatar Jeix <devnull@localhost> 2010-11-05 16:13:51 +0100
commit77d436bb07eb4cf8ede5a9ec3c3bbdb4f2186602 (patch)
tree581071381ac07229c3abd19d2cc4d90c4f043b9e
parentfiles.mail.ru improvement (diff)
downloadpyload-77d436bb07eb4cf8ede5a9ec3c3bbdb4f2186602.tar.xz
small fixes: progess view in gui,xdcc,shareonline
-rw-r--r--module/gui/Queue.py2
-rw-r--r--module/network/FtpRequest.py5
-rw-r--r--module/network/XdccRequest.py14
-rw-r--r--module/plugins/hoster/ShareonlineBiz.py8
-rw-r--r--module/plugins/hoster/Xdcc.py6
5 files changed, 15 insertions, 20 deletions
diff --git a/module/gui/Queue.py b/module/gui/Queue.py
index 1bfd23af1..5489f85ce 100644
--- a/module/gui/Queue.py
+++ b/module/gui/Queue.py
@@ -106,6 +106,8 @@ class QueueModel(CollectorModel):
since = float(since)
max_wait = float(until-since)
rest = int(until-time())
+ if rest < 0:
+ return 0, None
res = 100/max_wait
perc = rest*res
return perc, rest
diff --git a/module/network/FtpRequest.py b/module/network/FtpRequest.py
index fb2e6246e..d8f556fea 100644
--- a/module/network/FtpRequest.py
+++ b/module/network/FtpRequest.py
@@ -27,8 +27,7 @@ from os.path import exists
from cStringIO import StringIO
import pycurl
-class AbortDownload(Exception):
- pass
+from module.plugins.Plugin import Abort
class FtpRequest:
def __init__(self, interface=None):
@@ -161,7 +160,7 @@ class FtpRequest:
self.fp.close()
if self.abort:
- raise AbortDownload
+ raise Abort
free_name = self.get_free_name(file_name)
rename(file_temp, free_name)
diff --git a/module/network/XdccRequest.py b/module/network/XdccRequest.py
index dec71adf7..b65398dbc 100644
--- a/module/network/XdccRequest.py
+++ b/module/network/XdccRequest.py
@@ -23,14 +23,12 @@
import time
import socket
-from select import select
import re
from os import rename
from os.path import exists
import struct
-class AbortDownload(Exception):
- pass
+from module.plugins.Plugin import Abort
class IRCError(Exception):
def __init__(self, value):
@@ -121,7 +119,7 @@ class XdccRequest:
# connect to XDCC Bot
- dcc = socket.socket()
+ dcc = socket.socket()
dcc.connect((ip, port))
dcc_packname = self.get_free_name(location + '\\' + name)
dcc_fpointer = open(dcc_packname + ".part", "wb")
@@ -132,14 +130,10 @@ class XdccRequest:
if self.abort:
dcc.close()
dcc_fpointer.close()
- raise AbortDownload
-
- fdset = select([dcc], [], [], 0)
- if dcc not in fdset[0]:
- continue
+ raise Abort
# recv something
- recvbytes = dcc.recv(2**14)
+ recvbytes = dcc.recv(4096)
# connection closed and everything received -> reset variables
if len(recvbytes) == 0:
diff --git a/module/plugins/hoster/ShareonlineBiz.py b/module/plugins/hoster/ShareonlineBiz.py
index 95cedc140..1204c1ed8 100644
--- a/module/plugins/hoster/ShareonlineBiz.py
+++ b/module/plugins/hoster/ShareonlineBiz.py
@@ -76,22 +76,22 @@ class ShareonlineBiz(Hoster):
def downloadHTML(self):
self.html = self.load(self.pyfile.url, cookies=True)
if not self.account:
- html = self.load("%s/free/" % self.pyfile.url, post={"dl_free":"1"}, cookies=True)
+ self.html = self.load("%s/free/" % self.pyfile.url, post={"dl_free":"1"}, cookies=True)
if re.search(r"/failure/full/1", self.req.lastEffectiveURL):
self.setWait(120)
self.log.info("%s: no free slots, waiting 120 seconds" % (self.__name__))
self.wait()
self.retry()
- if "Captcha number error or expired" in html:
+ if "Captcha number error or expired" in self.html:
captcha = self.decryptCaptcha("http://www.share-online.biz/captcha.php", get={"rand":"0.%s" % random.randint(10**15,10**16)}, cookies=True)
self.log.debug("%s Captcha: %s" % (self.__name__, captcha))
sleep(3)
- html = self.load(self.pyfile.url, post={"captchacode": captcha}, cookies=True)
+ self.html = self.load(self.pyfile.url, post={"captchacode": captcha}, cookies=True)
- if r"Der Download ist Ihnen zu langsam" not in html and r"The download is too slow for you" not in html:
+ if r"Der Download ist Ihnen zu langsam" not in self.html and r"The download is too slow for you" not in self.html:
self.fail("Plugin defect. Save dumps and report.")
m = re.search("var timeout='(\d+)';", self.html[1])
diff --git a/module/plugins/hoster/Xdcc.py b/module/plugins/hoster/Xdcc.py
index e0f5c38cc..3e68c7289 100644
--- a/module/plugins/hoster/Xdcc.py
+++ b/module/plugins/hoster/Xdcc.py
@@ -204,14 +204,14 @@ class Xdcc(Hoster):
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.log.info("XDCC: Downloading %s from %s:%d" % (packname, ip, port))
self.pyfile.setStatus("downloading")
- newname = self.req.download(host, port, location, packname)
+ newname = self.req.download(ip, port, location, packname)
self.pyfile.size = self.req.dl_size
# kill IRC socket
- sock.send("QUIT :byebye\r\n")
+ # sock.send("QUIT :byebye\r\n")
sock.close()
if newname: