fHDHR_NewsON/fHDHR/http/files/discover_json.py
deathbybandaid 8c5cd7371f first commit
2020-11-27 15:27:23 -05:00

36 lines
1.4 KiB
Python

from flask import Response, request
import json
class Discover_JSON():
endpoints = ["/discover.json"]
endpoint_name = "file_discover_json"
def __init__(self, fhdhr):
self.fhdhr = fhdhr
def __call__(self, *args):
return self.get(*args)
def get(self, *args):
base_url = request.url_root[:-1]
jsondiscover = {
"FriendlyName": self.fhdhr.config.dict["fhdhr"]["friendlyname"],
"Manufacturer": self.fhdhr.config.dict["fhdhr"]["reporting_manufacturer"],
"ModelNumber": self.fhdhr.config.dict["fhdhr"]["reporting_model"],
"FirmwareName": self.fhdhr.config.dict["fhdhr"]["reporting_firmware_name"],
"TunerCount": self.fhdhr.config.dict["fhdhr"]["tuner_count"],
"FirmwareVersion": self.fhdhr.config.dict["fhdhr"]["reporting_firmware_ver"],
"DeviceID": self.fhdhr.config.dict["main"]["uuid"],
"DeviceAuth": self.fhdhr.config.dict["fhdhr"]["device_auth"],
"BaseURL": base_url,
"LineupURL": base_url + "/lineup.json"
}
discover_json = json.dumps(jsondiscover, indent=4)
return Response(status=200,
response=discover_json,
mimetype='application/json')