summaryrefslogtreecommitdiffstats
path: root/module
diff options
context:
space:
mode:
Diffstat (limited to 'module')
-rw-r--r--module/Py_Load_File.py3
-rw-r--r--module/file_list.py63
-rw-r--r--module/thread_list.py14
3 files changed, 71 insertions, 9 deletions
diff --git a/module/Py_Load_File.py b/module/Py_Load_File.py
index cbbc5ab6b..2bc6d4965 100644
--- a/module/Py_Load_File.py
+++ b/module/Py_Load_File.py
@@ -33,10 +33,11 @@ class PyLoadFile:
if self.parent.config['useproxy']:
self.plugin.req.add_proxy(self.parent.config['proxyprotocol'], self.parent.config['proxyadress'])
+ self.plugin.want_reconnect = False
self.status.exists = self.plugin.file_exists()
if self.status.exists:
self.status.filename = self.plugin.get_file_name()
self.status.waituntil = self.plugin.time_plus_wait
self.status.url = self.plugin.get_file_url()
- self.status.want_reconnect = self.plugin.want_reconnect \ No newline at end of file
+ self.status.want_reconnect = self.plugin.want_reconnect
diff --git a/module/file_list.py b/module/file_list.py
new file mode 100644
index 000000000..932fb0b13
--- /dev/null
+++ b/module/file_list.py
@@ -0,0 +1,63 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+#
+#Copyright (C) 2009 RaNaN
+#
+#This program is free software; you can redistribute it and/or modify
+#it under the terms of the GNU General Public License as published by
+#the Free Software Foundation; either version 3 of the License,
+#or (at your option) any later version.
+#
+#This program is distributed in the hope that it will be useful,
+#but WITHOUT ANY WARRANTY; without even the implied warranty of
+#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+#See the GNU General Public License for more details.
+#
+#You should have received a copy of the GNU General Public License
+# along with this program; if not, see <http://www.gnu.org/licenses/>.
+#
+###
+
+LIST_VERSION = 1
+
+import cPickle
+from Py_Load_File import PyLoadFile
+
+class File_List(object):
+ def __init__(self):
+ self.version = LIST_VERSION
+ self.files = []
+ self.id = 0
+
+ def set_core(self, core):
+ self.core = core
+
+ def new_pyfile(self)
+ pyfile = PyLoadFile(self, url)
+ pyfile.download_folder = self.core.config['download_folder']
+ pyfile.id = self.id
+ self.id += 1
+
+ return pyfile
+
+ def append(self, url):
+ self.links.append(url)
+
+ def save(self):
+ output = open('links.pkl', 'wb')
+ cPickle.dump(self, output, -1)
+
+
+def load(core):
+ try:
+ pkl_file = open('links.pkl', 'rb')
+ obj = cPickle.load(pkl_file)
+ except:
+ obj = File_List()
+
+ if obj.version < LIST_VERSION:
+ obj = File_List()
+
+ obj.set_core(core)
+
+ return obj
diff --git a/module/thread_list.py b/module/thread_list.py
index 615c39243..a7e92b77d 100644
--- a/module/thread_list.py
+++ b/module/thread_list.py
@@ -1,7 +1,7 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
-#Copyright (C) 2009 sp00b, sebnapi
+#Copyright (C) 2009 sp00b, sebnapi, RaNaN
#
#This program is free software; you can redistribute it and/or modify
#it under the terms of the GNU General Public License as published by
@@ -41,13 +41,14 @@ class Thread_List(object):
self.pause = False
self.reconnecting = False
+ self.select_thread()
+
def create_thread(self):
""" creates thread for Py_Load_File and append thread to self.threads
"""
- if self.py_load_files:
- thread = Download_Thread(self)
- self.threads.append(thread)
- return True
+ thread = Download_Thread(self)
+ self.threads.append(thread)
+ return True
def get_loaded_urls(self):
loaded_urls = []
@@ -130,9 +131,6 @@ class Thread_List(object):
self.lock.release()
return True
- def extend_py_load_files(self):
- pass
-
def select_thread(self):
""" select a thread
"""