Guest - Testers are needed for the reworked CDateTime core component. See... https://forum.kodi.tv/showthread.php?tid=378981 (September 29) x
  • 1
  • 16
  • 17
  • 18(current)
  • 19
  • 20
  • 22
Release Execute user tasks for Kodi events (callbacks ver2)
Prior to Kodi18 update this used to work for me and I used to for controlling the level of my lighting whilst play,stop,pause etc.

With this now broke is there a working alternative or built in method?
I just need to call a webpage url to talk to my home automation system.
Reply
Only work around I've found is to setup resume playing then pause for a second when I start a video. Annoying but I've gotten used to it.
Reply
Yeah I noticed it seems to work once the video is already in progress.
Reply
Hello All,

I would like to use the json notification event for volume changes. For that it is clear that I must specify xbmc as sender and Application.OnVolumeChange as method. But the addon also requests to specify the data. However, I wish to have trigger for any volume level and either muted or not. How to configure that then? Can I used wildcards for the data field?
Reply
Bump. Is it possible to use wildcards in the data field when subscribing to json notificatinions?
Reply
Hi all, I'm crudely jumping in here without reading a lot of the thread history. I just started looking into this plugin and also hit the issue that "on Playback started" does not function properly on Leia.
I managed to fix it by changing the "except KeyError:" in the getInfo routine on line 269 in player.py to "except:". I have not done any other testing, so this might break a whole bunch of other things, but it seems to fix the "on Playback started" event.

For people that speak json rpc and want to dig into this a bit more: The call on line 261:
player = json.loads(xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method": "Player.GetActivePlayers", "id": 1}'))
seems to respond the following when starting a new video:
{u'jsonrpc': u'2.0', u'id': 1, u'result': []}
This causes an "IndexError: list index out of range" in line 267. 
If a video was playing before and it got interrupted because you started another one, the response is:
{u'jsonrpc': u'2.0', u'id': 1, u'result': [{u'playerid': 1, u'type': u'video', u'playertype': u'internal'}]}
which does not trigger any issues in line 267&268
Reply
I created an account just so I could post here as I've been following this thread for a while. koekiemonster's fix works for me. I use the callbacks addon to control my home theater lights through Smartthings and webcore based on events in kodi (using north3221SmartThings on github to add kodi devices to smartthings). My nvidia shield still runs Kodi 17 specifically because callbacks hasn't worked with version 18. My computer has version 18 installed so I set up callbacks and a couple pistons in webcore to make changes to my lights when I play and stop a movie and it works. Very exciting! At this point, I haven't noticed anything that isn't working. Hopefully the fix doesn't break anything else, but so far it looks good to me. Thanks koekiemonster!
Reply
Thanks koekiemonster ! Can’t wait to test that !

EDIT >> YEP IT WORKS !!! Thanks

EDIT2 >>

Nope, there is a problem :

This fix works well with local video files, but doesn't work for streaming (TV or Netflix for example).
In this case the behavior is like before : it only works when a video interrupts another.

Any idea ?


EDIT 3 >>

Well maybe it's the script I execute who has a problem with streaming videos...
Forget what I just said above, I'll do tests.

Thanks and sorry !

4th AND LAST EDIT >>

Yep your workaround is working perfectly, my script was the fault !
(it was asking informations too fast for streaming videos, who didn't had the time to load... a simple delay of few seconds resolved the issue).

Thank you very much koekiemonster !!
Reply
I'd like to use the onShutdown option and I think it doesn't work...

Any idea ?
Thanks !
Reply
I found a workaround...
Still if anyone can fix this bug it would be helpfull ! Thanks
Reply
(2019-06-17, 23:07)koekiemonster Wrote: Hi all, I'm crudely jumping in here without reading a lot of the thread history. I just started looking into this plugin and also hit the issue that "on Playback started" does not function properly on Leia.
I managed to fix it by changing the "except KeyError:" in the getInfo routine on line 269 in player.py to "except:". I have not done any other testing, so this might break a whole bunch of other things, but it seems to fix the "on Playback started" event.

For people that speak json rpc and want to dig into this a bit more: The call on line 261:
player = json.loads(xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method": "Player.GetActivePlayers", "id": 1}'))
seems to respond the following when starting a new video:
{u'jsonrpc': u'2.0', u'id': 1, u'result': []}
This causes an "IndexError: list index out of range" in line 267. 
If a video was playing before and it got interrupted because you started another one, the response is:
{u'jsonrpc': u'2.0', u'id': 1, u'result': [{u'playerid': 1, u'type': u'video', u'playertype': u'internal'}]}
which does not trigger any issues in line 267&268
Thanks, that works! Probably it'll be safer to do it this way: "except (KeyError, IndexError):"
Reply
Hi guys, anyone successfully using event: onWindowOpen / onWindowClose ?

Not working for me.

Thanks!
Reply
Hi all!
I'd like to get some feedback for my ideas on how to use this addon in my setup.

I want to enable/disable my HTPC speakers based on the onPlayBackStarted/onPlayBackEnded (or onIdle/onResumeAfterIdle, not sure yet). When playback starts, the speakers are enabled. When it stops, a timer is created for (say) 5 minutes after which the speakers are disabled. A starting playback within the running timer countdown should disable any timer until playback stops again.

Since the callback addon will wait until a python script has returned, I was targeting a threaded solution. But implementing python routines and using threading.Timer objects failed since they don't seem to be non-blocking and discovery of the threads doesn't seem to work either.
Has anyone done sth. similar? Maybe using the custom task example? Are there existing projects in that direction?

Thanks in advance!
Reply
Any chance this will work with Kodi19?
Seems to be broken with the newly added Python 3.5.

2019-11-08 17:19:40.735 T:11132   ERROR: 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 'tasks'
                              
Please see here for more informations:
http://forum.kodi.tv/showthread.php?tid=...pid2896044

Thank you in advance
Reply
Does anyone have a fix for https://forum.kodi.tv/showthread.php?tid...pid2807195?
Reply
  • 1
  • 16
  • 17
  • 18(current)
  • 19
  • 20
  • 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.