From 0131a041de6ff942c065e967092474ed1ba527bb Mon Sep 17 00:00:00 2001 From: brettlangdon Date: Fri, 1 Mar 2024 15:47:48 -0500 Subject: [PATCH] discover: allow customizing the device id and friendly name This is useful if you need to run multiple servers --- src/dlhdhr/app.py | 6 +++--- src/dlhdhr/config.py | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/dlhdhr/app.py b/src/dlhdhr/app.py index 9b94bf6..a52a8c3 100644 --- a/src/dlhdhr/app.py +++ b/src/dlhdhr/app.py @@ -108,14 +108,14 @@ async def discover_json(request: Request) -> JSONResponse: return JSONResponse( { - "FriendlyName": "dlhdhomerun", - "Manufacturer": "dlhdhomerun - Silicondust", + "FriendlyName": config.DLHD_FRIENDLY_NAME, + "Manufacturer": "dlhdhomerun", "ManufacturerURL": "https://c653labs.com/", "ModelNumber": "HDTC-2US", "FirmwareName": "hdhomeruntc_atsc", "TunerCount": tuners.total_available_listeners, "FirmwareVersion": "20170930", - "DeviceID": "dlhdhomerun", + "DeviceID": config.DLHD_DEVICE_ID, "DeviceAuth": "", "BaseURL": get_public_url(request, "/"), "LineupURL": get_public_url(request, "/lineup.json"), diff --git a/src/dlhdhr/config.py b/src/dlhdhr/config.py index a2276cb..16c58b5 100644 --- a/src/dlhdhr/config.py +++ b/src/dlhdhr/config.py @@ -14,6 +14,8 @@ PORT: int = int(os.getenv("DLHDHR_PORT", 8000)) DEBUG: bool = os.getenv("DLHDHR_DEBUG", "0").lower() in ("1", "true") DLHD_BASE_URL = os.getenv("DLHD_BASE_URL", "https://dlhd.sx/") +DLHD_DEVICE_ID = os.getenv("DLHD_DEVICE_ID", "dlhdhr") +DLHD_FRIENDLY_NAME = os.getenv("DLHD_FRIENDLY_NAME", "dlhdhr") CHANNEL_EXCLUDE: set[str] | None = _set_or_none("DLHDHR_CHANNEL_EXCLUDE") CHANNEL_ALLOW: set[str] | None = _set_or_none("DLHDHR_CHANNEL_ALLOW")