Romain Beauxis wrote:
> > 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 :-)

[ ... ]

> 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 )])

This is what I use now. This works very well and is enough for my
setup. I wasn't aware that i can negate the time-statement with 'not'
:-)
 
> 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 )

smooth_add was exactly what I was looking for.
 
> 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

Ok, this works as expected. I changed our internal setup so that the
filename will always be the same. However, this raises another
question: Would it be possible to use playlist() instead of single()
here? The reason I ask is that some of our sources are directories
which get updated very often during the day, so it would be cool if I
could use the above snippet so that some source is always
"up-to-date"? Some example:

Our "main"-playlist is this:
default = playlist(reload = 14400, mode = "randomize", "/home/autodj")

This is a directory reachable for several people via SCP. Some songs
are deleted, some are added, etc. This happens very often. Is the
above playlist okay and safe against failing in some way if people
move/add files?
 
> 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..

Thanks, I'm stunned how well this setup works now... I just want you
to ask for another thing:

We added another source "short_jingles" which holds, well, very short
jingles that should be smooth_add()'ed every now and then. This works
very well:

8<------------------------------------------>8
short_jingles = playlist.safe(reload = 14400, mode = "randomize",
"/home/musicbeats/short_jingles")
short_jingles = delay(random.float(min=360., max=840.), short_jingles)
nightflight = smooth_add(normal=nightflight, special=short_jingles)
8<------------------------------------------>8

However, there was our other jingle-source that holds some longer
jingles (5min+) and these are played via random(). The problem is that
short_jingles should never played if some jingle from the
jingles-source is played currently. This is a similar issue like
before, and you gave some code-snippet to register the server-command
"toggle". However, I'm not sure how to handle this. This is
low-priority though.

I attached the script again as it is used now. It would be very nice if
you could have a short look at the big (well, not really big) picture.

> Romain

Thank you very much for your efforts, I really appreciate it. Have a
nice year 2010,

Frank
#!/opt/bin/liquidsoap

default = playlist(reload = 14400, mode = "randomize", "/home/autodj")

v13b15 = playlist(reload = 14400, mode = "randomize", "/home/musicbeats/v13b15")
v15b17 = playlist(reload = 14400, mode = "randomize", "/home/musicbeats/v15b17")
v17b19 = playlist(reload  = 14400, mode = "randomize", 
"/home/musicbeats/v17b19")

jingles = playlist(reload = 14400, mode = "randomize", 
"/home/musicbeats/jingles")
short_jingles = playlist.safe(reload = 14400, mode = "randomize", 
"/home/musicbeats/short_jingles")

add_protocol("dummy",fun (s,_) -> [s])
nachrichten = switch([({ 18h30m }, 
single("dummy:/home/musicbeats/nachrichten/nachrichten.mp3"))])
short_jingles = delay(random.float(min=360., max=840.), short_jingles)

nightflight = fallback([
                switch([
                 ({ 13h-15h }, v13b15),
                 ({ 15h-17h }, v15b17),
                 ({ 17h-19h }, v17b19)]),
                 default])

jingles = switch([( { not 18h23m-18h40m }, jingles )])
short_jingles = switch([( { not 18h28m-18h40m }, short_jingles )])

nightflight = random(weights=[1,6],[ jingles, nightflight ])
nightflight = smooth_add(normal=nightflight, special=short_jingles)
nightflight = smooth_add(p=0.1, normal=nightflight, special=nachrichten)

output.icecast.mp3(host="10.0.0.1", port = 8000, password = "", mount = "test", 
nightflight, restart = true, fallible = true, genre = "Various", url = "", 
description = "", name = "")
------------------------------------------------------------------------------
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

Reply via email to