Le mardi 29 décembre 2009 17:43:30, Frank Steinborn a écrit :
> Dear Liquidsoap users and developers,
Hello !
> I'm in the process of deploying Liquidsoap for a webradio of mine and
> have it working almost the way I like it. However, there are still
> some problems I can't figure out for myself, so I'd be glad if someone
> could have a look over my script.
(...)
> So far so good. Here are the problems I couldn't figure out yet:
>
> There is a playlist "nachrichten", which always holds one mp3 at a
> time, and this file should be played every day at 18:30. The first
> problem with this is that the filename always changes day-by-day and
> liquidsoap doesn't seem to reload the playlist, looks for the old
> filename and the file does not get played. The second problem is this:
> As you can see I used the add-function so that the file gets played
> "on top" of the normal stream beneath it. This is quite cool, but the
> volume changes very abprubt and I didn't find a way to have a smooth
> fade in of the file. Last but not least, the most important issue with
> it: I need to get sure that of the time the file is played, no jingle
> is picked from the jingles playlist. This means I need to get sure
> that, let's say from 18:25 till the end of the "nachrichten"-file, no
> jingle is played. I have no idea at the moment how i can accomplish
> this.
It seems an interesting challenge :-)
If I get it correctly, you want to supperpose the nachrichten source and the
original source at a specific time, with smooth transition, but also avoid
jingles during this transition.
This may be fixed with several ideas.
First, you may think of wrapping the jingle source around an operator that
makes sure it is not available at the time where no jingle should be chosed.
This may be done with a conditional switch for instance. In general, if f is a
function such that f () returns a condition for the source to be used, then:
s = switch([(f , s)])
will define a source that is available only when f () returns true and s is
available.
Also, the new source s above will in fact ends the current song when use
changes from true to false. If you want the source to be immediatly
unavailable when f () returns false, you should do:
s = switch(track_sensitive=false, [(use, s)])
<digression>
You can for instance play with the following code:
8<------------------------------------------>8
x = string.ref("#{false}")
get = fst(x)
get = fun () -> bool_of_string(get())
set = snd(x)
set = fun (x) -> set("#{x}")
def toggle (_) =
if get () then
set(false)
"Switched to false"
else
set(true)
"Switched to true"
end
end
server.register("toggle",toggle)
s = switch([(get,s)])
8<------------------------------------------>8
This code will register a server command "toggle" that changes a value from
true to false and false to true. Then the source s, when wrapped in the
switch, will be available only when the value is true, and you can change it
by using the "toggle" command.
</digression>
Anyway, back to your issue, in the case of the source jingle, I would say
that, if the jingles do not last for more than like 3 min, and the song more
than 15min, you may do:
jingles = switch( [( { not 18h26m-18h48 }, jingles )])
As you may know, { x } means the function f such that: f () = x. Hence, in
this case, the condition is true when time is not in the interval described.
This should avoid cutting a jingle in the middle. You may find other solutions,
but this seems reasonable.
Then, for the added source, I think you may enjoy the smooth_add operator. It
is an operator that takes a special and normal source. The normal source is
always played, but when a song is available from the special source, it fades
out the normal source to a given percentage and adds the special source on top
of it.. Pretty much what you need I believe :-)
Also, the playlist is in fact a single file, but if I understand well, the file
may change. Suppose that the name is always the same, though.
Then, you may do the following:
nachrichten = switch( [ { 18h30m }, single("/path/to/file.mp3") ] )
nightflight = smooth_add( normal=nightflight, special=nachrichten )
However, in this case, file resolution on "/path/to/file.mp3" will be done once
when liquidsoap starts and never again later.
In order to change this you can do:
8<------------------------------------------>8
# A dummy protocol to force request resolution:
add_protocol("dummy",fun (s,_) -> [s])
nachrichten = switch( [ { 18h30m }, single("dummy:/path/to/file.mp3") ] )
8<------------------------------------------>8
With this code, the dummy protocol avoids a static resolution of the file. At
the end of the song, the request is destroyed and a new request is created
when the source is asked again, the next time it is 18h30m.
I believe these two tricks should help you implementing what you want. Please
let us know if you have more questions.. I have tested the examples with
liquidsoap 0.9.2, it seemd to work correctly..
Romain
------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev
_______________________________________________
Savonet-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/savonet-users