Callback examples on audio track change? - Printable Version +- Kodi Community Forum (https://forum.kodi.tv) +-- Forum: Development (https://forum.kodi.tv/forumdisplay.php?fid=32) +--- Forum: Add-ons (https://forum.kodi.tv/forumdisplay.php?fid=26) +---- Forum: Audio DSP (https://forum.kodi.tv/forumdisplay.php?fid=235) +---- Thread: Callback examples on audio track change? (/showthread.php?tid=363488) |
Callback examples on audio track change? - monsterMagic - 2021-07-09 Hi I'm new to Python and learning how to code for Kodi. I'm building a music-add on that will produce an endless playlist, the issue that I have is around how to "subscribe" to a track change so that I can queue up the next track. Is there a working example of a callback? I think I want something like, onQueueNextItem but the docs just have the one liner. I've seen lots of code that just loads a playlist and then exits so that doesn't help me and my understanding is that my script will be dumped out unless I hold it alive with a sleep loop? However if I throw a sleep in then I get dumped by Kodi "script didn't stop in 5 seconds - let's kill it" which seems fine as it just doesn't feel the right way of doing it? I feel I should be creating a subscribe event and then Kodi will call it but then I appreciate this may be my lack of Python knowledge so far. So are there any examples that I can learn from as I want to ensure I use the right method of doing this and not implement some bad practice from legacy code. Any help greatly appreciated Thanks in advance |