summaryrefslogtreecommitdiffstats
path: root/pyLoadCore.py
diff options
context:
space:
mode:
authorGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2009-06-26 11:37:44 +0200
committerGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2009-06-26 11:37:44 +0200
commite260b201f94a2a1e470b85a6499ea70e20a11277 (patch)
tree356dc9f5a7d8ef14cf6befb8cfa324b991571a0c /pyLoadCore.py
parentfixed occasionally appearing cli bug, catpcha method for sharebiz @ ~60% (diff)
downloadpyload-e260b201f94a2a1e470b85a6499ea70e20a11277.tar.xz
Cli stable, able to abort downloads, pause/kill server
Diffstat (limited to 'pyLoadCore.py')
-rw-r--r--pyLoadCore.py18
1 files changed, 17 insertions, 1 deletions
diff --git a/pyLoadCore.py b/pyLoadCore.py
index e9d933dc6..3f45ca332 100644
--- a/pyLoadCore.py
+++ b/pyLoadCore.py
@@ -50,6 +50,8 @@ class Core(object):
self.read_config()
+ self.do_kill = False
+
translation = gettext.translation("pyLoad", "locale", languages=[self.config['language']])
translation.install(unicode=True)
@@ -219,6 +221,7 @@ class Core(object):
self._test_print_status()
self.server_test()
sleep(2)
+ if self.do_kill: exit()
def server_test(self):
obj = RequestObject()
@@ -238,12 +241,17 @@ class Core(object):
self.server.start()
def kill(self):
+ self.do_kill = True
exit()
+ return True
def shutdown(self):
-
+ "abort all downloads and exit"
self.thread_list.pause = True
+ for pyfile in self.thread_list.py_downloading:
+ pyfile.plugin.req.abort = True
+
while self.thread_list.py_downloading:
sleep(1)
@@ -261,6 +269,14 @@ class Core(object):
def get_links(self):
return self.file_list.data
+ def toggle_pause(self):
+ if self.thread_list.pause:
+ self.thread_list.pause = False
+ return False
+ elif not self.thread_list.pause:
+ self.thread_list.pause = True
+ return True
+
if __name__ == "__main__":
testLoader = Core()
testLoader.start()