1
0
Fork 0

Feature: Added show-listeners parameter to stats.xml endpoint

This commit is contained in:
Philipp Schafft 2023-09-26 18:53:58 +00:00
parent 6f2540426a
commit 75d7082e60
1 changed files with 11 additions and 1 deletions

View File

@ -1342,12 +1342,22 @@ static void command_shoutcast_metadata(client_t *client,
static void command_stats(client_t *client, source_t *source, admin_format_t response)
{
unsigned int flags = (source) ? STATS_XML_FLAG_SHOW_HIDDEN|STATS_XML_FLAG_SHOW_LISTENERS : STATS_XML_FLAG_SHOW_HIDDEN;
unsigned int flags = STATS_XML_FLAG_SHOW_HIDDEN;
const char *mount = (source) ? source->mount : NULL;
xmlDocPtr doc;
const char *show_listeners;
ICECAST_LOG_DEBUG("Stats request, sending xml stats");
COMMAND_OPTIONAL(client, "show-listeners", show_listeners);
if (show_listeners) {
if (util_str_to_bool(show_listeners))
flags |= STATS_XML_FLAG_SHOW_LISTENERS;
} else {
if (source)
flags |= STATS_XML_FLAG_SHOW_LISTENERS;
}
doc = stats_get_xml(flags, mount, client);
admin_send_response(doc, client, response, STATS_HTML_REQUEST);
xmlFreeDoc(doc);