From 33388918b3ddcc6ea1295349b4bb98ebdaaf6eac Mon Sep 17 00:00:00 2001 From: Christopher Snowhill Date: Tue, 15 Feb 2022 00:57:22 -0800 Subject: [PATCH] HTTP Reader: Support more stream info For streams offering a three way split in their ICY metadata blocks, support album/artist/title using that three way split. Otherwise do the usual of artist/title, or blank artist if there's no hyphen to split on. Signed-off-by: Christopher Snowhill --- Plugins/HTTPSource/HTTPSource.m | 40 +++++++++++++++++++++++++-------- 1 file changed, 31 insertions(+), 9 deletions(-) diff --git a/Plugins/HTTPSource/HTTPSource.m b/Plugins/HTTPSource/HTTPSource.m index e4af0cd85..fc721f0f6 100644 --- a/Plugins/HTTPSource/HTTPSource.m +++ b/Plugins/HTTPSource/HTTPSource.m @@ -85,17 +85,39 @@ static int http_parse_shoutcast_meta(HTTPSource *fp, const char *meta, size_t si if(tit) { *tit = 0; tit += 3; + char *tit2 = strstr(tit, " - "); + if(tit2) { + *tit2 = 0; + tit2 += 3; - const char *orig_title = [fp->title UTF8String]; - const char *orig_artist = [fp->artist UTF8String]; + const char *orig_album = [fp->album UTF8String]; + const char *orig_artist = [fp->artist UTF8String]; + const char *orig_title = [fp->title UTF8String]; - if(!orig_title || strcasecmp(orig_title, tit)) { - fp->title = [NSString stringWithUTF8String:tit]; - fp->gotmetadata = 1; - } - if(!orig_artist || strcasecmp(orig_artist, title)) { - fp->artist = [NSString stringWithUTF8String:title]; - fp->gotmetadata = 1; + if(!orig_title || strcasecmp(orig_title, tit2)) { + fp->title = [NSString stringWithUTF8String:tit2]; + fp->gotmetadata = 1; + } + if(!orig_artist || strcasecmp(orig_artist, tit)) { + fp->artist = [NSString stringWithUTF8String:tit]; + fp->gotmetadata = 1; + } + if(!orig_album || strcasecmp(orig_album, title)) { + fp->album = [NSString stringWithUTF8String:title]; + fp->gotmetadata = 1; + } + } else { + const char *orig_title = [fp->title UTF8String]; + const char *orig_artist = [fp->artist UTF8String]; + + if(!orig_title || strcasecmp(orig_title, tit)) { + fp->title = [NSString stringWithUTF8String:tit]; + fp->gotmetadata = 1; + } + if(!orig_artist || strcasecmp(orig_artist, title)) { + fp->artist = [NSString stringWithUTF8String:title]; + fp->gotmetadata = 1; + } } } else { const char *orig_title = [fp->title UTF8String];