Hi Guys,
Thanks for some EXCELLENT suggestions, and it's given me a start on
how to go about this. I think Michal was closest with the simplicity,
in that if I can use SOX or mencoder to rip the audio coming into ALSA
and use a cronjob to change that hourly, without affecting what l'soap
is hearing thats probs best. I'm going to have an experiment today to
see what I can achieve.
Thank You all for your support though, it's been brilliant, and really
appreciated.
In the UK, any broadcast station (as far as I recall) is required by
the regulators to keep at least 2 months of broadcast on record. (It
may be as much as 6 months, but I'm out of date on OFCOM regulations).
This is in case a listener has a complaint against anything said on
the station, or there are any queries about Royalties due. OFCOM can
request evidence from the station.
The 'logs' are also useful for Presenters, as if a live phone in
produces some 'memorable' radio, the presenter can quickly grab the
log and cut out the 'fun' bit for use in a promo for the following
day's show.
In my deployment, I'm just wanting to record the output for presenters
to use in that circumstance where something occurring on the show
might be useful for a promo for the following day. I do like the
possbility of keeping at least 7 days records though so we can settle
any arguments etc!
If I can use something along the lines of :
# ALSA Out to transmitter (24/7)
output.alsa(bufferize=false,live)
# Record Monday 0900-1000
output.file("/var/www/log/monday/0900-1000.mp3",live)
# Record Monday 1000-1100
output.file("/var/www/log/monday/1000-1100.mp3",live)
That would be perfect, but how to switch the recording? I would like
to do it all from within l'soap, but if I need to do it externally,
then I'll write that. It would be good to have all the functions all
in one place though! I'm sure many of you understand why!
Thanks for all your help and any further advise you can offer,
Ian
On 1 March 2011 19:21, Romain Beauxis <[email protected]> wrote:
> 2011/2/28 Ian Bonham <[email protected]>:
>> Hi David,
>
> Howdy all!
>
>> >From what I can figure out, what you're suggesting is the dump.start
>> and dump.stop commands inside a source?
>> Thats a possibility, but my sources can switch. In some instances I
>> will be mainly collecting from ALSA input, and on a failure of that
>> source I switch to a local .pls.
>> Using the dump function, I am thinking that the source is just written
>> out as it comes in, so coming from ALSA I'd just be writing out raw
>> PCM data, but the local .pls might be an any format?
>>
>> What I need to do is make sure that the files are always saved in MP3,
>> so I need to transcode the stream into MP3 and then I was thinking of
>> using output.file to write the files out. output.file would then have
>> to be switchable. The files we log need to be in MP3 because there are
>> some shows that are recorded and edited for re-play at a later date,
>> and some made available on the web site for 'listen again'.
>>
>> Is it possible to switch the output.file somehow? I can't get my head
>> around the logic at the moment (it is early in the morning!!).
>> If anyone could give a simple example I'm sure I can figure out the rest.
>
> (warning: most of the following code has not been tested. I may likely
> have typos :) )
>
> Maybe I've missed something but I think there is a "simple" solution
> to your problem.
>
> If I get it right, you want to record the main source, that is the
> final stream broadcasted to your listeners.
> Also, the time to turn on/off recording may change so it should be dynamic.
>
> So in this case, first let me examplain the basic idea.
> Originally, you have something like that:
>
> s = (...)
>
> output.XXX(...,s)
>
> where s is the final source sent to the users.
> There you can insert two things: an operator that create a new source
> s' that will be available only when you want to record s and a file
> output. So:
>
> s = (...)
>
> s' = available_when_record(s)
>
> output.file(%mp3,"/path/to/dump.mp3",fallible=true,s')
>
> output.XXX(...,s)
>
> Now let's work on the available_when_record part. I think you have two
> main options:
> (1) A regular poll coming from liquidsoap
> (2) An external script operated on your side to turn on/off recording
>
> In case (1), you write a script that tells liquidsoap when to start
> the recording source and create a switch that calls that script
> regularly (the script has to be light!). This gives:
>
> def available_when_record(s) =
> # Define a function that returns true when
> # the new source should be available
> def is_ready() =
> # Call external script
> ans = list.hd(get_process_lines("/path/to/ask.script"))
> # True if output is "1"
> ans == "1"
> end
>
> # Now use this function to create a conditional switch
> switch([(is_ready,s)])
> end
>
> This polling will be VERY regular. If the script is too heavy, you may
> be able to code an alternative polling using add_timeout where you can
> can control the frequency of the polling. but the overall idea is the
> same.
>
> In case (2), you define a source is activated by an external command.
> For instance a telnet command. Let's see how we can sketch that.. The
> following code is for liquidsoap 1.0beta and +
>
> # Register a global is_ready
> is_ready = ref false
>
> # Register telnet commands to toggle is_ready
> server.register(namespace="dump",
> description="Start dumping.",
> usage="dump.start",
> "start",
> fun (_) -> begin is_ready := true "Done!" end)
> server.register(namespace="dump",
> description="Stop dumping.",
> usage="dump.stop",
> "stop",
> fun (_) -> begin is_ready := false "Done!" end)
>
> You may as well in liquidsoap 1.0SVN register HTTP harbor commands for
> that and use an AJAX/GET/POST interface..
>
> Finally, you use is_ready in a switch as before:
>
> def available_when_record(s) =
> # Define a function that returns true when
> # the new source should be available
> def is_ready() =
> !is_ready
> end
>
> # Now use this function to create a conditional switch
> switch([(is_ready,s)])
> end
>
> I think that will be enough for today... In the future you may also
> want to control the location of the recording file, which may also be
> done using these techniques..
>
> Let us know if you have more questions!
> Romain
>
------------------------------------------------------------------------------
Free Software Download: Index, Search & Analyze Logs and other IT data in
Real-Time with Splunk. Collect, index and harness all the fast moving IT data
generated by your applications, servers and devices whether physical, virtual
or in the cloud. Deliver compliance at lower cost and gain new business
insights. http://p.sf.net/sfu/splunk-dev2dev
_______________________________________________
Savonet-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/savonet-users