2020-05-10 15:27:46 +00:00
|
|
|
from owrx.config import Config
|
|
|
|
from owrx.locator import Locator
|
|
|
|
from owrx.property import PropertyFilter
|
2021-02-23 23:09:57 +00:00
|
|
|
from owrx.property.filter import ByPropertyName
|
2021-09-30 21:03:21 +00:00
|
|
|
import logging
|
|
|
|
|
|
|
|
logger = logging.getLogger(__name__)
|
2020-05-10 15:27:46 +00:00
|
|
|
|
|
|
|
|
|
|
|
class ReceiverDetails(PropertyFilter):
|
|
|
|
def __init__(self):
|
|
|
|
super().__init__(
|
|
|
|
Config.get(),
|
2021-02-23 23:09:57 +00:00
|
|
|
ByPropertyName(
|
|
|
|
"receiver_name",
|
|
|
|
"receiver_location",
|
|
|
|
"receiver_asl",
|
|
|
|
"receiver_gps",
|
|
|
|
"photo_title",
|
|
|
|
"photo_desc",
|
2023-01-05 03:12:28 +00:00
|
|
|
"usage_policy_url",
|
|
|
|
"session_timeout",
|
2021-02-23 23:09:57 +00:00
|
|
|
)
|
2020-05-10 15:27:46 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
def __dict__(self):
|
|
|
|
receiver_info = super().__dict__()
|
2021-09-30 21:03:21 +00:00
|
|
|
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
|