Le vendredi 17 avril 2009 10:07:37, Brandon Casci a écrit :
> I think I get it. fun -> is a way to create a anonymous function, and
> you'd probably use fun() -> if your function code is only a single
> line and used in one place. You would go with a full def, if your
> custom function were more advanced or was used repeatedly. Correct?
Yep !
> >> add_protocol("dolebrai",
> >> fun (arg,delay) ->
> >> get_process_lines("#{scripts}dolebrai-filename #{quote(arg)}"))
>
> In this case, the function has two args, arg and delay. How are the
> values for those arguments being supplied? I don't see any explicit
> calls to to add_protocol.
Yes. This function registers a new request protocol. It will be used when a
request of the form: "dolebrai:arg" is received.
The two arguments are the arg (part after dolebrai:) and the delay for getting
the song (usually 60 seconds). This possibility is very useful if you want to
extend liquidsoap's capabilities for fetching songs or applying a treatement
to the song.
> I'm not sure there if you sense much need for this, but if you help me
> understand the language I can try to write a code generator for simple
> use cases. Maybe something something like a config file that defines
> how you want tracks rotated, backup sources and so on, and a ruby
> script (that's what I use most) that generates a .liq based on
> contents of config.
Héhé, nice idea.
I have written a similar thing which you can find here:
http://savonet.rastageeks.org/browser/trunk/liq-contrib/simpleliq.in
However, it is nothing serious and was just a proof-of-concept.
But, clearly, a tool to generate a script based on some fixed parameters would
be a great thing for newcomers who don't want (yet) to program their streams
but still benefit from the flexibility :)
Romain
------------------------------------------------------------------------------
Stay on top of everything new and different, both inside and
around Java (TM) technology - register by April 22, and save
$200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
300 plus technical and hands-on sessions. Register today.
Use priority code J9JMT32. http://p.sf.net/sfu/p
_______________________________________________
Savonet-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/savonet-users