Closed Tenn0 closed 3 years ago
No, there is no method currently available for removing a listener.
I've implemented a new function remove_listener(<callback>)
(see #35) that removes a callback completely from the receiver. This means a listener can only be removed completely, even if it was listening to multiple universes.
Do you require to remove a callback specifically per universe or only globally?
If you use one callback for all universes, you could remove it and immediately after that re-register with all universes that you want to listen to. No need to restart the receiver.
Im listening with each callback to a seperate universe. Ive worked around by setting "receiver._callbacks[universe]" to an empty string. My intention is setting up callbacks for every universe dynamically, that i can switch the control source of my devices from sACN to manual. Or add/remove devices to sACN control at runtime. Btw thanks for implementing it that fast!
The new function is available in v1.7.0
, see the release.
If this satisfied your feature request, close this issue, otherwise feel free to leave feedback.
After i thought how i could use it, i came to the conclusion, that a it would be better to remove the listener from the universe by the universe number, instead of the callback name. My callbacks are simply called "callback", assigned to the listerner via a for loop, so i dont know how to use the current implementation. Maybe i have not the knowledge yet, maybe its impossible to do it this way
it would be better to remove the listener from the universe by the universe number
Yeah, I thought about that too during my first implementation.
I simply implemented another function for this use case in v1.8.0
, see the release.
Nice, thank you very much! Gonna adapt my software to the new release!
Is it possible to remove the listener callback for one universe? And if, how do i do so? My use is that i setup dynamically callbacks with universes and if i want to not listen anymore to a specific universe because i want to display another effect/static lights), my current idea would be stopping the whole receiver, build a list with all devices that should still receive data and re-setup all universes. If you want to have a look at my code, head over to here: https://github.com/Tenn0/iCue2sACN/blob/8442c6cfe06d8ace11d91254b42877a5108da973/src/main.py