Hi Christian,

On Thu, Oct 29, 2009 at 8:48 AM, Christian Heisch
<[email protected]> wrote:
> I am writing a kind of statistics by starting an external bash-script:
> full = on_metadata(fun(meta) -> system("/home/musik/status_schreiben"),full)

With that kind of setup, your script is called when some metadata
passes in the stream at this point of the pipeline. Your script is
called, and then streaming continues up the pipe. At the end of the
pipe, it is sent to icecast. So:
 (1) be careful: if your script takes a long time to run, it will
delay streaming;
 (2) icecast never knows the metadata that just occurred in the stream.

The first point is not a concern for now, but just in case, let me say
that it's easy to fix by putting an & at the end of the shell script
command. Easy to test (on_track is the same as on_metadata for that
purpose):

$ liquidsoap 'output.dummy(
  on_track(fun (_)->system("echo foo ; sleep10"),blank(duration=1.)))'
[...]
foo
2009/10/29 16:33:32 [root:2] We must catchup 9.97 seconds!
foo
2009/10/29 16:33:42 [root:2] We must catchup 18.99 seconds!
foo

$ src/liquidsoap 'output.dummy(on_track(fun (_)->system("echo foo ;
sleep 10 &"),blank(duration=1.)))'
[...]
foo
foo
foo every second

Now, if you add a sleep and a & you might get a good result. It's
probably lighter to use add_timeout (cf liquidsoap -h add_timeout as
usual). For example here, you'd use this instead of your system(..):
  add_timeout(2., { system("blah") ; (-1.) })

All this being said, there are still other ways to proceed.
Personally, I have a similar system running in dolebrai, and I extract
the minimum amount of info from icecast: number of listeners, uptime.
The rest I get directly from liquidsoap using the telnet interface:
what's on air, and also the last ten played tracks (you can get that
from the outputs, or the store_metadata operator). This is probably
the way to go, it will give you more flexibility in the future.

Hope that helps,
-- 
David

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Savonet-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/savonet-users

Reply via email to