Guest - Testers are needed for the reworked CDateTime core component. See... https://forum.kodi.tv/showthread.php?tid=378981 (September 29) x
  • 1
  • 18
  • 19
  • 20
  • 21(current)
  • 22
Release Execute user tasks for Kodi events (callbacks ver2)
I see some people have trouble with On Playback Started with Kodi 18, but it's working fine for me. On Playback Paused, is not working though. Does anyone know how I can get it working?
Reply
I need a way to send commands on play/pause/stop events, Callbacks seems to not be anymore a solution on Kodi 19, is there any other alternative ?
Reply
I have been using callbacks for many years successfully until I went to 19.3.  I miss it. Don't expect anything real soon, but I have been working on a fix for several weeks now and am close to having it working.  I only use onPlayStarted, onPlayResumed, and onPlayStopped, so I am only trying to get those working.  Also I am executing a Python script when one of these events is triggered. And to add one more thing, I use "import and run".
So keep checking here and I may have a fix real soon. I already think I have the callback code fixed.  The problem (for me) seems to be in the "taskPython.py" script.  So now making some fixes in my code.
Stay tuned.
Reply
(2022-03-12, 19:24)ReplayHarry Wrote: I have been using callbacks for many years successfully until I went to 19.3.  I miss it. Don't expect anything real soon, but I have been working on a fix for several weeks now and am close to having it working.  I only use onPlayStarted, onPlayResumed, and onPlayStopped, so I am only trying to get those working.  Also I am executing a Python script when one of these events is triggered. And to add one more thing, I use "import and run".
So keep checking here and I may have a fix real soon. I already think I have the callback code fixed.  The problem (for me) seems to be in the "taskPython.py" script.  So now making some fixes in my code.
Stay tuned.


Have you heard about this fix? I’ve been trying to do that, but I can’t find an app on my Shield, that would allow me to edit that file. Image
Reply
(2021-03-04, 23:29)pikim Wrote: I forked the plugin on Github and began to port it to Python 3. When there's no configuration existing it starts without errors, but it does not work at the moment. Could you please install it, create a configuration and give me some feedback: what did you do and which error occurred in the kodi.log.
I'll try to fix the issues, but I've only limited time and no experience with Kodi plugin development, so please be patient.

You can download it under https://github.com/pikim/script.service.kodi.callbacks -> Code -> Download ZIP. Unzip the content into the Kodi addon directory and remove the trailing '-master' from the directory name.


I don’t see the zip file under “Code”. Am I missing something?
Reply
Yes, I saw that and included that in my "fixed" code, but there were other things wrong too. Just need a bit more time and then I think I will have a fix that is useable.
Reply
(2022-03-15, 00:07)ReplayHarry Wrote: Yes, I saw that and included that in my "fixed" code, but there were other things wrong too. Just need a bit more time and then I think I will have a fix that is useable.


That fix worked for me on Kodi 18.9
Reply
Tried installing the addons on Kodi 19 which is now using Python 3.x only. The error I got trying to install callback, "The dependency on xbmc.python version 2.20.0 could not be satisfied".
I am assuming the code for this addon needs to be updated to use the Python 3.x library. Any chance will this be updated?
Reply
(2022-04-14, 20:22)hieppo Wrote: Tried installing the addons on Kodi 19 which is now using Python 3.x only. The error I got trying to install callback, "The dependency on xbmc.python version 2.20.0 could not be satisfied".
I am assuming the code for this addon needs to be updated to use the Python 3.x library. Any chance will this be updated?
NVM, did some digging and found an updated github, for those have the same question, here is the updated github repo. https://github.com/pikim/script.service.kodi.callbacks
Reply
I was looking for an add-on who allows me to execute at the Kodi 'onStartup' and 'onShutdown' events some command, exactly a windows power management cmd like this:
cpp:
powercfg /change monitor-timeout-ac 120
I found the Callbacks add-on but nothing else AND I found that is no longer 100 % working at Kodi v19 due to its Python 2 source code. What a pity! It would be great if some of the many forks (I saw 23) would be successful. 
Anyhow I will try now the fork of pikim and I will see how far I will come.
Reply
(2022-03-13, 07:33)lennie paz Wrote: I don’t see the zip file under “Code”. Am I missing something?
There is a green button with name 'Code', click it. Now you see some new stuff and at the end the item 'Download ZIP'.
Reply
(2022-04-15, 11:37)_Michael_ Wrote: Anyhow I will try now the fork of pikim and I will see how far I will come.
Unfortunately not that far, i.e. the add-on was not allowing me to select any event in the 'Events' tab sheet. Kodi.log excerpt:
xml:
2022-04-15 12:15:55.582 T:8148    DEBUG <general>: CPythonInvoker(3, C:\Program Files\Kodi\addons\script.service.kodi.callbacks\script.py): the source file to load is "C:\Program Files\Kodi\addons\script.service.kodi.callbacks\script.py"
2022-04-15 12:15:55.582 T:8148    DEBUG <general>: CPythonInvoker(3, C:\Program Files\Kodi\addons\script.service.kodi.callbacks\script.py): setting the Python path to C:\Program Files\Kodi\addons\script.service.kodi.callbacks;C:\Program Files\Kodi\system\python\Lib;C:\Program Files\Kodi\python3.8.zip;C:\Program Files\Kodi\system\python\DLLs;C:\Program Files\Kodi;C:\Program Files\Kodi\system\python;C:\Program Files\Kodi\system\python\lib\site-packages
2022-04-15 12:15:55.582 T:8148    DEBUG <general>: CPythonInvoker(3, C:\Program Files\Kodi\addons\script.service.kodi.callbacks\script.py): entering source directory C:\Program Files\Kodi\addons\script.service.kodi.callbacks
2022-04-15 12:15:55.582 T:8148    DEBUG <general>: CPythonInvoker(3, C:\Program Files\Kodi\addons\script.service.kodi.callbacks\script.py): instantiating addon using automatically obtained id of "script.service.kodi.callbacks" dependent on version 3.0.0 of the xbmc.python api
2022-04-15 12:15:55.610 T:6476    DEBUG <general>: Thread JobWorker 6476 terminating (autodelete)
2022-04-15 12:15:55.610 T:1264    DEBUG <general>: Thread JobWorker 1264 terminating (autodelete)
2022-04-15 12:15:55.610 T:384     DEBUG <general>: Thread JobWorker 384 terminating (autodelete)
2022-04-15 12:15:55.610 T:5088    DEBUG <general>: Thread JobWorker 5088 terminating (autodelete)
2022-04-15 12:15:55.615 T:5124    DEBUG <general>: Keyboard: scancode: 0x1d, sym: 0x306, unicode: 0x0000, modifier: 0x64
2022-04-15 12:15:55.615 T:5124    DEBUG <general>: CInputManager::HandleKey: ctrl-leftctrl (0x1f0d0) pressed, action is 
2022-04-15 12:15:55.615 T:5124    DEBUG <general>: Keyboard: scancode: 0x38, sym: 0x308, unicode: 0x0000, modifier: 0x320
2022-04-15 12:15:55.615 T:5124    DEBUG <general>: CInputManager::HandleKey: ctrl-alt-leftalt (0x5f0d4) pressed, action is 
2022-04-15 12:15:55.635 T:8148    DEBUG <general>: Could not locate po at C:\Users\HTPC\AppData\Roaming\Kodi\addons\script.service.kodi.callbacks\resources\language\English\strings.po
2022-04-15 12:15:55.638 T:8148  WARNING <general>: xbmc.translatePath is deprecated and might be removed in future kodi versions. Please use xbmcvfs.translatePath instead.
2022-04-15 12:15:55.666 T:8148    ERROR <general>: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
                                                    - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
                                                   Error Type: <class 'ModuleNotFoundError'>
                                                   Error Contents: No module named 'requests'
                                                   Traceback (most recent call last):
                                                     File "C:\Program Files\Kodi\addons\script.service.kodi.callbacks\script.py", line 25, in <module>
                                                       import resources.lib.pubsub as PubSub_Threaded
                                                     File "C:\Program Files\Kodi\addons\script.service.kodi.callbacks\resources\lib\__init__.py", line 77, in <module>
                                                       module = __import__(modname, fromlist="dummy")
                                                     File "C:\Program Files\Kodi\addons\script.service.kodi.callbacks\resources\lib\tasks\taskHttp.py", line 20, in <module>
                                                       import requests
                                                   ModuleNotFoundError: No module named 'requests'
                                                   -->End of Python script error report<--
                                                   
2022-04-15 12:15:55.666 T:8148    DEBUG <general>: CPythonInvoker::onExecutionDone(3, C:\Program Files\Kodi\addons\script.service.kodi.callbacks\script.py)
2022-04-15 12:15:55.668 T:8148     INFO <general>: Python interpreter stopped
2022-04-15 12:15:55.669 T:8148    DEBUG <general>: Thread LanguageInvoker 8148 terminating
Reply
I've no experience with Kodi on Windows. Could you try
python:
pip install requests
in a command window? Maybe you'll have to go to
python:
C:\Program Files\Kodi\system\python
first. But I've no idea whether pip works on your setup.
Reply
I do not know what "pip" is or means for the error I posted before. Anyhow you wrote "I've no experience with Kodi on Windows." which makes it difficult if not impossible to continue ...
In the meanwhile I solved my problem outside of Kodi, see here (link). I whish your work on the callbacks add-on all the best but I'm out.
Happy easter!
_Michael_
Reply
Hi,

I want to execute a python file only when an audio file starts, an another if a movie starts for example.
Is that possible with this addon ?
I saw the %mt argument, but I don't know how to use it ...

Thanks.
Reply
  • 1
  • 18
  • 19
  • 20
  • 21(current)
  • 22

Logout Mark Read Team Forum Stats Members Help
Execute user tasks for Kodi events (callbacks ver2)3
This forum uses Lukasz Tkacz MyBB addons.