Hi Tony,
The source.dynamic() operator is an advanced tool for changing a
source dynamically in "full generality". Fortunately, you don't need
it if you have a pre-defined collection of sources that you're
changing for. In your example, you seem to want to switch to playlist
or dj1 or dj2, so there is a simpler solution in the style of what
you've seen: a switch with a fixed set of sources, and the only
dynamic part is the branch selection. However, you can't do it as in
the code you submitted (the arg variable is a string and can't be used
directly as a source, and source = arg is only defining a new local
variable source whose value is the same as arg).
Try something along these lines:
# After def of playlist and dj1 and dj2
selector = ref ""
source = switch(track_sensitive=false,[
({ !ref == "playlist" }, playlist),
({ !ref == "dj1" }, dj1),
({ !ref == "dj2" }, dj2),
])
On Sat, Jan 12, 2013 at 6:20 PM, Tony Miller <[email protected]> wrote:
> def set_dj (arg) =
> print("setting live dj to #{arg}")
selector := arg
> "Command executed"
> end
>
> server.register("set_dj", set_dj)
>
>
> # We output the stream to an icecast
> # server, in ogg/vorbis format.
> output.icecast(%vorbis,id="icecast",
> fallible=true,mount="my_radio.ogg",
> host="localhost", password="hackme",
> source)
I hope this helps. Make sure you read on references (that's what the
selector thing is) if you haven't seen it before.
Cheers,
--
David
------------------------------------------------------------------------------
Master SQL Server Development, Administration, T-SQL, SSAS, SSIS, SSRS
and more. Get SQL Server skills now (including 2012) with LearnDevNow -
200+ hours of step-by-step video tutorials by Microsoft MVPs and experts.
SALE $99.99 this month only - learn more at:
http://p.sf.net/sfu/learnmore_122512
_______________________________________________
Savonet-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/savonet-users