summaryrefslogtreecommitdiffstats
path: root/module
diff options
context:
space:
mode:
authorGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2009-05-27 15:06:25 +0200
committerGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2009-05-27 15:06:25 +0200
commitbe06c8376a8543c0cf7c1ef5f115d1dbbb26d08f (patch)
tree9888c763c35de23ec395c54b861e2ac3a23de1bf /module
parentfixed strange setFossrmatter bug (diff)
downloadpyload-be06c8376a8543c0cf7c1ef5f115d1dbbb26d08f.tar.xz
little fixes
Diffstat (limited to 'module')
-rw-r--r--module/Py_Load_File.py1
-rw-r--r--module/download_thread.py36
-rwxr-xr-xmodule/network/Request.py5
-rw-r--r--module/thread_list.py9
4 files changed, 28 insertions, 23 deletions
diff --git a/module/Py_Load_File.py b/module/Py_Load_File.py
index ce2a10924..ecfded6fd 100644
--- a/module/Py_Load_File.py
+++ b/module/Py_Load_File.py
@@ -13,7 +13,6 @@ class PyLoadFile:
self.modul = __import__(self._get_my_plugin()) #maybe replace to prepare download
pluginClass = getattr(self.modul, self.modul.__name__)
self.plugin = pluginClass(self)
- self.download_folder = ""
self.status = Status(self)
def _get_my_plugin(self):
diff --git a/module/download_thread.py b/module/download_thread.py
index 96bc4dd34..8e90fb51f 100644
--- a/module/download_thread.py
+++ b/module/download_thread.py
@@ -21,7 +21,6 @@
import threading
from time import time, sleep
from copy import copy
-import urllib
class Status(object):
@@ -41,22 +40,22 @@ class Status(object):
self.waituntil = None
self.want_reconnect = None
- def __call__(self, blocks_read, block_size, total_size):
- if self.status_queue == None:
- return False
- self.start = time()
- self.last_status = time()
- self.total_kb = total_size / 1024
- self.downloaded_kb = (blocks_read * block_size) / 1024
- elapsed_time = time() - self.start
- if elapsed_time != 0:
- self.rate = self.downloaded_kb / elapsed_time
- if self.rate != 0:
- self.expected_time = self.downloaded_kb / self.rate
- if self.last_status+0.2 < time():
- self.status_queue.put(copy(self))
- self.last_status = time()
-
+# def __call__(self, blocks_read, block_size, total_size):
+# if self.status_queue == None:
+# return False
+# self.start = time()
+# self.last_status = time()
+# self.total_kb = total_size / 1024
+# self.downloaded_kb = (blocks_read * block_size) / 1024
+# elapsed_time = time() - self.start
+# if elapsed_time != 0:
+# self.rate = self.downloaded_kb / elapsed_time
+# if self.rate != 0:
+# self.expected_time = self.downloaded_kb / self.rate
+# if self.last_status+0.2 < time():
+# self.status_queue.put(copy(self))
+# self.last_status = time()
+#
def set_status_queue(self, queue):
self.status_queue = queue
@@ -106,6 +105,9 @@ class Download_Thread(threading.Thread):
print "handle reconnect"
while (time() < status.waituntil):
+ if status.want_reconnect and self.reconnected:
+ status = "reconnected"
+ return False
status.type = "waiting"
sleep(1) #eventuell auf genaue zeit warten
diff --git a/module/network/Request.py b/module/network/Request.py
index 1b94ed13f..07c1769ec 100755
--- a/module/network/Request.py
+++ b/module/network/Request.py
@@ -6,7 +6,6 @@ authored by: RaNaN
import urllib
import urllib2
import cookielib
-import Keepalive
import base64
import time
@@ -112,13 +111,13 @@ class Request:
try:
return (self.dl_arrived / ((time.time() if self.dl else self.dl_finished) - self.dl_time )) / 1024
except:
- return "No Download"
+ return 0
def get_ETA(self):
try:
return (self.dl_size - self.dl_arrived) / (self.dl_arrived / (time.time() - self.dl_time))
except:
- return "No Download"
+ return 0
def kB_left(self):
return (self.dl_size - self.dl_arrived) / 1024
diff --git a/module/thread_list.py b/module/thread_list.py
index 065318a56..7031b166e 100644
--- a/module/thread_list.py
+++ b/module/thread_list.py
@@ -18,6 +18,10 @@
#
###
#python
+import time
+import urllib2
+import re
+import subprocess
from Queue import Queue
from threading import Lock
#my
@@ -111,8 +115,9 @@ class Thread_List(object):
self.f_relation[1] += 1
self.select_thread()
- def reconnect():
- reconn = subprocess.Popen(reconnectMethod)
+ def reconnect(self):
+ self.parent.logger.debug("reconnect")
+ reconn = subprocess.Popen(self.parent.config['reconnectMethod'])
reconn.wait()
ip = re.match(".*Current IP Address: (.*)</body>.*", urllib2.urlopen("http://checkip.dyndns.org/").read()).group(1) #versuchen neue ip aus zu lesen
while ip == "": #solange versuch bis neue ip ausgelesen