From 7eeb7124b531da4952f99a157c0db3f393da9ca5 Mon Sep 17 00:00:00 2001 From: "E.Smith" <31170571+azlm8t@users.noreply.github.com> Date: Thu, 11 Jun 2020 21:55:44 +0100 Subject: [PATCH 5/7] hdhomerun: Add lineup_status.json API. This is needed for Plex to communicate. --- src/webui/webui.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/webui/webui.c b/src/webui/webui.c index 3eb4dfe95..ee8385e2b 100644 --- a/src/webui/webui.c +++ b/src/webui/webui.c @@ -1724,6 +1724,28 @@ hdhomerun_server_lineup(http_connection_t *hc, const char *remain, void *opaque) return 0; } + +static int +hdhomerun_server_lineup_status(http_connection_t *hc, const char *remain, void *opaque) +{ + const char *hdhr_user = config.hdhomerun_server_username ?: ""; + access_t *perm = access_get_by_username(hdhr_user); + htsbuf_queue_t *hq; + + if (access_verify2(perm, ACCESS_STREAMING)) { + access_destroy(perm); + return http_noaccess_code(hc); + } + hq = &hc->hc_reply; + /* The contents below for the discovery message are based on the forum. */ + htsbuf_append_str(hq, "{\"ScanInProgress\":0,\"ScanPossible\":1,\"Source\":\"Antenna\",\"SourceList\":[\"Antenna\"]}"); + http_output_content(hc, "application/json"); + access_destroy(perm); + return 0; +} + + + /** * */ @@ -2263,6 +2285,7 @@ webui_init(int xspf) /* These names are specified in https://info.hdhomerun.com/info/http_api */ http_path_add("/discover.json", NULL, hdhomerun_server_discover, ACCESS_ANONYMOUS); http_path_add("/lineup.json", NULL, hdhomerun_server_lineup, ACCESS_ANONYMOUS); + http_path_add("/lineup_status.json", NULL, hdhomerun_server_lineup_status, ACCESS_ANONYMOUS); http_path_add_modify("/play", NULL, page_play, ACCESS_ANONYMOUS, page_play_path_modify5); http_path_add_modify("/play/ticket", NULL, page_play_ticket, ACCESS_ANONYMOUS, page_play_path_modify12); -- 2.25.1