diff options
author | sebnapi <devnull@localhost> | 2009-05-10 18:59:47 +0200 |
---|---|---|
committer | sebnapi <devnull@localhost> | 2009-05-10 18:59:47 +0200 |
commit | 5d03d9e7c797dede08b5b0e989688237fcf9e3f0 (patch) | |
tree | ce6c4430d0732f79716757cb01eb5d9ef80adeec | |
parent | ordnung muss sein (diff) | |
download | pyload-5d03d9e7c797dede08b5b0e989688237fcf9e3f0.tar.xz |
Approach for Plugindesign
-rw-r--r-- | Core.py | 14 | ||||
-rw-r--r-- | download_thread.py | 20 | ||||
-rw-r--r-- | thread_list.py | 2 |
3 files changed, 6 insertions, 30 deletions
@@ -34,19 +34,9 @@ from time import sleep #my imports from download_thread import Download_Thread from thread_list import Thread_List +from Py_Load_File import PyLoadFile -basicConfig(filename='Logs/faild.txt', format = '%(message)s') - -class PyLoadFile: - """ represents the url or file - """ - def __init__(self, plugin, plugin_name, url): - self.id = None - self.plugin_name = plugin_name - self.plugin = plugin - self.url = url - self.download_folder = "" - self.status = None +basicConfig(filename='Logs/faild.txt', format = '%(message)s') class Core(object): """ pyLoad main diff --git a/download_thread.py b/download_thread.py index 53ee70656..ee4d4deca 100644 --- a/download_thread.py +++ b/download_thread.py @@ -35,11 +35,10 @@ class Status(object): self.expected_time = 0 self.filename = None self.url = None - self.type = None - self.start = time() - self.last_status = time() def __call__(self, blocks_read, block_size, total_size): + 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 @@ -50,19 +49,8 @@ class Status(object): if self.last_status+0.2 < time(): self.status_queue.put(copy(self)) self.last_status = time() - - #def set_total_kb(total_kb): - #self.total_kb = total_kb - - #def set_downloaded_kb(downloaded_kb): - #self.downloaded_kb = downloaded_kb - - #def set_rate(rate): - #self.rate = rate - - #def set_expected_time(expected_time): - #self.expected_time = expected_time - + + class Download_Thread(threading.Thread): def __init__(self, parent): threading.Thread.__init__(self) diff --git a/thread_list.py b/thread_list.py index 427c0a080..0dd61ec7a 100644 --- a/thread_list.py +++ b/thread_list.py @@ -32,7 +32,6 @@ class Thread_List(object): self.download_queue = Queue() self.status_queue = Queue() self.f_relation = [0,0] - #self.lock = threading.Lock() def create_thread(self): """ creates thread for Py_Load_File and append thread to self.threads @@ -49,7 +48,6 @@ class Thread_List(object): return loaded_urls def remove_thread(self, thread): - #self.lock.acquire() self.threads.remove(thread) def status(self): |