1
0
mirror of https://github.com/fHDHR/fHDHR_NextPVR.git synced 2025-12-06 11:36:59 -05:00
fHDHR_NextPVR/fHDHR/http/files/discover_json.py
deathbybandaid 24daf74b98 Upgrade Core
2020-11-09 10:11:50 -05:00

36 lines
1.4 KiB
Python

from flask import Response, request
import json
class Discover_JSON():
endpoints = ["/discover.json"]
endpoint_name = "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')