From 8acb2a647defc7a448a4daf3f330301ead9a073a Mon Sep 17 00:00:00 2001 From: ejurgensen Date: Sun, 17 May 2020 23:28:05 +0200 Subject: [PATCH] [http] Don't set ICY metadata if they are just empty strings An empty string will mean that m3u tags won't get used (unless m3u_override is configured), but they should be used, since they are probably better than an empty string. --- src/http.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/http.c b/src/http.c index f7500120..329c8f24 100644 --- a/src/http.c +++ b/src/http.c @@ -720,11 +720,11 @@ metadata_header_get(struct http_icy_metadata *metadata, AVFormatContext *fmtctx) if (ptr[0] == ' ') ptr++; - if ((strncmp(icy_token, "icy-name", strlen("icy-name")) == 0) && !metadata->name) + if ((strncmp(icy_token, "icy-name", strlen("icy-name")) == 0) && ptr[0] != '\0' && !metadata->name) metadata->name = strdup(ptr); - else if ((strncmp(icy_token, "icy-description", strlen("icy-description")) == 0) && !metadata->description) + else if ((strncmp(icy_token, "icy-description", strlen("icy-description")) == 0) && ptr[0] != '\0' && !metadata->description) metadata->description = strdup(ptr); - else if ((strncmp(icy_token, "icy-genre", strlen("icy-genre")) == 0) && !metadata->genre) + else if ((strncmp(icy_token, "icy-genre", strlen("icy-genre")) == 0) && ptr[0] != '\0' && !metadata->genre) metadata->genre = strdup(ptr); icy_token = strtok_r(NULL, "\r\n", &save_pr); @@ -816,17 +816,17 @@ http_icy_metadata_get(AVFormatContext *fmtctx, int packet_only) CHECK_NULL(L_HTTP, metadata = calloc(1, sizeof(struct http_icy_metadata))); got_header = 0; - if ( (value = keyval_get(ctx.input_headers, "icy-name")) ) + if ( (value = keyval_get(ctx.input_headers, "icy-name")) && value[0] != '\0' ) { metadata->name = strdup(value); got_header = 1; } - if ( (value = keyval_get(ctx.input_headers, "icy-description")) ) + if ( (value = keyval_get(ctx.input_headers, "icy-description")) && value[0] != '\0' ) { metadata->description = strdup(value); got_header = 1; } - if ( (value = keyval_get(ctx.input_headers, "icy-genre")) ) + if ( (value = keyval_get(ctx.input_headers, "icy-genre")) && value[0] != '\0' ) { metadata->genre = strdup(value); got_header = 1;