openwebrx-clone/owrx/details.py

31 lines
891 B
Python
Raw Permalink Normal View History

2020-05-10 15:27:46 +00:00
from owrx.config import Config
from owrx.locator import Locator
from owrx.property import PropertyFilter
from owrx.property.filter import ByPropertyName
import logging
logger = logging.getLogger(__name__)
2020-05-10 15:27:46 +00:00
class ReceiverDetails(PropertyFilter):
def __init__(self):
super().__init__(
Config.get(),
ByPropertyName(
"receiver_name",
"receiver_location",
"receiver_asl",
"receiver_gps",
"photo_title",
"photo_desc",
)
2020-05-10 15:27:46 +00:00
)
def __dict__(self):
receiver_info = super().__dict__()
try:
receiver_info["locator"] = Locator.fromCoordinates(receiver_info["receiver_gps"])
except ValueError as e:
logger.error("invalid receiver location, check in settings: %s", str(e))
2020-05-10 15:27:46 +00:00
return receiver_info