summaryrefslogtreecommitdiffstats
path: root/module/network
diff options
context:
space:
mode:
authorGravatar mkaay <mkaay@mkaay.de> 2010-12-12 17:45:40 +0100
committerGravatar mkaay <mkaay@mkaay.de> 2010-12-12 17:45:40 +0100
commitddc6c0c15c132933e9676d563bad37288a3212f5 (patch)
treea5d6ecbcc4b96be9f8aead14262f3aa3ec69a5df /module/network
parentfixed progress when resuming (diff)
downloadpyload-ddc6c0c15c132933e9676d563bad37288a3212f5.tar.xz
universal progress (ex. unrar progress), link info now emits update event, updated .pot
Diffstat (limited to 'module/network')
-rw-r--r--module/network/FtpRequest.py12
-rwxr-xr-xmodule/network/Request.py8
-rw-r--r--module/network/XdccRequest.py1
3 files changed, 19 insertions, 2 deletions
diff --git a/module/network/FtpRequest.py b/module/network/FtpRequest.py
index d8f556fea..a0986a9ed 100644
--- a/module/network/FtpRequest.py
+++ b/module/network/FtpRequest.py
@@ -54,6 +54,7 @@ class FtpRequest:
self.averageSpeeds = []
self.averageSpeedTime = 0.0
self.averageSpeedCount = 0.0
+ self.progressNotify = None
self.speedLimitActive = False
self.maxSpeed = 0
@@ -219,8 +220,15 @@ class FtpRequest:
def progress(self, dl_t, dl_d, up_t, up_d):
if self.abort:
return False
- self.dl_arrived = int(dl_d)
- self.dl_size = int(dl_t)
+ self.dl_arrived = int(dl_d)+self.offset
+ self.dl_size = int(dl_t)+self.offset
+
+ if self.progressNotify:
+ try:
+ progress = int(float(self.dl_arrived)/self.dl_size*100)
+ self.progressNotify(progress)
+ except:
+ pass
def get_free_name(self, file_name):
file_count = 0
diff --git a/module/network/Request.py b/module/network/Request.py
index 3a3cd0f41..5314f97ab 100755
--- a/module/network/Request.py
+++ b/module/network/Request.py
@@ -63,6 +63,7 @@ class Request:
self.isSlow = False
self.cookieJar = None
self.interface = interface
+ self.progressNotify = None
# change this for connection information
self.debug = False
@@ -379,6 +380,13 @@ class Request:
self.dl_arrived = int(dl_d)+self.offset
self.dl_size = int(dl_t)+self.offset
+ if self.progressNotify:
+ try:
+ progress = int(float(self.dl_arrived)/self.dl_size*100)
+ self.progressNotify(progress)
+ except:
+ pass
+
def get_free_name(self, folder, file_name):
file_count = 0
file_name = join(folder, file_name)
diff --git a/module/network/XdccRequest.py b/module/network/XdccRequest.py
index b65398dbc..18378cc6f 100644
--- a/module/network/XdccRequest.py
+++ b/module/network/XdccRequest.py
@@ -70,6 +70,7 @@ class XdccRequest:
self.speedLimitActive = False
self.maxSpeed = 0
self.isSlow = False
+ self.progressNotify = None
# change this for connection information
self.debug = False