Hi All,
I originally sent this to Max (email noted in the Authors file), but I
just recently found the doc/developers.xml file which had instructions
for the proper way to submit patches.
I recently started to use MPD (great project) and came across some
strangeness with certain akamaistream.net icecast streams. This appears
to be a bug with their icecast servers. I don't know how long this has
been going on or how widespread it is, but I've seen it on two stations,
so it's not isolated. The streamtitle comes across like this:
StreamTitle='Cracker - text="Low" song_spot="M" MediaBaseId="1153336"
itunesTrackId="285517606" amgTrackId="0" amgArtistId="0" TAID="28022"
TPID="466441" cartcutId="0744136001"';
I've attached a patch that displays the correct artist/title for these
streams.
Thanks much
-Sven Carlberg
>From 1fd563577f40d075c35764e63d06f42be471821a Mon Sep 17 00:00:00 2001
From: Sven Carlberg <sven...@gmail.com>
Date: Tue, 4 Dec 2012 14:18:54 -0500
Subject: [PATCH] implement icecast parser for malformed StreamTitle data
---
src/icy_metadata.c | 23 +++++++++++++++++++++--
1 files changed, 21 insertions(+), 2 deletions(-)
diff --git a/src/icy_metadata.c b/src/icy_metadata.c
index 32953e6..6a8e44b 100644
--- a/src/icy_metadata.c
+++ b/src/icy_metadata.c
@@ -95,8 +95,26 @@ icy_parse_tag_item(struct tag *tag, const char *item)
gchar **p = g_strsplit(item, "=", 0);
if (p[0] != NULL && p[1] != NULL) {
- if (strcmp(p[0], "StreamTitle") == 0)
- icy_add_item(tag, TAG_TITLE, p[1]);
+ if (strcmp(p[0], "StreamTitle") == 0) {
+ /* Account for strange icy tag with following format:
+ StreamTitle='Cracker - text="Low" song_spot="M" MediaBaseId="1153336" itunesTrackId="285517606" amgTrackId="0" amgArtistId="0" TAID="28022" TPID="466441" cartcutId="0744136001"';
+ for example, see these examples:
+ mpc add 'http://wwdc-fm.akacast.akamaistream.net/7/634/20131/v1/auth.akacast.akamaistream.net/wwdc-fm'
+ mpc add 'http://rocknation.akacast.akamaistream.net/7/573/73696/v1/auth.akacast.akamaistream.net/rocknation'
+ */
+ char *textptr ;
+ if ( (textptr=strstr(item,"text=\"")) != NULL ) {
+ gchar **p2 = g_strsplit(textptr, "\"", 0);
+ char *title = (char*)malloc(strlen(p[1]) + strlen(p2[1]) ) ;
+ strcpy( title, p[1]+1 ) ;
+ strcpy( title+strlen(p[1])-5, p2[1]) ;
+ icy_add_item(tag, TAG_TITLE, title);
+ free(title) ;
+ g_strfreev(p2);
+ } else {
+ icy_add_item(tag, TAG_TITLE, p[1]);
+ }
+ }
else
g_debug("unknown icy-tag: '%s'", p[0]);
}
@@ -107,6 +125,7 @@ icy_parse_tag_item(struct tag *tag, const char *item)
static struct tag *
icy_parse_tag(const char *p)
{
+ g_debug("ICY TAG: '%s'", p);
struct tag *tag = tag_new();
gchar **items = g_strsplit(p, ";", 0);
--
1.6.3.3
------------------------------------------------------------------------------
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
_______________________________________________
Musicpd-dev-team mailing list
Musicpd-dev-team@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/musicpd-dev-team