summaryrefslogtreecommitdiffstats
path: root/module/web/ServerThread.py.orig
diff options
context:
space:
mode:
authorGravatar Wugy <wugy@mally-soft.com> 2009-12-21 18:15:56 +0100
committerGravatar Wugy <wugy@mally-soft.com> 2009-12-21 18:15:56 +0100
commit7dd0c96037b0f91f761126d20e477e0e83e20825 (patch)
treed4cc7baa4e3fea8306a8ae79d2f726a226de7f78 /module/web/ServerThread.py.orig
parentpause/start button works (diff)
downloadpyload-7dd0c96037b0f91f761126d20e477e0e83e20825.tar.xz
total progressbar bullshit
Diffstat (limited to 'module/web/ServerThread.py.orig')
-rw-r--r--module/web/ServerThread.py.orig27
1 files changed, 27 insertions, 0 deletions
diff --git a/module/web/ServerThread.py.orig b/module/web/ServerThread.py.orig
new file mode 100644
index 000000000..d092f9348
--- /dev/null
+++ b/module/web/ServerThread.py.orig
@@ -0,0 +1,27 @@
+#!/usr/bin/env python
+import threading
+from os.path import join
+from subprocess import Popen, PIPE, STDOUT
+from time import sleep
+from signal import SIGINT
+
+class WebServer(threading.Thread):
+ def __init__(self, pycore):
+ threading.Thread.__init__(self)
+ self.pycore = pycore
+ self.running = True
+ self.setDaemon(True)
+
+ def run(self):
+ host = self.pycore.config['webinterface']['host']
+ port = self.pycore.config['webinterface']['port']
+ self.pycore.logger.info("Starting Webserver: %s:%s" % (host,port) )
+ self.p = Popen(['python',join(self.pycore.path,"module","web","manage.py"), "runserver", "%s:%s" % (host,port)], close_fds=True, stderr=PIPE, stdin=PIPE, stdout=PIPE, shell=False)
+ #os.system("python " + join(self.pycore.path,"module","web","manage.py runserver %s:%s" % (host,port)))
+ #@TODO: better would be real python code
+ while self.running:
+ sleep(1)
+
+ def quit(self):
+ self.p.terminate()
+ self.running = False