openwebrx/server.py

24 lines
651 B
Python
Raw Normal View History

2019-05-03 22:59:24 +02:00
from http.server import HTTPServer
from owrx.http import RequestHandler
2019-05-04 16:56:23 +02:00
from owrx.config import PropertyManager
2019-05-04 20:26:11 +02:00
from owrx.source import RtlNmuxSource, SpectrumThread
from socketserver import ThreadingMixIn
2019-05-04 16:56:23 +02:00
2019-05-04 20:26:11 +02:00
class ThreadedHttpServer(ThreadingMixIn, HTTPServer):
pass
2019-05-03 22:59:24 +02:00
2019-05-04 20:26:11 +02:00
def main():
cfg=__import__("config_webrx")
pm = PropertyManager.getSharedInstance()
for name, value in cfg.__dict__.items():
if (name.startswith("__")): continue
pm.getProperty(name).setValue(value)
2019-05-03 22:59:24 +02:00
2019-05-04 20:26:11 +02:00
RtlNmuxSource()
server = ThreadedHttpServer(('0.0.0.0', 3000), RequestHandler)
server.serve_forever()
if __name__=="__main__":
main()