diff --git a/src/cfgfile.c b/src/cfgfile.c index 0243dd4f..e7b66533 100644 --- a/src/cfgfile.c +++ b/src/cfgfile.c @@ -258,6 +258,11 @@ relay_server *config_clear_relay (relay_server *relay) if (master->mount) xmlFree (master->mount); free (master); } + if (relay->stream_name) xmlFree (relay->stream_name); + if (relay->stream_description) xmlFree (relay->stream_description); + if (relay->stream_url) xmlFree (relay->stream_url); + if (relay->stream_genre) xmlFree (relay->stream_genre); + if (relay->user_agent) xmlFree (relay->user_agent); if (relay->localmount) xmlFree (relay->localmount); if (relay->username) xmlFree (relay->username); if (relay->password) xmlFree (relay->password); @@ -1050,6 +1055,12 @@ static int _parse_relay (xmlNodePtr node, void *arg) { "username", config_get_str, &relay->username }, { "password", config_get_str, &relay->password }, { "enable", config_get_bool, &relay->running }, + { "stream-name", config_get_str, &relay->stream_name }, + { "stream-description", config_get_str, &relay->stream_description }, + { "stream-url", config_get_str, &relay->stream_url }, + { "genre", config_get_str, &relay->stream_genre }, + { "user-agent", config_get_str, &relay->user_agent }, + { NULL, NULL, NULL }, }; diff --git a/src/cfgfile.h b/src/cfgfile.h index ed391a79..37cb543b 100644 --- a/src/cfgfile.h +++ b/src/cfgfile.h @@ -217,6 +217,11 @@ typedef struct _relay_server int on_demand; int running; int cleanup; + char *stream_name; + char *stream_description; + char *stream_url; + char *stream_genre; + char *user_agent; } relay_server; diff --git a/src/slave.c b/src/slave.c index 533c4e98..3ba3d08d 100644 --- a/src/slave.c +++ b/src/slave.c @@ -137,6 +137,16 @@ relay_server *relay_copy (relay_server *r) copy->username = (char *)xmlStrdup (XMLSTR(r->username)); if (r->password) copy->password = (char *)xmlStrdup (XMLSTR(r->password)); + if (r->user_agent) + copy->user_agent = (char *)xmlStrdup (XMLSTR(r->user_agent)); + if (r->stream_name) + copy->stream_name = (char *)xmlStrdup (XMLSTR(r->stream_name)); + if (r->stream_description) + copy->stream_description = (char *)xmlStrdup (XMLSTR(r->stream_description)); + if (r->stream_url) + copy->stream_url = (char *)xmlStrdup (XMLSTR(r->stream_url)); + if (r->stream_genre) + copy->stream_genre = (char *)xmlStrdup (XMLSTR(r->stream_genre)); copy->mp3metadata = r->mp3metadata; copy->on_demand = r->on_demand; copy->interval = r->interval; @@ -276,10 +286,10 @@ int redirect_client (const char *mountpoint, client_t *client) static http_parser_t *get_relay_response (connection_t *con, const char *mount, - const char *server, int ask_for_metadata, const char *auth_header) + const char *server, int ask_for_metadata, const char *auth_header, relay_server *relay) { ice_config_t *config = config_get_config (); - char *server_id = strdup (config->server_id); + char *server_id = strdup (relay->user_agent ? relay->user_agent : config->server_id); http_parser_t *parser = NULL; char response [4096]; @@ -375,7 +385,7 @@ static int open_relay_connection (client_t *client, relay_server *relay, relay_s break; } - parser = get_relay_response (con, mount, server, ask_for_metadata, auth_header); + parser = get_relay_response (con, mount, server, ask_for_metadata, auth_header, relay); if (parser == NULL) { @@ -421,6 +431,14 @@ static int open_relay_connection (client_t *client, relay_server *relay, relay_s client->parser = NULL; break; } + if (relay->stream_description) // override even if exists + httpp_setvar (parser, "icy-description", relay->stream_description); + if (relay->stream_name) + httpp_setvar (parser, "icy-name", relay->stream_name); + if (relay->stream_url) + httpp_setvar (parser, "icy-url", relay->stream_url); + if (relay->stream_genre) + httpp_setvar (parser, "icy-genre", relay->stream_genre); sock_set_blocking (streamsock, 0); thread_mutex_lock (&relay->source->lock); client->parser = parser; // old parser will be free in the format clear