v17 Need a bit of help with Kodi Callback functions and scripts/events. - Printable Version +- Kodi Community Forum (https://forum.kodi.tv) +-- Forum: Support (https://forum.kodi.tv/forumdisplay.php?fid=33) +--- Forum: General Support (https://forum.kodi.tv/forumdisplay.php?fid=111) +---- Forum: OS independent / Other (https://forum.kodi.tv/forumdisplay.php?fid=228) +---- Thread: v17 Need a bit of help with Kodi Callback functions and scripts/events. (/showthread.php?tid=335330) |
Need a bit of help with Kodi Callback functions and scripts/events. - xsoalokinx - 2018-09-08 Okay, so here is what the main issue is for me. I am using PS4 dualshock controller via bluetooth to control my raspberry pi 3b running Kodi. With the native linux drivers for the controller, there is no idle checks to turn the controller off when not in use. So eventually, if the controller isn't powered off it will just die. I thought I could come up with a solution by creating some bash scripts. Eventually I discovered the Kodi Callbacks addon from the official repo. Using this addon, and my own script I was able to have my script executed when Kodi screensaver got activated. My script simply just disables and then re-enables bluetooth. This solution works fine for all scenerios except for when playing media. While playing media the screensaver in kodi will never be executed. Also, Kodi Callback addon has a number of events to use, like On Playback Start/Resume/End and more, but it doesn't have On Playback Stop. I was thinking I could execute another script on playback start, and then terminate the script on playback stop using the addon. But without the Playback stop event being built into the addon I am not able to do this. I am just a beginner when it comes to the code, but I can understand it. I found a function for playback stop I am not sure how to go about writing a python script in order to use this. Can anybody help me out if they can? Thank you. Code: onPlayBackStopped() |