Anyone have any suggestions to help me please?

Bertrand

Le lun. 2 mai 2022 à 13:15, Bertrand Lagrange <bertr...@b-la.fr> a écrit :

> Hello,
>
> I'am a liquidsoap user for a few years, i using it for my web radio. I had
> started at the very beginning by writing my own system which provided a
> dynamic playlist for Liquidsoap, but now I use Azuracast with a custom
> Liquidsoap script.
>
> Azuracast having switched to liquidsoap 2, I therefore adapted my script
> by following the recommendations (
> https://www.liquidsoap.info/doc-2.0.4/migrating.html).
>
> But there's a part that I don't understand. That's why I'm asking for your
> help.
>
> My radio script is designed to insert an ad twice an hour. I add to this
> insert an entry and exit transition containing a very short sound which
> makes it possible to signalize to the listeners the "dropout" on the ad...
>
> Here is an excerpt from the script:
>
> ####################################################################
> # One track by predicate true
> # https://github.com/savonet/liquidsoap/issues/1067
> def predicate.activates(~init=false, p)
>   last = ref(not init)
>   fun () -> begin
>     cur = p()
>     ans = (not !last) and cur
>     last := cur
>     ans
>   end
> end
>
> def pre_advert_trans(virgule, a ,b)
>   log(label="pre_advert_trans", "Advert In")
>
>   def add_transition_length(_) =
>     [("liq_transition_length","10.")]
>   end
>
>   transition =
>     add(normalize=false,
>       [ sequence([blank(duration=0.5), fade.in(duration=1.,virgule), b]),
>         sequence([fade.out(duration=3.,a),blank()]) ])
>
>   map_first_track(map_metadata(add_transition_length),transition)
> end
>
> def post_advert_trans(virgule, a ,b)
>   log(label="post_advert_trans", "Advert Out")
>
>   def add_transition_length(_) =
>     [("liq_transition_length","10.")]
>   end
>
>   transition =
>     add(normalize=false,
>       [ sequence([blank(duration=5.1), virgule, b]),
>         sequence([fade.out(type="sin",duration=5.0, a),blank()]) ])
>
>   map_first_track(map_metadata(add_transition_length),transition)
> end
>
> radio =
> switch(transitions=[pre_advert_trans(playlist_decrochage_in),post_advert_trans(playlist_decrochage_out)],
>         [
>           (predicate.activates({ 12m-18m or 42m-48m }), playlist_advert),
>  ({ true }, radio)
> ])
> ####################################################################
>
> I had obtained the expected result, but with the passage in v2 I have the
> following error:
>
> At /tmp/liquidsoap.liq, line 248, char 27-112:
> radio =
> switch(transitions=[pre_advert_trans(playlist_decrochage_in),post_advert_trans(playlist_decrochage_out)],
>
> Error 5: this value has type
>   [(_, _.{id : _}, ...) -> _]
> but it should be a subtype of
>   [(_, source(audio=pcm(?A), video=?internal(?B), midi=?internal(?C)),
> ...) ->
>    _]
>
>
> I understood that it was the transition on the switch that poses the
> problem but I have trouble seeing how I should rewrite that.
>
> Thanks in advance for your help.
>
> Bertrand
>
>
>
_______________________________________________
Savonet-users mailing list
Savonet-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/savonet-users

Reply via email to