Ivars 5 years ago
parent
commit
9d2c15f05d
1 changed files with 8 additions and 4 deletions
  1. 8
    4
      playstreamproxy.py

+ 8
- 4
playstreamproxy.py View File

297
 class ThreadedHTTPServer(ThreadingMixIn, HTTPServer):
297
 class ThreadedHTTPServer(ThreadingMixIn, HTTPServer):
298
     """Handle requests in a separate thread."""
298
     """Handle requests in a separate thread."""
299
 
299
 
300
-def start(host = HOST_NAME, port = PORT_NUMBER, redirect=REDIRECT):
301
-    global REDIRECT
300
+def start(host = HOST_NAME, port = PORT_NUMBER, key=KEY, redirect=REDIRECT):
301
+    global REDIRECT,KEY
302
     if redirect:
302
     if redirect:
303
         REDIRECT = redirect
303
         REDIRECT = redirect
304
+    if key:
305
+        KEY = key
304
     httpd = ThreadedHTTPServer((host, port), StreamHandler)
306
     httpd = ThreadedHTTPServer((host, port), StreamHandler)
305
     print time.asctime(), "Server Starts - %s:%s" % (HOST_NAME, PORT_NUMBER)
307
     print time.asctime(), "Server Starts - %s:%s" % (HOST_NAME, PORT_NUMBER)
306
     try:
308
     try:
310
     httpd.server_close()
312
     httpd.server_close()
311
     print time.asctime(), "Server Stops - %s:%s" % (HOST_NAME, PORT_NUMBER)
313
     print time.asctime(), "Server Stops - %s:%s" % (HOST_NAME, PORT_NUMBER)
312
 
314
 
313
-def start2(host = HOST_NAME, port = PORT_NUMBER, redirect=REDIRECT,workers=WORKERS):
314
-    global REDIRECT
315
+def start2(host = HOST_NAME, port = PORT_NUMBER, redirect=REDIRECT, key=KEY, workers=WORKERS):
316
+    global REDIRECT,KEY
315
     if redirect:
317
     if redirect:
316
         REDIRECT = redirect
318
         REDIRECT = redirect
319
+    if key:
320
+        KEY = key
317
 
321
 
318
     print time.asctime(), "Server Starts - %s:%s" % (host, port)
322
     print time.asctime(), "Server Starts - %s:%s" % (host, port)
319
     addr = ('', port)
323
     addr = ('', port)