Skip to content

liquidsoap-2.3 replacement for on_leave() #4204

Answered by toots
periode asked this question in Q&A
Discussion options

You must be logged in to vote

This is a limitation with the typing system. Once you start calling the source's methods, it assumes all sources in the list must have the same methods.

The most simple solution is to give the typechecker a hint that you only need sources with no methods. Something like this:

def request_rotate(src) = 
    # Using source.id() prevents the typechecker from assuming that src has a id method
    id = source.id(src)
    print(id)
end

def transition(old_source, new_source) =
    thread.run(delay=1., {request_rotate(old_source)})
    
    # Tell sequence that all we need here is a list of sources, don't care about methods:
    sequence([(old_source:source), (new_source:source)])
end

Replies: 3 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@toots
Comment options

Answer selected by periode
@periode
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants