Getting Liquidsoap AutoDJ to send Album metadata - solved

Read 2916 times
I already wrote this up but it's been deleted presumably due to spam responses, and anyway it should be here in a technical discussion section: my apologies. Here is the information again.

The requirement here is to get a liquidsoap AutoDJ on a Centova v3 system to include the Album name in the metadata it sends to a player, and so that the information is also accessible by StreamLicensing if you use them, where including the Album tag is now mandatory (and a good idea, as you can indicate non-copyright items like jingles or sponsor messages with the Album tag "*****" and reduce your TLH accordingly).

Here is what you need to do to enable this facility. You obviously need server access.

Go to the liquidsoap directory for the appropriate stream as follows.
From
/usr/local/centovacast/var/vhosts
cd to the appropriate vhost then go to
etc/liquidsoap

Edit the file custom.liq - by all means make a backup copy of it first.
Insert the following:


def apply_metadata(m) =
  title = m["title"]
  artist = m["artist"]
  album = m["album"]
  [("artist","#{artist}"),("title","#{album} - #{title}")]
end

centovacast.callback_autodj := fun(s) -> map_metadata(apply_metadata,s)



This routine grabs the title, artist and album from the audio file on the server (obviously the audio files on your Centova system need to have a valid Album tag). It then writes the Artist field unchanged but rewrites the Title field to take the form "Album - Title".

This order means that the Centova Now Playing widgets will display the right fields in the right order.

The callback shown ensures that this feature only applies to the AutoDJ - your live sources ought to be able to send this themselves, and if they can't this data won't be in the stream anyway.

It's possible that StreamLicensing wants to see these the other way round (sigh) - in which case you reverse "album" and "title" in the expression "#{album} - #{title}". This will screw the widget but you can't have everything.

I am a beginner with liquidsoap so I probably can't answer much in the way of questions on the implementation.