Guest - Testers are needed for the reworked CDateTime core component. See... https://forum.kodi.tv/showthread.php?tid=378981 (September 29) x
  • 1
  • 8
  • 9
  • 10(current)
  • 11
  • 12
  • 22
Release Execute user tasks for Kodi events (callbacks ver2)
I can't recreate, but I think what might be happening is that kodi is quitting before the task gets executed.
This can happen because of the threading model. You can try decreasing the task frequency under the general settings.
if that doesn't work, let me know and I'll see if lengthening the join timeout for the dispatcher thread helps, however, with a task frequency of 100ms and the current timeout of 500ms, there really shouldn't be any reason the shutdown message doesn't get taken out of the queue and processed.

If it's neither of those then I'm not quite sure why it is only intermittently working for you. These intermittent bugs in a threaded script can be difficult to sort out because they are often dependent on the processing state of external programs.
Reply
(2016-04-23, 15:16)KenV99 Wrote: Good news!!!

The addon has been accepted to the official repo.
Thank you all for your patience in pointing out bugs and helping me get this to this point.
I couldn't have done it without you.

Congratulations, thanks again for your time
Reply
Dear Ken,

first of all thank you for creating this addon!

There is a minor issue if a audio-file without mp3-tag is started. (Event: onPlayback started)

Code:
14:25:35 T:7112   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 "C:\Users\Aspire\AppData\Roaming\Kodi\addons\script.service.kodi.callbacks\resources\lib\publishers\player.py", line 313, in onPlayBackStarted
                                                self.getInfo()
                                              File "C:\Users\Aspire\AppData\Roaming\Kodi\addons\script.service.kodi.callbacks\resources\lib\publishers\player.py", line 255, in getInfo
                                                self.getAudioInfo(playerid)
                                              File "C:\Users\Aspire\AppData\Roaming\Kodi\addons\script.service.kodi.callbacks\resources\lib\publishers\player.py", line 163, in getAudioInfo
                                                info['artist'] = t[0]
                                            IndexError: list index out of range
                                            -->End of Python script error report<--

FYI: With "onPlayback resume" there is no error - it works fine!

I've read your howto and I know that new events are very unlikely. Never the less I just want request "onVolumeChanged" to the event-list, if its not a big deal for you,

Thank you!
Reply
Hello

sorry for my English

I find really extra addon, but crash with the accent (é, è, à , ...) would it be possible to fix that ?

Sorry to be French

/AUFS/Vidéos/Films/2012.mkv

Quote:10:59:15 T:140625028929280 NOTICE: $$$ [kodi.callbacks] - Task starting for onPlayBackStarted
10:59:15 T:140625028929280 ERROR: Exception in thread Dispatcher:
Traceback (most recent call last):
File "/usr/lib/python2.7/threading.py", line 810, in __bootstrap_inner
self.run()
File "/home/kodi/.kodi/addons/script.service.kodi.callbacks/resources/lib/pubsub.py", line 158, in run
s.notify(msg)
File "/home/kodi/.kodi/addons/script.service.kodi.callbacks/resources/lib/pubsub.py", line 314, in notify
raise e
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe9' in position 9: ordinal not in range(128)
Reply
(2016-05-23, 15:53)moosen Wrote: Dear Ken,

first of all thank you for creating this addon!

There is a minor issue if a audio-file without mp3-tag is started. (Event: onPlayback started)

Code:
14:25:35 T:7112   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 "C:\Users\Aspire\AppData\Roaming\Kodi\addons\script.service.kodi.callbacks\resources\lib\publishers\player.py", line 313, in onPlayBackStarted
                                                self.getInfo()
                                              File "C:\Users\Aspire\AppData\Roaming\Kodi\addons\script.service.kodi.callbacks\resources\lib\publishers\player.py", line 255, in getInfo
                                                self.getAudioInfo(playerid)
                                              File "C:\Users\Aspire\AppData\Roaming\Kodi\addons\script.service.kodi.callbacks\resources\lib\publishers\player.py", line 163, in getAudioInfo
                                                info['artist'] = t[0]
                                            IndexError: list index out of range
                                            -->End of Python script error report<--

FYI: With "onPlayback resume" there is no error - it works fine!

I've read your howto and I know that new events are very unlikely. Never the less I just want request "onVolumeChanged" to the event-list, if its not a big deal for you,

Thank you!

Thanks for the feedback. I'll provide a fix for that shortly on Github and post back. Will be a little while before it's available via the repo.
Reply
(2016-05-23, 19:04)rabillou Wrote: Hello

sorry for my English

I find really extra addon, but crash with the accent (é, è, à , ...) would it be possible to fix that ?

Sorry to be French

/AUFS/Vidéos/Films/2012.mkv

Quote:10:59:15 T:140625028929280 NOTICE: $$$ [kodi.callbacks] - Task starting for onPlayBackStarted
10:59:15 T:140625028929280 ERROR: Exception in thread Dispatcher:
Traceback (most recent call last):
File "/usr/lib/python2.7/threading.py", line 810, in __bootstrap_inner
self.run()
File "/home/kodi/.kodi/addons/script.service.kodi.callbacks/resources/lib/pubsub.py", line 158, in run
s.notify(msg)
File "/home/kodi/.kodi/addons/script.service.kodi.callbacks/resources/lib/pubsub.py", line 314, in notify
raise e
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe9' in position 9: ordinal not in range(128)

Thanks for letting me know. This may take a little while to fully track down. These unicode errors are notoriously bad.

Don't apologize for being French Smile
I have visited several times (Strasbourg, Colmar, Paris, Lille, Lyon) and I love your country. Everyone has always been so nice to me and I have made many friends. Marseille is next...
Reply
I pushed a new version to Github master.
With this update:
Better po file formatting
Fixes bug with unicode strings
Fixes bug with mp3 files with no tags
Improves onShutdown task

Please try it out if possible and let me know before I request it gets pulled into the repo.
Thx
Reply
Hi,

Firstly thanks for the great addon Smile

I seem to be encountering an error on startup:

Code:
13:55:31 T:4640   ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
                                             - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
                                            Error Type: <type 'exceptions.KeyError'>
                                            Error Contents: ('key',)
                                            Traceback (most recent call last):
                                              File "C:\Users\Rebecca\AppData\Roaming\Kodi\addons\script.service.kodi.callbacks\default.py", line 171, in <module>
                                                main()
                                              File "C:\Users\Rebecca\AppData\Roaming\Kodi\addons\script.service.kodi.callbacks\default.py", line 141, in main
                                                start()
                                              File "C:\Users\Rebecca\AppData\Roaming\Kodi\addons\script.service.kodi.callbacks\default.py", line 122, in start
                                                publisherfactory.createPublishers()
                                              File "C:\Users\Rebecca\AppData\Roaming\Kodi\addons\script.service.kodi.callbacks\resources\lib\publisherfactory.py", line 65, in createPublishers
                                                ipublisher = publisher(self.dispatcher, self.settings)
                                              File "C:\Users\Rebecca\AppData\Roaming\Kodi\addons\script.service.kodi.callbacks\resources\lib\publishers\loop.py", line 71, in __init__
                                                self.openwindowids = settings.getOpenwindowids()
                                              File "C:\Users\Rebecca\AppData\Roaming\Kodi\addons\script.service.kodi.callbacks\resources\lib\settings.py", line 172, in getOpenwindowids
                                                ret[evt['windowIdO']] = evt['key']
                                            KeyError: ('key',)
                                            -->End of Python script error report<--

My setting are (maybe i'm doing something wrong?

Code:
14:02:59 T:10688  NOTICE: $$$ [kodi.callbacks] - { 'Events': { 'E1': { 'task': 'T1',
                                                                  'type': 'onWindowOpen',
                                                                  'userargs': '',
                                                                  'windowIdO': 10025}},
                                              'General': { 'LogFreq': 500,
                                                           'LoopFreq': 500,
                                                           'Notify': True,
                                                           'TaskFreq': 100,
                                                           'elevate_loglevel': True},
                                              'Tasks': { 'T1': { u'import': False,
                                                                 'maxrunning': -1,
                                                                 'maxruns': -1,
                                                                 u'pythonfile': 'C:\\Users\\Rebecca\\AppData\\Roaming\\Kodi\\addons\\script.advanced.wol\\default.py',
                                                                 'refractory': -1,
                                                                 'type': 'python'}}}

I can't seem to get this version working with window open detection, this works fine on the old v2 version.

Thanks,
Reply
I pushed a fix for the windowid error to github master.
Please download, give it a try and let me know.
Reply
I have to apologize - I realized I've been pushing fixes to the wrong archive.

All fixes are now in both the master and non-repo branches on Github.

Please give them a try and let me know.

Changelog:
Better po file formatting
Fixes bug with unicode strings
Fixes bug with mp3 files with no tags
Fixes bug in reading windowsids from settings
Improves onShutdown task
Reply
@KenV99, is it possible to have a task that runs as plugin:// ?

Edit: The answer is yes
Kodi builtin
RunPlugin(plugin://......)
Reply
(2016-06-04, 20:50)delphiactual Wrote: @KenV99, is it possible to have a task that runs as plugin:// ?

Edit: The answer is yes
Kodi builtin
RunPlugin(plugin://......)

Yep - you got it Smile
Reply
Hey Ken,

Getting a startup error on one of my boxes and addon seems to only work some of the time =/

Code:
11:18:13 T:15172  NOTICE: $$$ [kodi.callbacks] - Staring kodi.callbacks ver: 0.9.9 (build 1008)
11:18:13 T:10316 WARNING: CPythonInvoker(13): Script invoked without an addon. Adding all addon modules installed to python path as fallback. This behaviour will be removed in future version.
11:18:13 T:15172   ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
                                             - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
                                            Error Type: <type 'exceptions.KeyError'>
                                            Error Contents: ('',)
                                            Traceback (most recent call last):
                                              File "C:\Users\User\AppData\Roaming\Kodi\addons\script.service.kodi.callbacks\default.py", line 171, in <module>
                                                main()
                                              File "C:\Users\User\AppData\Roaming\Kodi\addons\script.service.kodi.callbacks\default.py", line 141, in main
                                                start()
                                              File "C:\Users\User\AppData\Roaming\Kodi\addons\script.service.kodi.callbacks\default.py", line 106, in start
                                                settings.getSettings()
                                              File "C:\Users\User\AppData\Roaming\Kodi\addons\script.service.kodi.callbacks\resources\lib\settings.py", line 101, in getSettings
                                                self.getEventSettings()
                                              File "C:\Users\User\AppData\Roaming\Kodi\addons\script.service.kodi.callbacks\resources\lib\settings.py", line 128, in getEventSettings
                                                evt = self.getEventSetting(pid)
                                              File "C:\Users\User\AppData\Roaming\Kodi\addons\script.service.kodi.callbacks\resources\lib\settings.py", line 140, in getEventSetting
                                                et = Settings.eventsReverseLookup[et]
                                            KeyError: ('',)
                                            -->End of Python script error report<--

Any idea? Is this something fixed in the github version but not on repo?
Reply
I need to see the entire log.

See: http://kodi.wiki/view/Add-on:Kodi_Callbacks#FAQs
Reply
So I've wrote a Python script that can monitor network usage, and I want to execute the script when the 'shutdown' event kicks in. The idea is that the script determines if there is network activity and if so, prevent the shutdown from taking place.

But I'm having problems getting that to work. I'm pretty confident about the script, and I'm presuming it gets executed, but I'm also presuming that nothing is preventing Kodi from executing the actual Suspend action while the script is being executed: the script probably doesn't replace the Kodi action. Are there ways in the plugin to prevent Kodi from executing the actual event?
Reply
  • 1
  • 8
  • 9
  • 10(current)
  • 11
  • 12
  • 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.