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) |
Execute user tasks for Kodi events (callbacks ver2) - ed_davidson - 2016-08-30 Thanks I found the addon cron that works well for my needs. Sent from my iPhone RE: Execute user tasks for Kodi events (callbacks ver2) - Magicool - 2016-09-03 Hi, I try to run *.cmd script and hide the cmd window using VBScript and so far I fail. It looks like only the VBScript is launched and the *.cmd is ignored. I am using Windows 10 64b and Kodi 16. The scripts I need to run on playback started and playback ended are: start.vbs: Code: Set objShell = WScript.CreateObject("WScript.Shell") Code: start "" "process.exe" Code: Set objShell = WScript.CreateObject("WScript.Shell") Code: taskkill /F /IM process.exe RE: Execute user tasks for Kodi events (callbacks ver2) - KenV99 - 2016-09-11 (2016-09-03, 00:36)Magicool Wrote: Hi, If you run your vbs directly does it work? Are you using shell or are you handing off your vbs to wscript or cscript? As I have stated many many many times in this thread, you need to post a link to your log post for any real help. http://kodi.wiki/view/Add-on:Kodi_Callbacks#FAQs RE: Execute user tasks for Kodi events (callbacks ver2) - KenV99 - 2016-09-11 I am seriously considering ignoring any posts without log links in the future. It's obvious that no one looks at the previous posts in the thread or reading the wiki before asking a question. RE: Execute user tasks for Kodi events (callbacks ver2) - Magicool - 2016-09-12 Hi, Thank you for the idea! Indeed if I select "Requires shell?" it works just fine. I'll make sure to post a log next time I have a question/problem. Sorry about that! RE: Execute user tasks for Kodi events (callbacks ver2) - dannyrobbo - 2016-09-13 Firstly massive thanks to @KenV99 for the addon Ive been trying to find a way to run a python script on startup for a while and now all sorted! Im new to the more advanced side of kodi, commands and scripting in general so this may be a really dumb question or simple process, but I've read through the thread (what i understood of it!) and don't think its been discussed, so thought id ask! Is it possible to make a Task/Event that executes a python script when i change which Home Menu Item I'm on, on the home screen? So if I'm on weather (for example) then change to another item it would execute. thanks for reading and any advice or info would be much appreciated RE: Execute user tasks for Kodi events (callbacks ver2) - KenV99 - 2016-09-26 (2016-09-13, 05:54)dannyrobbo Wrote: Firstly massive thanks to @KenV99 for the addon That may be difficult. The addon can certainly fire an event when you navigate to the Home Menu, but then it would need to be able to hook into the page events for the page to be able to know when you moved from item to item on the page. Without actually editing the code for that page itself (for estuary skin on windows it would be: "C:\Program Files (x86)\Kodi\addons\skin.estuary\1080i\Home.xml"), I cannot think of a way of doing this. Sorry. RE: Execute user tasks for Kodi events (callbacks ver2) - mhendu - 2016-10-19 (2016-03-27, 21:38)KenV99 Wrote:(2016-03-27, 21:03)brazen1 Wrote: Hi.I assume that you are using the onPlaybackStarted event? This sounds promising - I've been looking at some of the Python instructions but have no idea where to begin, would like to do something similar where Kodi switches its video resolution when playing a 3D MVC MKV (in my case identified by a string in the filename), then changes back when playback ends. This would fix an issue I'm having with DSPlayer and madVR where my desktop resolution is 4K and the player resolution is 1080p24 but apparently Kodi is just showing the top left corner of the 4K image, upscaled to 1080p. JSON commands for switching the resolution are here: http://forum.kodi.tv/showthread.php?tid=200052 What I would need then (I think) is to use the callbacks addon to call a script on starting playback, check the filename to see if it contains a certain string and, if so, adjust the screen resolution prior to playback (and otherwise do nothing). On finishing playback / stopping, change the resolution back to the way it was before. Any thoughts on the best way to tackle this? RE: Execute user tasks for Kodi events (callbacks ver2) - KenV99 - 2016-10-26 It all depends on what language you are most comfortable scripting in. In python, you could retrieve the filename use any number of means to ascertain whether the filename contains the substring you designate for the type of video. Then use: 'result = xbmc.executeJSONRPC(query)' where 'query' represents a properly formatted JSON command for the resolution switch. RE: Execute user tasks for Kodi events (callbacks ver2) - mhendu - 2016-10-27 (2016-10-26, 15:03)KenV99 Wrote: It all depends on what language you are most comfortable scripting in. Honestly I have no idea how to script (I know Excel fairly well and understand basic coding concepts but it's been years since I've taken a programming class or written any code). I found a script elsewhere in the forums to execute a JSON command and print out any errors, so I've adapted this to my needs. I'm able to get it to change the resolution, but then a yes/no dialog box comes up ("Save this resolution?") and I'm unable to get it to automatically click on 'yes' using a method that appears to work for other yes/no dialog boxes (unless I've just scripted this incorrectly). I added a couple of timers in the script since my projector and graphics card take a little while to switch modes so I wanted to account for this. I also need to add some code to check the filename before switching resolutions, but figured I'd solve for the basic functionality before getting into the if/then statements. Any thoughts? http://pastebin.com/FXD6SuCH RE: Execute user tasks for Kodi events (callbacks ver2) - jant90 - 2016-11-03 Great, just what I needed, thanks! I use it on LibreELEC with my RPi2 to disable the Bluetooth service when I start playback and enable it again after playback has finished. Because I use Bluetooth to play music from my phone to my RPi2 over my speakers I only need to have Bluetooth enabled whenever I'm not using Kodi. I could leave Bluetooth on at all times of course but I noticed the occasional choppy playback of 1080p content so that was not an option for me. You plugin gave me convenience of always having Bluetooth enabled whenever I need it without needing to enable it manually and without the drawback of playback getting choppy. Thanks again! RE: Execute user tasks for Kodi events (callbacks ver2) - alipendier - 2016-11-05 How exactly can I use this to run a script or add-on on Kodi exit? What I am trying to do is run a script or add-on to clear cache/packages/thumbnails on exit or shutdown. Thanks RE: Execute user tasks for Kodi events (callbacks ver2) - firewater - 2016-11-25 Thank you very much for this addon!!! I used to have the "export to individual files" function to run at startup, which was awful because you have to wait for it to finish and it's like 3 seconds there that it's just a chore to the eyes. Now I run it after playback has started, but, and here's an idea: add the option to delay the task, and only start it after X amount of seconds have passed since the event has occurred. I bypassed this by running the built-in function from a Python script and adding time.sleep(5) to it, but since it's a portable install and I move it around a lot, I'd rather have this not depend on a .py script (could also be useful for other purposes, I imagine). RE: Execute user tasks for Kodi events (callbacks ver2) - xtract47 - 2016-11-28 I have made an addon which I need to launch when a change in the file system is detected. Is it possible to do so? Ok: RunScript(script.***) Now, does the file system watchdog work instantly or does it run in a schedule? Let's see if this works.... RE: Execute user tasks for Kodi events (callbacks ver2) - sagilo - 2016-12-07 I'm trying to run a python script or batch script which uses python lib and it looks like the modules can't be found when running from within Kodi : Code: 22:26:38 T:8640 ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<-- Should I install the module on Kodi environment somehow ? |