liquidsoap
liquidsoap copied to clipboard
"Play a jingle at a fixed time"
I'm trying to use the example from the cookbook that looks like this
radio = switch([(predicate.activates({ 0m-5m }), jingles), ({ true }, playlist)])
As I understand it, it creates a source named "radio", and once an hour, it plays one entry from the playlist "jingles" instead of the playlist "playlist".
When I implement it into my flow it does not work.
gbsfm = switch([(predicate.activates({ 0m-5m }), jingles), ({ true }, gbsfm_normal)])
Error 5: this value has type
_ * source(audio=?A, video=?B, midi=?C)
.{
time : () -> float,
shutdown : () -> unit,
fallible : bool,
skip : () -> unit,
seek : (float) -> float,
is_active : () -> bool,
is_up : () -> bool,
log :
{level : (() -> int?).{set : ((int) -> unit)}
},
self_sync : () -> bool,
duration : () -> float,
elapsed : () -> float,
remaining : () -> float,
on_track : ((([string * string]) -> unit)) -> unit,
on_leave : ((() -> unit)) -> unit,
on_get_ready : ((() -> unit)) -> unit,
on_shutdown : ((() -> unit)) -> unit,
on_metadata : ((([string * string]) -> unit)) -> unit,
last_metadata : () -> [string * string]?,
is_ready : () -> bool,
id : () -> string,
current : () -> request?,
set_queue : ([request]) -> unit,
add : (request) -> bool,
queue : () -> [request],
fetch : () -> bool,
push : ((request) -> unit)
.{uri : ((string) -> unit)
},
length : (() -> int)
}
but it should be a subtype of the type of the value at /home/liq/ices.liq, line 58, char 59-83
_ * _.{selected : _}
I don't even know what the errormessage means... The two sources "jingles" and "gbsfm_normal" are two working sources. What does the errormessage refer to when it says "this value"? And it should be a subtype of the value at like 58, char 59-83. Is that a subtype of true? Or a subtype of gbsfm_normal? If so, what kind of subtype?
Hello,
Sometimes the parser is not inferring types correctly. You can hint the type by appending :source
:
gbsfm = switch([(predicate.activates({ 0m-5m }), jingles:source), ({ true }, gbsfm_normal:source)])