on_metadata
and on_track
do not return a valid source anymore
#2509
Replies: 2 comments 5 replies
-
Thanks for your feedback. This is currently the way it is intended. You have:
Your code can be written two different ways: url = "https://securestream.o94.at/live.mp3"
input_stream = input.http(id="input_stream", url)
def handle_meta(meta) =
print("Called metadata handler and got: #{meta}")
end
# Works
id = input_stream.id()
print("Source ID: #{id}")
input_stream.on_metadata(handle_meta)
id = input_stream.id()
print("Source ID: #{id}") Or: url = "https://securestream.o94.at/live.mp3"
input_stream = input.http(id="input_stream", url)
def handle_meta(meta) =
print("Called metadata handler and got: #{meta}")
end
# Works
id = input_stream.id()
print("Source ID: #{id}")
input_stream = source.on_metadata(id="input_stream", url = "https://securestream.o94.at/live.mp3"
input_stream = input.http(id="input_stream", url)
def handle_meta(meta) =
print("Called metadata handler and got: #{meta}")
end
# Works
id = input_stream.id()
print("Source ID: #{id}")
input_stream = source.on_metadata(id="input_stream", input_stream, handle_meta)
id = input_stream.id()
print("Source ID: #{id}")handle_meta)
id = input_stream.id()
print("Source ID: #{id}") @smimram did that changes in #2103 and this had to do with making sure that handlers are only called when the returned source is being used while handlers registered directly using the source method will be called whenever the source is being consumed. This is mostly an internal concern to us, I believe but maybe he might want to add more to this discussion. |
Beta Was this translation helpful? Give feedback.
-
@smimram there is unfortunately another case which doesn't work anymore: url = "https://orf-live.ors-shoutcast.at/oe1-q2a"
in_stream = input.http(id="in_stream", start=false, url)
in_stream = insert_metadata(id="in_stream", in_stream)
in_stream = source.on_metadata(id="in_stream", in_stream, on_metadata_notification) Then calling this results in an error: in_stream.insert_metadata([("foo", "bar")])
A workaround might be to refer to the initial input source with a different var and ID only. But is this intended, that a chain of wrapped sources is not addressable anymore? Edit: I also notice in the logs, that switching between sources doesn't reference the actual sources anymore, but some auto-generated ID of the metadata source:
|
Beta Was this translation helpful? Give feedback.
-
Describe the bug
The documentation on migrating to 2.1.x states, that
on_track
andon_metadata
now return sources again, as previously in the 1.4.x releases:But it seems the return value is not a complete
source
object. E.g. missing theid
property.To Reproduce
The resulting error when trying to execute the script is:
Likewise
source.id(input_stream)
doesn't work either.Expected behavior
No error with the code above.
Version details
Install method
Debian package amd64
Beta Was this translation helpful? Give feedback.
All reactions