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) |
RE: Execute user tasks for Kodi events (callbacks ver2) - kulgan - 2017-05-05 Hi, I'm using osmc on PI3. kodi 17.1 callbacks 1.0 I use 2 profiles "Enfants" and "Master User" at boot, kodi start on "Enfants". What I'm trying to acheive is, when using Master user profile, "on screensaver activate" to have an automatic kodi restart (and so to be back in "Enfants" profiles) Issue : is seems calback addon only load configuration of first profile, indeed If in both profile callback is reconfigured to restart onscreensaveractivated, "Master user" is properly restarted (but in that case "Enfants" is also restarted.) if "Enfants" is configured to no action and Master to restart on screensaver : restart doesn't happen. Note : if when log in master I enter callback addon configuration, after existing configuration, then restart happenned on screensaveractivate. Thanks for your help. RE: Execute user tasks for Kodi events (callbacks ver2) - stephr1 - 2017-05-08 Bump...anyone? (2017-04-23, 17:40)stephr1 Wrote: BUMP!! Anyone offer any help here? Thx.... RE: Execute user tasks for Kodi events (callbacks ver2) - KenV99 - 2017-05-08 (2017-05-08, 18:44)stephr1 Wrote: Bump...anyone? The events are listed in the Wiki:Add-on:Kodi_Callbacks (wiki) There are no events for recording and I don't know how that could be done. IF you know of another way of checking, you could write your own code to check if a recording is occurring and IF you know how to turn on the LED in code then send the codes to turn it on or off depending on coding state. If the above is true, then you COULD use the onIntervalAlarm to call the above intermittently (like every second). However, if you know how to code all of the above, consider writing your own addon to do it. RE: Execute user tasks for Kodi events (callbacks ver2) - nickr - 2017-05-09 @stephr1 this is really a backend job I think. Which backend are you using? RE: Execute user tasks for Kodi events (callbacks ver2) - jant90 - 2017-05-24 Is it possible to execute 2 built-in Kodi functions with a minor sleep in between them under one task? I've currently set it up my task as "Kodi Builtin Function: Action(xxxxxx)" and I want something like "Kodi Builtin Function: Action(xxxxxx); sleep250ms; Action(xxxxxx);", is something like that possible? RE: Execute user tasks for Kodi events (callbacks ver2) - jant90 - 2017-05-25 I think I solved it by creating an external script that utilizes the JSON RPC: Code: curl --silent --user user:pass --header 'Content-Type: application/json' --data-binary '{"jsonrpc":"2.0","id":1,"method":"Input.ExecuteAction","params":{"action":"actionhere"}}' 'http://localhost:8080/jsonrpc' Possible actions can be found here: http://kodi.wiki/view/Action_IDs RE: Execute user tasks for Kodi events (callbacks ver2) - CaptainHero - 2017-06-01 Hi Guys, I found this addon while searching for a solution to deactivate and reactivate certain processes that are running on my Libreelec installation when i start to watch a movie. I use a Cubox-i4 Pro as my HTPC which runds Libreelec and Kodi 17.3. The cubox additionally runds my Sickrage, Transmission and NzbGet clients which manage my automated downloads towards my NAS. What i would like to achieve is that when i start to watch a movie or a tvshow that Kodi: - Either pauses all downloads in NZBGet (via a possible API call?) or if that is not possible kill the NZBGet process altogether. - Kill Sickrage process - Kill Transmission process once playback of a movie has stopped Kodi should automatically - Resume all downloads in NZBGet or if process was killed start NZBGet daemon again - Restart Sickrage process - Restart Transmission process I guess this can be done via the builtin functions of this addon by calling scripts or maybe shell commands but as i have very very limited linux script knowledge i am unsure how to go about this to achieve above mentioned goals. Can anyone who is more proficient in this help me here? Or if not at least give me the right pointers/examples of how i could reach the above goal? Cheers! RE: Execute user tasks for Kodi events (callbacks ver2) - CaptainHero - 2017-06-01 Ok i think i got what i want. I simply created two one line scripts with the appropriate killall shell command to stop the service. I just tryed it with sickrage and it works. So i guess i'll just rince and repeat this for the two other applications and then i'm set. Probably not the most elegant solution but at least it works RE: Execute user tasks for Kodi events (callbacks ver2) - valdo lopes - 2017-06-09 Hello everyone!! I'm trying to start a python script, for 1 led to light up when pausing a file, but I'm getting error. https://pastebin.com/Km1UsXhu Code: #!/usr/bin/python [code]ERROR encountered for Task T1, Event onPlayBackPaused ERROR mesage: <attribute 'message' of 'exceptions.BaseException' objects> <type 'exceptions.IndentationError'> Traceback (most recent call last): File "/storage/.kodi/addons/script.service.kodi.callbacks/resources/lib/tasks/taskPython.py", line 127, in run module = __import__(module_name.encode('utf-8')) File "/storage/led/LED.py", line 13 print "LED on" RE: Execute user tasks for Kodi events (callbacks ver2) - KenV99 - 2017-06-09 Indentation matters in python. You need to indent after the while statement. https://www.tutorialspoint.com/python/python_while_loop.htm I assume this is just test code bc you have a 'while True' loop without any break statement. RE: Execute user tasks for Kodi events (callbacks ver2) - bzowk - 2017-06-25 Hey Guys - I'm trying to implement Kodi with my whole home automation system so currently linking it via SmartThings - having issues though I've done research and seen similar posts in this thread, but still have questions. The custom code for ST which I found most up to date was north3221SmartThings. The installation instructions mention setup of Kodi Callbacks, but below is all it states: You will also need to set up the Callbacks plugin. This is how Kodi talks to Smartthings, meaning you get real time updates. Once installed you need to create the tasks for play, pause, stop, resume, shutdown, startup and then add them to the appropriate events (read the Wiki in the link for help) NB You only need this for two way comms and you can install this after installing the smartthings app & device handler. I've installed the add-on, but don't know what type of Task to create (assume http), how to configure it, and what type of Event to tie it to. Here's a direct link to the code which interacts with the addon. I've written the author of the code, but so far no response. I'm running Kodi 17.3 and installed the add-on from the official repo. Any suggestions? UPDATE After posting, I proceeded to add Kodi to SmartThings via the app anyways. Once I did, the final screen provided further information. Still trying to find out how I need to set up within Callbacks, though... This app is designed to work with the xbmc.callbacks2 plugin for Kodi. Please download and install callbacks2 and in its settings assign the following URLs for corresponding events: It then provided me with 6 custom URLs (below) where the only difference is the final command. I obviously took out the auth portions
I've tried a few things within Callbacks using these URLs without luck. Any suggestions? Thanks! RE: Execute user tasks for Kodi events (callbacks ver2) - Tabclear - 2017-07-24 Hi, For some reason onShutdown event never triggers. There is not much in the logs so I have posted them below. These are my settings: Quote:16:45:55 T:140222960924416 NOTICE: $$$ [kodi.callbacks] - { 'Events': { u'E1': { 'task': u'T1', And the following is the task being successfully called by the "onPlayBackStarted" event. You can then see I change the event to "onShutdown" and then shutdown, but nothing happens. I have tried shutting down numerous times but it never triggers. Quote:16:48:47 T:140223114905344 NOTICE: $$$ [kodi.callbacks] - Command for Task T1, Event onPlayBackStarted completed succesfully! I am running OpenElec on an Intel NUC, Kodi 16.1. Any help appreciated. Thanks RE: Execute user tasks for Kodi events (callbacks ver2) - mattie47 - 2017-07-27 Hi there, Firstly thanks for this script. I've been trying to write a script that will use HDMI CEC to turn my TV on (as the stereo is connected to the TV OUT) when I start airplaying music to Kodi. My match event is successful, however I can't figure out why my script is not working. Quote:osmc@osmc:~/.kodi/temp$ tail -f kodi.log | grep --line-buffered call So callbacks is successful. The command I'm trying to run in a script (I've tried a bash script, and a python script): Bash: Quote:osmc@osmc:~$ cat script.sh You can see I tried adding in a sleep, but that didn't help.. Quote:osmc@osmc:~$ cat script.py Running either script manually works successfully. I just can't see why it's not working when I call either from within Kodi Callbacks. Manually execute: Quote:osmc@osmc:~$ python script.py Help? Thanks! Matt RE: Execute user tasks for Kodi events (callbacks ver2) - awsome-dudes - 2017-09-01 Hey guy im having trouble setting up a script to start a slideshow from a remote folder, which i was able to launch via favorites in kodi before, that doesnt seem to be working so i thought id try callbacks but im getting an error, [bin/sh: 1: slideshow.py: not found] the full directory is /xbmc/scripts/slideshow.py Code: import xbmc Any help would be appreciated. RE: Execute user tasks for Kodi events (callbacks ver2) - stephr1 - 2017-09-01 @KenV99 Thanks for the response. Haven't checked here in a while and was never notified of your response. Thus my delay in responding to your posting. I'll do some more looking and if I find/figure anything, I'll post back here in case anyone else is interested. Cheers.... (2017-05-08, 19:26)KenV99 Wrote:(2017-05-08, 18:44)stephr1 Wrote: Bump...anyone? |