Project

General

Profile

Feature #4461 » 0005-hdhomerun-Add-lineup_status.json-API.patch

Em Smith, 2020-06-12 01:18

View differences:

src/webui/webui.c
1724 1724
  return 0;
1725 1725
}
1726 1726

1727

1728
static int
1729
hdhomerun_server_lineup_status(http_connection_t *hc, const char *remain, void *opaque)
1730
{
1731
  const char *hdhr_user = config.hdhomerun_server_username ?: "";
1732
  access_t *perm = access_get_by_username(hdhr_user);
1733
  htsbuf_queue_t *hq;
1734

1735
  if (access_verify2(perm, ACCESS_STREAMING)) {
1736
    access_destroy(perm);
1737
    return http_noaccess_code(hc);
1738
  }
1739
  hq = &hc->hc_reply;
1740
  /* The contents below for the discovery message are based on the forum. */
1741
  htsbuf_append_str(hq, "{\"ScanInProgress\":0,\"ScanPossible\":1,\"Source\":\"Antenna\",\"SourceList\":[\"Antenna\"]}");
1742
  http_output_content(hc, "application/json");
1743
  access_destroy(perm);
1744
  return 0;
1745
}
1746

1747

1748

1727 1749
/**
1728 1750
 *
1729 1751
 */
......
2263 2285
  /* These names are specified in https://info.hdhomerun.com/info/http_api */
2264 2286
  http_path_add("/discover.json", NULL, hdhomerun_server_discover, ACCESS_ANONYMOUS);
2265 2287
  http_path_add("/lineup.json", NULL, hdhomerun_server_lineup, ACCESS_ANONYMOUS);
2288
  http_path_add("/lineup_status.json", NULL, hdhomerun_server_lineup_status, ACCESS_ANONYMOUS);
2266 2289

2267 2290
  http_path_add_modify("/play", NULL, page_play, ACCESS_ANONYMOUS, page_play_path_modify5);
2268 2291
  http_path_add_modify("/play/ticket", NULL, page_play_ticket, ACCESS_ANONYMOUS, page_play_path_modify12);
2269
- 
(9-9/19)