summaryrefslogtreecommitdiffstats
path: root/module
diff options
context:
space:
mode:
authorGravatar mkaay <mkaay@mkaay.de> 2009-12-21 19:19:28 +0100
committerGravatar mkaay <mkaay@mkaay.de> 2009-12-21 19:19:28 +0100
commit63d4273065f475719e63e5785abdbf11be43dae3 (patch)
tree7094a92d40bc7ab41028012b7825c1eaa5143692 /module
parentmerged Wugy, 2nd try (diff)
downloadpyload-63d4273065f475719e63e5785abdbf11be43dae3.tar.xz
reverted files, pyload.db fix
Diffstat (limited to 'module')
-rw-r--r--module/web/ServerThread.py10
-rw-r--r--module/web/ServerThread.py.orig27
-rw-r--r--module/web/pyload_default.db (renamed from module/web/pyload.db)bin44032 -> 44032 bytes
3 files changed, 7 insertions, 30 deletions
diff --git a/module/web/ServerThread.py b/module/web/ServerThread.py
index cebf0ce2f..2ac39c2c8 100644
--- a/module/web/ServerThread.py
+++ b/module/web/ServerThread.py
@@ -1,9 +1,11 @@
#!/usr/bin/env python
+from __future__ import with_statement
import threading
from os.path import join
from subprocess import Popen, PIPE, STDOUT
from time import sleep
from signal import SIGINT
+import os
class WebServer(threading.Thread):
def __init__(self, pycore):
@@ -16,13 +18,15 @@ class WebServer(threading.Thread):
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)
+ 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)
#os.system("python " + join(self.pycore.path,"module","web","manage.py runserver %s:%s" % (host,port)))
#@TODO: better would be real python code
+ sleep(1)
+ with open("webserver.pid", "r") as f:
+ self.pid = int(f.read().strip())
while self.running:
sleep(1)
def quit(self):
- self.p.terminate()
+ os.kill(self.pid, SIGINT)
self.running = False
-
diff --git a/module/web/ServerThread.py.orig b/module/web/ServerThread.py.orig
deleted file mode 100644
index d092f9348..000000000
--- a/module/web/ServerThread.py.orig
+++ /dev/null
@@ -1,27 +0,0 @@
-#!/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
diff --git a/module/web/pyload.db b/module/web/pyload_default.db
index e5e224850..cd39d0ca8 100644
--- a/module/web/pyload.db
+++ b/module/web/pyload_default.db
Binary files differ