Hi,

On 11/7/06, claudio b. <[EMAIL PROTECTED]> wrote:
This is absolutely great. But I have a question: can liquidsoap inform
me when it actually *starts playing* the new song?

This is possible, as RadioPi already asked for it. The on_metadata
function does that. Basically, it takes a function and a source, and
calls the function for every new metadata packet in the stream --
which is a bit more often than every new track but shouldn't make any
difference in your case. The function takes a list of pairs of strings
as a parameter: [("key1","val1"),("key2","val2"),...].

As an example here's a bit of RadioPi's configuration, wrapping SOURCE
with this notification mechanism:
 source = on_metadata(fun (meta) ->
                   system("/var/lib/radiopilote/scripts/radiopilote-feedback "
                          ^quote(assoc("canal",meta))
                          ^" "^quote(assoc("file_id",meta))^" &"), source)
The quote() is here to avoid that anything in the metadata is
interpreted by the shell, especially whitespaces. The assoc() can be
seen as lookup in a hash table ($table{key} in perl), where the table
is our list of pairs.

For more on all these functions, see
<http://savonet.sourceforge.net/wiki/LiqReference>.

Have fun.
--
David

Reply via email to