Hi Benoit,
2010/11/14 Benoit Avarapi <[email protected]>:
> I hacked the source code to implement global string variables via two
> functions :
> getvar : (string)->string
> setvar : (string, string)->unit
Congratulations for having hacked liquidsoap! Few people dare do it,
and it might be useful in the future again. However, this time it was
unnecessary: we have references for that. Create one using e.g. x =
ref "foo", get it using !x, and set it using x := "bar".
> def test =
> def dyn () =
> def cond () =
> print "cond is run"
> getvar("var_cond") == "ok"
> end
> if getvar("var_dyn") == ""
> then []
> else [ #var_dyn triggers dynamically populating list of playlists (here
> considered constant for the sake of simplicity)
> at(cond, single("test.mp3")) #playing this playlist may be triggered
> through var_cond
> ]
> end
> end
> source.dynamic(dyn)
> end
>
> radio = fallback(test, single("emergency.mp3"))
> output.icecast(%mp3, radio) #shortened
Congratulations again for having used source.dynamic()! It makes me
realize that I should have marked this experiment as very unfinished:
I made it, played with it on a few examples, realized a few
limitations, and stopped working on it. But now that you've started
playing with it, and since you seem to be able to play with our source
code, let's try to make some progress...
> This problem seems to have something to do with selection caching in the
> definition of the switch operator : if I hack the source code (switch.ml) to
> disable it, this problem no longer seems to occur.
First, note that I've recently fixed (r7901) a bug in switch's caching
mechanism. But it shouldn't be related since the bug caused a crash
(assert failure). Nevertheless, it's a good idea for you to switch to
SVN if you start changing the source code -- by the way, I could give
you write access if it's useful.
Back to your change in switch: I doubt that this is the good solution,
but it points in the right direction. Rather, I would suspect the
#is_ready method in source.dynamic(): it only answers true if there is
an underlying source that is ready, but never attempts to create a new
source. It looks like it would be a good idea to try to create a
source, and see if it's ready.
I'm sorry I cannot look more into it right now. Perhaps later today.
Let me know if you make any progress.
Have fun,
--
David
PS:
> (It looks like a FAQ, doesn't it ?)
Yup, it sounds like an FAQ. In fact I would really like to have a
documentation page on various scheduling solutions. We had a promise
from somebody to make this page some time ago, but I think I should
step up and initiate a collaborative effort at some point. However, I
did not have source.dynamic() in mind, since many things are already
possible using other (more stable) solutions -- you can reload
playlist files, populate queues, have external scripts, etc.
------------------------------------------------------------------------------
Centralized Desktop Delivery: Dell and VMware Reference Architecture
Simplifying enterprise desktop deployment and management using
Dell EqualLogic storage and VMware View: A highly scalable, end-to-end
client virtualization framework. Read more!
http://p.sf.net/sfu/dell-eql-dev2dev
_______________________________________________
Savonet-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/savonet-users