--- Slim/Web/HTTP.pm.old 2009-10-18 11:43:03.000000000 +0100 +++ Slim/Web/HTTP.pm 2009-10-24 18:13:39.000000000 +0100 @@ -1599,6 +1599,38 @@ # hack to make xmms like the audio better, since it appears to be case sensitive on for headers. $data =~ s/^(Icy-.+\:)/\L$1/mg; + # hack for Reciva Internet Radios which glitch on metadata unless the + # icy-name header comes before icy-metaint. If icy-metaint appears + # in the list of headers before icy-name, then swap the 2 over. + if($data =~ /icy-metaint:/) + { + my @header_lines = split(/\n/,$data,-1); + my $meta_pos = -1; + foreach(0..$#header_lines) + { + if($header_lines[$_] =~ /^icy-metaint:/) + { + $meta_pos = $_; + } + elsif($header_lines[$_] =~ /^icy-name:/) + { + if($meta_pos > -1) + { + #Swap name and metaint lines if the metaint line + #has already been passed (ie came first) + my $meta_str = $header_lines[$meta_pos]; + $header_lines[$meta_pos] = $header_lines[$_]; + $header_lines[$_] = $meta_str; + #Re-Join lines as the outgoing data + $data = join("\n", @header_lines); + } + #No need for any further processing after + #we've located the first icy-name header. + last; + } + } + } + return $data; }