refactor the sdr.hu updater into the new server, too

This commit is contained in:
Jakob Ketterl
2019-05-12 14:35:25 +02:00
parent 697e177f00
commit 210fe5352f
4 changed files with 64 additions and 31 deletions

View File

@ -3,6 +3,7 @@ from owrx.http import RequestHandler
from owrx.config import PropertyManager, FeatureDetector
from owrx.source import SdrService
from socketserver import ThreadingMixIn
from owrx.sdrhu import SdrHuUpdater
import logging
logging.basicConfig(level = logging.DEBUG, format = "%(asctime)s - %(name)s - %(levelname)s - %(message)s")
@ -22,12 +23,7 @@ Author contact info: Andras Retzler, HA7ILM <randras@sdr.hu>
""")
cfg = __import__("config_webrx")
pm = PropertyManager.getSharedInstance()
for name, value in cfg.__dict__.items():
if name.startswith("__"):
continue
pm[name] = value
pm = PropertyManager.getSharedInstance().loadConfig("config_webrx")
featureDetector = FeatureDetector()
if not featureDetector.is_available("core"):
@ -39,6 +35,10 @@ Author contact info: Andras Retzler, HA7ILM <randras@sdr.hu>
# Get error messages about unknown / unavailable features as soon as possible
SdrService.loadProps()
if "sdrhu_key" in pm and pm["sdrhu_public_listing"]:
updater = SdrHuUpdater()
updater.start()
server = ThreadedHttpServer(('0.0.0.0', pm.getPropertyValue("web_port")), RequestHandler)
server.serve_forever()