2016-01-12, 17:44
Hello,
Pilulli originally wrote a service addon doing this. Long ago, I forked this and have apologetically hi-jacked his thread with my fork.
I am starting this new thread with the release of a completely rewritten version of my own code.
In short, users can create their own tasks that will be run when specific events occur in Kodi.
If you are familiar with the smartphone app IFTTT, it works something like that.
Task types include running scripts, running python scripts in the Kodi namespace, running Kodi builtin functions and sending http response objects.
There are currently 28 different events that can be responded to.
Lastly, new task types can be created and added into the program to share the fruits of your labors, if you wish.
Please see the wiki for this addon at: Add-on:Kodi_Callbacks (wiki)
I put a lot of effort into writing the wiki. I won't duplicate the details here.
As of 22-4-2016 the addon can be installed from the OFFICIAL KODI REPO (Isengard or higher).
Alternatively, the addon can be downloaded from Github at: https://github.com/KenV99/script.service...astero.zip
PLEASE RENAME THE DIRECTORY AFTER INSTALLING TO: 'script.service.kodi.callbacks'. (i.e. remove '-master').
Please post-back with problems or questions. Please post a link to an uploaded log if you are encountering errors. Also NEW click 'Write settings to log' on the Settings-General page so that your settings are in the log.
Update 6-16-16:
New version 1,0.0 in the official repo.
Several bug fixes for window monitoring, unicode support and shutdown events.
Update 2-27-16:
MAJOR update!
Unfortunately, this one will require you to hit the default button and re-enter your settings. Sorry!
This implements a workaround for a Kodi settings issue that prevented me from properly submitting for inclusion in the official repo.
You will see several new settings and the way that the settings are implemented.
Check out the Update tools too! If you experience an issue downloading from GitHub, just try again. It seems to fail sometimes on the first time around.
Update 2-17-16:
Added schedule publisher. Using 24H time, tasks can run at a set time. Alternatively a task can run at a set interval.
Added update tools to settings. Beta feature. Hopefully can streamline installing new versions.
Update 2-3-16:
Added a file watchdog routine to detect file system changes between runs of Kodi - during startup if files/directories in a watched file have changed, the event fires.
Requires a normal shutdown when Kodi exits.
Added some exception catching for Android.
Update 1-31-16:
Changed name to script.service.kodi.callbacks to be c/w official repo naming rules.
Please note that this update will require you to input your settings again. Apologies for that.
Update 1-29-16:
Fixed bug in localization routine for strings with newlines.
Made localization files Singleton to decrease disk I/O.
Update 1-25-16:
I localized all the strings that I could except the ones with the selector bug and pushed an update. Please let me know if you see any bugs in the Settings or get strange or empty messages on the screen or in the log.
This won't directly affect anyone since there are no translations, but wanted to make you aware.
Added on Resume After Idle event.
Update 1-22-16:
Several bugs were fixed including the builtin (kudos dfns) and an occasional issue on windows with scripts generating an access denied error.
I have added an Event for file system changes inspired by takoi's service.watchdog and the dependency mentioned below has been removed.
The syntax for the parameters can be found (loosely) at: https://pythonhosted.org/watchdog/api.ht...entHandler
I also added to the general settings a button to test that the four native tasks are working properly on your system to help with troubleshooting.
Note: this uses Kodi's JSON server and assumes that it is not configured with a username and password. If your's is, some tests will fail.
Pilulli originally wrote a service addon doing this. Long ago, I forked this and have apologetically hi-jacked his thread with my fork.
I am starting this new thread with the release of a completely rewritten version of my own code.
In short, users can create their own tasks that will be run when specific events occur in Kodi.
If you are familiar with the smartphone app IFTTT, it works something like that.
Task types include running scripts, running python scripts in the Kodi namespace, running Kodi builtin functions and sending http response objects.
There are currently 28 different events that can be responded to.
Lastly, new task types can be created and added into the program to share the fruits of your labors, if you wish.
Please see the wiki for this addon at: Add-on:Kodi_Callbacks (wiki)
I put a lot of effort into writing the wiki. I won't duplicate the details here.
As of 22-4-2016 the addon can be installed from the OFFICIAL KODI REPO (Isengard or higher).
Alternatively, the addon can be downloaded from Github at: https://github.com/KenV99/script.service...astero.zip
PLEASE RENAME THE DIRECTORY AFTER INSTALLING TO: 'script.service.kodi.callbacks'. (i.e. remove '-master').
Please post-back with problems or questions. Please post a link to an uploaded log if you are encountering errors. Also NEW click 'Write settings to log' on the Settings-General page so that your settings are in the log.
Update 6-16-16:
New version 1,0.0 in the official repo.
Several bug fixes for window monitoring, unicode support and shutdown events.
Update 2-27-16:
MAJOR update!
Unfortunately, this one will require you to hit the default button and re-enter your settings. Sorry!
This implements a workaround for a Kodi settings issue that prevented me from properly submitting for inclusion in the official repo.
You will see several new settings and the way that the settings are implemented.
Check out the Update tools too! If you experience an issue downloading from GitHub, just try again. It seems to fail sometimes on the first time around.
Update 2-17-16:
Added schedule publisher. Using 24H time, tasks can run at a set time. Alternatively a task can run at a set interval.
Added update tools to settings. Beta feature. Hopefully can streamline installing new versions.
Update 2-3-16:
Added a file watchdog routine to detect file system changes between runs of Kodi - during startup if files/directories in a watched file have changed, the event fires.
Requires a normal shutdown when Kodi exits.
Added some exception catching for Android.
Update 1-31-16:
Changed name to script.service.kodi.callbacks to be c/w official repo naming rules.
Please note that this update will require you to input your settings again. Apologies for that.
Update 1-29-16:
Fixed bug in localization routine for strings with newlines.
Made localization files Singleton to decrease disk I/O.
Update 1-25-16:
I localized all the strings that I could except the ones with the selector bug and pushed an update. Please let me know if you see any bugs in the Settings or get strange or empty messages on the screen or in the log.
This won't directly affect anyone since there are no translations, but wanted to make you aware.
Added on Resume After Idle event.
Update 1-22-16:
Several bugs were fixed including the builtin (kudos dfns) and an occasional issue on windows with scripts generating an access denied error.
I have added an Event for file system changes inspired by takoi's service.watchdog and the dependency mentioned below has been removed.
The syntax for the parameters can be found (loosely) at: https://pythonhosted.org/watchdog/api.ht...entHandler
I also added to the general settings a button to test that the four native tasks are working properly on your system to help with troubleshooting.
Note: this uses Kodi's JSON server and assumes that it is not configured with a username and password. If your's is, some tests will fail.