Kodi Community Forum
Release Execute user tasks for Kodi events (callbacks ver2) - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Support (https://forum.kodi.tv/forumdisplay.php?fid=33)
+--- Forum: Add-on Support (https://forum.kodi.tv/forumdisplay.php?fid=27)
+---- Forum: Service Add-ons (https://forum.kodi.tv/forumdisplay.php?fid=152)
+---- Thread: Release Execute user tasks for Kodi events (callbacks ver2) (/showthread.php?tid=256170)

Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22


RE: Execute user tasks for Kodi events (callbacks ver2) - marc.breuer - 2019-02-19

The "onPlayBackStarted" event on leia seems to be called once after reboot, after that it's not called anymore.
Is this a Leia bug or an addon bug? Would be nice to get an update.
The "onPlayBackResumed" event works fine, so I need to pause and resume every video, as this calls the same smarthome functions here.

Best regards,
Marc


RE: Execute user tasks for Kodi events (callbacks ver2) - giss73 - 2019-03-02

The fact is that kodi Callbacks is no longer working on Leia and it seems that KenV99 has abandoned the project. So we have to hope that someone takes the KenV99 project.


RE: Execute user tasks for Kodi events (callbacks ver2) - i3laze - 2019-03-13

Leia. What’s this crash is about?

2019-03-13 18:22:46.963 T:3186619248 NOTICE: $$$ [kodi.callbacks] - Settings read
2019-03-13 18:22:46.965 T:3186619248 NOTICE: $$$ [kodi.callbacks] - Dispatcher initialized
2019-03-13 18:22:46.970 T:3186619248 NOTICE: $$$ [kodi.callbacks] - Subscriber for event: onPlayBackStarted, task: T1 created
2019-03-13 18:22:46.977 T:3186619248 NOTICE: $$$ [kodi.callbacks] - Player Publisher initialized
2019-03-13 18:22:46.981 T:3186619248 NOTICE: $$$ [kodi.callbacks] - Dispatcher started
2019-03-13 18:22:46.984 T:3186619248 NOTICE: $$$ [kodi.callbacks] - Publisher(s) started
2019-03-13 18:22:57.971 T:4094574512 NOTICE: VideoPlayer::OpenFile: videodb://inprogresstvshows/94/-2/1995?season=-2&tvshowid=94
2019-03-13 18:22:57.972 T:3151532912 NOTICE: Creating InputStream
2019-03-13 18:22:57.975 T:3151532912 NOTICE: Creating Demuxer
2019-03-13 18:22:57.994 T:3171939184 ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
- NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
Error Type: <type 'exceptions.IndexError'>
Error Contents: list index out of range
Traceback (most recent call last):
File "/storage/.kodi/addons/script.service.kodi.callbacks/resources/lib/publishers/player.py", line 331, in onPlayBackStarted
self.getInfo()
File "/storage/.kodi/addons/script.service.kodi.callbacks/resources/lib/publishers/player.py", line 267, in getInfo
playerid = player['result'][0]['playerid']
IndexError: list index out of range
-->End of Python script error report<--


RE: Execute user tasks for Kodi events (callbacks ver2) - pikim - 2019-03-14

(2019-03-13, 17:24)i3laze Wrote: What’s this crash is about?

Without really knowing the plugin or your configuration it looks like no player could be loaded from the configuration. Whatever a player may be here...

You could try to edit line 269 in file /storage/.kodi/addons/script.service.kodi.callbacks/resources/lib/publishers/player.py into
except (IndexError, KeyError):
instead of
except KeyError:

Maybe this helps.


RE: Execute user tasks for Kodi events (callbacks ver2) - i3laze - 2019-03-16

Here's the deal.. /storage/.kodi/addons/script.service.kodi.callbacks/resources/lib/publishers/player.py Line 258:
python:
while tries < 8 and self.isPlaying() is False:
   xbmc.sleep(250)

Seems isPlaying() returns True (thus no delay occurs), but player actually haven’t initialized yet.

I've added extra xbmc.sleep(1000) delay below and now JSON-query returns Player data successfully.
Eventually Callbacks then fires tasks.

P.S. Warnings in log are related to add-on config parsed badly.. it also affects add-on Settings displayed crappy.


RE: Execute user tasks for Kodi events (callbacks ver2) - jeffkjolley - 2019-03-22

So, I changed xbmc.sleep to (1000). Now it will reliably update the status when watching anything on the PVR (Myth), it will sometimes update the status when starting a TV show, but it will never update the status when starting a movie. I'm stumped.


RE: Execute user tasks for Kodi events (callbacks ver2) - badsheep - 2019-03-29

Hello,

I'm trying too to use the "onPlayBackStarted" event but it doesn't work well...

But I identified a systematic behavior : it works ONLY when you run a video that interrupts another one playing.

if you start a video with no video playing in background, it doesn't work.

If this can help someone to debug the plugin, it would be very helpful !!

Thanks


RE: Execute user tasks for Kodi events (callbacks ver2) - badsheep - 2019-03-29

I have a little question by the way, I'm not sure to understand well how this addon works.

When I choose "onPlayBackStarted", I can only transmit the variables that are listed below ?
(%li, %wi, %fn, %ti,...)

Or I can transmit another variable ?
I need to transmit the information of number of channels of the media playing (2.0 or 5.1 for example)

Is it possible with this add-on ?


RE: Execute user tasks for Kodi events (callbacks ver2) - badsheep - 2019-04-01

OK,

I was able to do it with a python script with the line :

NbreCanaux = xbmc.getInfoLabel('VideoPlayer.AudioChannels')

No need for variable substitution... and I realize that thanks to that wonderful addon, I think it's possible to access to almost anything in Kodi !!

Now If someone can fix that little bug (post #247), that would be amazing Smile
Thanks


RE: Execute user tasks for Kodi events (callbacks ver2) - NeBouse - 2019-04-03

@KenV99 are you still around ? any plan on fixing the addon for Leia ?


RE: Execute user tasks for Kodi events (callbacks ver2) - griffindodd - 2019-04-07

Hoping someone here can help me with some basic use. I'm trying to use callbacks to play background music in the menus and pause/play when I start stop a movie.

I started trying to to use a builtin command like this..

PlayMedia(C:/Media/Music/LondonSymphonyOrchestra/JohnWilliamsALifeInMusic,[isdir:
)]

and although I don't get any errors, I also don't hear any music either. Do I have my syntax wrong?


RE: Execute user tasks for Kodi events (callbacks ver2) - griffindodd - 2019-04-07

uhmmm, I guess I can't edit posts, here is my command to try and play songs in a directory..

PlayMedia(C:/Media/Music/LondonSymphonyOrchestra/JohnWilliamsALifeInMusic,[isdir])


RE: Execute user tasks for Kodi events (callbacks ver2) - i3laze - 2019-04-08

(2019-03-22, 22:09)jeffkjolley Wrote: So, I changed xbmc.sleep to (1000). Now it will reliably update the status when watching anything on the PVR (Myth), it will sometimes update the status when starting a TV show, but it will never update the status when starting a movie. I'm stumped.

Looks like the “while tries < 8“ doesn’t fire in Leia at all.
So it’s not about changing but adding extra line with xbmc.sleep(1000).
Try also 2000 (2 sec) or more - maybe your CPU is a bit choking on playback start.


RE: Execute user tasks for Kodi events (callbacks ver2) - badsheep - 2019-04-08

(2019-04-08, 06:42)i3laze Wrote:
(2019-03-22, 22:09)jeffkjolley Wrote: So, I changed xbmc.sleep to (1000). Now it will reliably update the status when watching anything on the PVR (Myth), it will sometimes update the status when starting a TV show, but it will never update the status when starting a movie. I'm stumped.

Looks like the “while tries < 8“ doesn’t fire in Leia at all.
So it’s not about changing but adding extra line with xbmc.sleep(1000).
Try also 2000 (2 sec) or more - maybe your CPU is a bit choking on playback start. 
Not working here unfortunately...
Tried with several values, till 5000....
Nothing happens when a video starts.

BUT as I mentioned in #247, it ALWAYS works when a video interrupts another !


RE: Execute user tasks for Kodi events (callbacks ver2) - tstack77 - 2019-04-15

(2019-04-08, 22:26)badsheep Wrote: Not working here unfortunately...
Tried with several values, till 5000....
Nothing happens when a video starts.

BUT as I mentioned in #247, it ALWAYS works when a video interrupts another ! 
 Can confirm. I've tried all suggested workarounds and can only get the callback to fire by starting a video while one is already playing. Very weird.