Live Radio: metadata

Some Internet Radio stations offer track information for their currently-playing songs. FIP, for instance, offers their metadata in JSON format at this URL.

It would be great if Roon were smart enough to extract the metadata and display it.

Here, for instance, is a script which outputs the title of the currently-playing song, the artist, and the cover art. It also outputs the number of seconds until the next song begins; at that time, the script should be rerun, to fetch the metadata for the next song

#!/usr/bin/ruby
require 'net/http'
require 'json'

uri = URI('https://api.radiofrance.fr/livemeta/pull/7')
response = Net::HTTP.get(uri)
songs = JSON.parse(response)['steps'].values
now = Time.now
songs.each do |song|
  song_end = Time.at(song['end'])
  if (song['embedType'] == 'song' && song_end >= now && Time.at(song['start']) <= now)
    title = song['title'] ? song['title'] : 'untitled'
    artist = song['performers'] && !song['performers'].empty? ? song['performers'] : song['authors']
    metadata = {'title' => title.split.collect{|s| s.capitalize}.join(' '),
      'artist' => artist.split.collect{|s| s.capitalize}.join(' '),
      'artUrl' => song['visual'],
      'reload' => (song_end - now + 1).to_i}
    puts JSON.generate(metadata)
    break
  end
end
6 Likes

Here’s another example. Radio Paradise offers its metadata in XML format here:

#!/usr/bin/ruby
require 'open-uri'
require 'nokogiri'
require 'json'
now = Time.now
url = 'http://legacy.radioparadise.com/xml/now_playing.xml'
doc = Nokogiri::HTML(open(url))
refresh_time = doc.at_xpath('//refresh_time/child::text()').to_s.to_i
song_end = Time.at(refresh_time)
metadata = {'title'  => doc.at_xpath('//title/child::text()'),
            'artist' => doc.at_xpath('//artist/child::text()'),
            'artUrl' => doc.at_xpath('//coverart/child::text()'),
            'reload' => (song_end - now + 1).to_i}
puts JSON.generate(metadata)

There are lots of others. Perhaps interested users might contribute some more examples, to bolster the case for implementing this.

2 Likes

:smiley:

1 Like

I love SomaFM. I used the links from the TuneIn website and the SomaFM station logo shows inside Roon. The functionality to play seems to work well, but this is a great feature request. I’ve been seeing a song pop up on GrooveSalad or DefCon or Fluid and then manually searching for it on Tidal. If I could have a button to do something similar that would be very cool.

What stations on SomaFM do you like?

This would be a huge addition to the service. Right now, FIP radio is integrated with Spotify so that liked tracks populate a Spotify playlist which I can then restream through Roon. I’d much rather cut out the middleman and just Like FIP tracks within Roon.

A FIP-augmented Roon recommendation engine would be so good!

1 Like

Yep, and purely from an aesthetic pov it would be nice to see the artist pages rotating with the playlist.

Live Radio playback includes artist and album links when possible

Back. Of. The. Net!

1 Like

Is there a list of radio stations for which this now works? I tried FIP, briefly, last night. No such metadata was available (though, as noted above, FIP does publish their metadata).

There is no list. If you find instances of stations that are broadcasting data but Roon is not accessing it, then a report in the Live Radio section will assist.

Could you please explain that answer a bit Andrew?

By the way, the new linkable song data in Live Radio is a real treat and seems to work good for some radio stations.Thanks for that!

What do you mean by “make a report”, do you mean here in the forum or is there a clickable button in the Live Radio section in Roon?

Some stations do, and some don’t do metadata, and Roon at present is at the mercy of the in-stream metadata. However, it does what it can and If some station is including it in the stream, but Roon isn’t picking it up, then let us know via the #live-radio category in the forum. That gets monitored (by me at least) daily.

Thanks for your lightning speed reply :wink:
All clear.
Have a nice day!

1 Like

I support the request of @Jacques_Distler to expand the “Live Radio Metadata” feature request to stations offering APIs instead of embedding the data in the Icecast streams.

Some are mentioned here Radio station metadata links. This could also allow for metadata for Radio Paradise in FLAC, as well as other radios broadcasting in FLAC.

Radio Curators could take care of the JSON translation to Roon standard if that can help.

1 Like

For FIP, there is quite an easy way to work around it, using a RPI, Icecast and node-red… :slight_smile:

See below the result:

1 Like

Thank you Sébastien for the workaround, looking forward to read the detailed installation steps :slight_smile:

NB: came accross this https://github.com/adblockradio/webradio-metadata

@Sebastien if you can make it work for Radio Paradise Flac Stream as well you will have many new friends on the forum :slight_smile:
API is here https://api.radioparadise.com/api/get_block?bitrate=4&info=true

Hi Rémi,

Not sure I’ll be able to make many new friends, let me explain why :slight_smile:

1/ On MP3 and AAC streams, you technically can add metadata. The point is that some radios like FIP do not use this possibility, and that’s what I’m doing on my side. In short, I’m installing an audio broadcast app on a raspberry (icecast2) to relay the stream from FIP, and I add into this relayed stream the metadata I got from FIP. I’m writing a tutorial as we speak, but it’ll take some time so if you are familiar with Raspberry I’m happy to help you setting this up.

2/ On FLAC streams, you technically cannot add metadata. The only possibility would consist in transcoding the FLAC stream to AAC or MP3, and add metadata to that new stream, but this does not make sense for Radio Paradise since there is already such streams available from their website.
Of course, another possibility would consist in Roon and RP teams working together to develop a plugin/service, but that’s a whole different story :slight_smile:

Hope this helps,

Hi Sebastian,

I understand that icy-metadata can be added to a FLAC stream in an Ogg container and that is what Radio Bluesflac is doing right. If we can work out how to get other FLAC stations to do the same …

Hi Andy,

Interesting, I was not aware of this. Have to dig if I can relay a FLAC stream in this way then, I will keep you posted.

How-to in french for now, but is pretty straightforward. Let me know if you want to give it a try and if you need some support from my side :slight_smile:

3 Likes