Hi, First let me say that I understood why the experiment I ran was behaving funny: prepending was disabled when there was no metadata attached to a new track. The bad reason is that this metadata is needed, as it should be passed to the prepending function. I just commited a fix that should give a more expected behavior: the empty metadata is passed to the prepending function when there is no metadata. (In several operators we make such behaviors optional, cf. "insert_missing" parameters of e.g. map_metadata(), but I felt that it would be useless and just confusing to do it like that here.)
On Sun, Jun 28, 2009 at 10:00 PM, Alexey Tarasov<[email protected]> wrote: > My aim is to play concatenation of one "news" (no idea how to say this > word correct in singular :-O) and one intro every 20 minutes. I hadn't understood that before. I understand why you were not happy with the initial solution now, and I think I can help. > music = playlist(reload = 86400, "/home/radio/content/music.txt") > news = playlist(reload = 86400, "/home/radio/content/news.txt") > intro = playlist(reload = 86400, "/home/radio/content/intro.txt") > default = single("/home/radio/content/music/test1.mp3") > > radio = fallback([ request.queue(id="request"), music, default ]) > > news = sequence(merge = true, [intro, news]) > news = delay(1200., news) > radio = fallback([ news, radio ]) > > This code works fine only one time, the first time after starting > liquidsoap. > Later liquidsoap plays either one "news" or one intro. I agree with all you did and understand why it behaves like that, except for the last sentence: after the first time, it plays only news item and tracks from radio, but no more track from intro. I hope it's what you meant. In any case let me explain why this approach is wrong. > news = sequence(merge = true, [intro, news]) You create the new "news" once and for all as a sequence of an intro and then news. So only one "intro" track will be played over the entire lifespan of your sequence(..) source. The sequence() operator can sometimes be used for similar effects, but typically when it is combined with a transition that might create a new instance of sequence(...) each time. Here you create only one for ever. So we'll get back to prepend. Let's replace that line with the following (you can also set merge=true if you like): news = prepend(news,fun (m) -> intro) > news = delay(1200., news) This is excellent: it's what you need, and you got it right. It will avoids having more than one news item per 20 minutes. > radio = fallback([ news, radio ]) This is also good. I tested a sub-part of this script successfully here (with the latest SVN): intro=playlist("~/media/audio/jingle") out(prepend(playlist("~/media/audio"),fun (m)->intro)) I'm confident that the delay() and fallback() won't cause any problem. I hope that it's a bit clearer now. have fun! -- David ------------------------------------------------------------------------------ _______________________________________________ Savonet-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/savonet-users
