Norway


I have the following code which, when used on most (Shoutcast) streaming servers, returns the artist/song metadata, but on a particular server it is not working and is simply displaying the letter ‘t’!

As NSLog isn’t currently working for me (despite all kinds of changes, I can’t get it to work ( 9.2)), I’m slightly in the .

- (void)FetchMeta
{
    for ( *item in player.currentItem.tracks)
    {
        if ([item.assetTrack.mediaType isEqual:AVMediaTypeAudio])
        {
            NSArray *meta = [playerItem timedMetadata];
            for (AVMetadataItem *metaItem in meta)
            {
                NSString *source = metaItem.stringValue;
                if(![source isEqualToString:self.songInfo.text])
                {
                    self.songInfo.text = [source stringByAppendingString:@"  "];
                    //self.songInfo.text = @"Test";
                    [self LoadArtistImage];
                }
                NSLog(@"meta %@n%@",source,metaItem.extraAttributes);
            }
        }
    }
}

I know I’m in the right part of the code, because if I uncomment the //self.songInfo.text = @"Test"; line, I see it on the display where the song metadata should appear, but have been on this for 3 hours solid and can’t get it to display the metadata and not having NSLog really isn’t helping.

UPDATE : I have been able to interrogate the servers and can see the difference, but I still no not know how to tell the code to look in correct field… My understanding is that the is being put into an (I think) but it is taking the wrong field. Maybe it is always just taking the last field? TO be clear, I’m looking for it to take the ‘StreamTitle’ field.

Working server response:

Input #0, mp3, from 'http://server:port':
  Metadata:
    icy-notice1     : <BR>This  requires <a href="http://www.winamp.com">Winamp</a><BR>
    icy-notice2     : SHOUTcast DNAS/posix(linux x86) v2.5.1.724<BR>
    icy-name        : Station Name
    icy-genre       : 80s, Pop
    icy-br          : 8
    icy-sr          : 44100
    icy-url         : http://website.com
    icy-pub         : 1
    StreamTitle     : Rod Stewart - Lost In You

Non working server response:

Input #0, mp3, from 'http://server:port/':
  Metadata:
    icy-notice1     : <BR>This stream requires <a href="http://www.winamp.com/">Winamp</a><BR>
    icy-notice2     : SHOUTcast Distributed Network Audio Server/Linux v1.9.8<BR>
    icy-name        : Station Name
    icy-genre       : Various
    icy-url         : www.website.com
    icy-pub         : 1
    icy-br          : 128
    StreamTitle     : Theory of a Deadman - Rx
    StreamUrl       : t

To further clarify. The ‘working server’ output works correctly displaying the ‘StreamTitle’ field using the code displayed, the non working server displays the last field ‘StreamUrl’ which is not the desired field.

Any pointers?

Many thanks.



Source link

LEAVE A REPLY

Please enter your comment!
Please enter your name here