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) - KenV99 - 2016-01-28 (2016-01-28, 00:08)AvanOsch Wrote: Thanks for a great plugin Ken. The latest version has the debug error fixed (again). I don't have a linux environment up and running to test on, but it seems that you need to call a helper .sh script to invoke the actual script. Based on: http://unix.stackexchange.com/questions/138276/execute-a-line-of-commands-with-one-sudo Set your script to run the helper script, passing the actual script file url as an argument So the helper script would look like: Code: sudo "$BASH" -c "$(fc -ln -1)" You may need to tweak this to get it right. Right now I've been using the git bash on windows for testing .sh and I can't test the whole sudo thing in that context. Perhaps an experienced linux bash person can chime in. Edit: The above is for the command line. I think it would look something like: Code: sudo "$BASH" "$@" Edit 2: I tested and the above works. ("$*" didn't, "$@" does). To supply a password: Code: #!/usr/bin/env bash RE: Execute user tasks for Kodi events (callbacks ver2) - thildemar - 2016-01-31 Hello, Hoping someone might be able to help me out here. My knowledge of Kodi/Python is not great. I am basically trying to get this addon to call a python script on playback that will trigger a URL if the media content is a movie or TV episode. I have task1 set to python file with the import option. Event is on playback passing "%mt" as an argument. Here is the py file I am calling: Code: import urllib2 When I run this as test command in the addon config it fires correctly and calls the URL as expected. When I try to actually play a file the log says it has fired, but the URL is not called. Code: 11:36:47 T:11388 NOTICE: $$$ [kodi.callbacks] - Task starting for onPlayBackStarted I am sure I am missing something here, can anyone help? RE: Execute user tasks for Kodi events (callbacks ver2) - KenV99 - 2016-01-31 (2016-01-31, 20:43)thildemar Wrote: Hello, I recently made a lot of changes that may or may not help with your issue so please download the latest from github. One possible problem is that despite doing many things to sort out media type for a given file, the addon cannot sometimes figure it out and pass 'unknown'. To figure this out you can do: Code: import urllib2 The contents of arg will be shown as a notification at the time the event fires and you can see if the media type is movie or episode. RE: Execute user tasks for Kodi events (callbacks ver2) - thildemar - 2016-02-02 Hi Ken, Thanks for the update. I tested the new build and this code on my PC and it seems to work fine. Unfortunately when I tried to install the new build on my FireTV I get all kinds of addon errors on startup. Here is the log: http://pastebin.com/raw/E3g8mpds I am running Jarvis RC2, not sure if there are any known compatibility issues with the new release... RE: Execute user tasks for Kodi events (callbacks ver2) - KenV99 - 2016-02-02 (2016-02-02, 03:09)thildemar Wrote: Hi Ken, I don't have an android platform to test if this is the error you are encountering, but the current problem is most likely caused by not renaming the directory, removing the -master from the directory name: http://kodi.wiki/view/Add-on:Kodi_Callbacks#Details RE: Execute user tasks for Kodi events (callbacks ver2) - thildemar - 2016-02-03 (2016-02-02, 13:45)KenV99 Wrote:(2016-02-02, 03:09)thildemar Wrote: Hi Ken, With the new build should the directory be service.kodi.callbacks or script.service.kodi.callbacks? Still getting the error with it labeled either way: Code: log(msg=_('Localized string not found for: [%s]') % strToId) RE: Execute user tasks for Kodi events (callbacks ver2) - KenV99 - 2016-02-03 (2016-02-03, 04:11)thildemar Wrote:(2016-02-02, 13:45)KenV99 Wrote:(2016-02-02, 03:09)thildemar Wrote: Hi Ken, With the last two versions it should be 'script.service.kodi.callbacks'. Please try downloading the latest and rename to the above and see if that helps. Thx for helping me debug this. RE: Execute user tasks for Kodi events (callbacks ver2) - winger88 - 2016-02-03 Same issue - renamed and placed in directory. Can only speak for android, have not tested on windows/linux Line 78 of poutil.py log(msg=_('Localized string not found for: [%s]') % strToId) RE: Execute user tasks for Kodi events (callbacks ver2) - KenV99 - 2016-02-03 (2016-02-03, 18:15)winger88 Wrote: Same issue - renamed and placed in directory. Can only speak for android, have not tested on windows/linux Please post a full log to pastebin and post the link here. Thx. RE: Execute user tasks for Kodi events (callbacks ver2) - KenV99 - 2016-02-03 I pushed a new update just now. Please let me know if it has helped the Android bug. Difficult to troubleshoot since I cannot reproduce. Will try to run in an Android emulator when I have time. EDIT: I think I solved it just now: stupid backslashes in strings.po path not accepted by android. Will check through rest of code shortly. Fixed code available with latest master as of 6:10pm Eastern time US. RE: Execute user tasks for Kodi events (callbacks ver2) - winger88 - 2016-02-04 ImportError - No module named requests. Line 22 in taskHttp.py RE: Execute user tasks for Kodi events (callbacks ver2) - KenV99 - 2016-02-04 (2016-02-04, 01:52)winger88 Wrote: ImportError - No module named requests. requests is a dependency: https://github.com/KenV99/script.service.kodi.callbacks/blob/master/addon.xml Kodi should have downloaded and installed it at first run. It successfully did so when I ran on my emulator. You can install manually from here: https://github.com/beenje/script.module.requests RE: Execute user tasks for Kodi events (callbacks ver2) - thildemar - 2016-02-04 Thanks Ken, New build is working on FireTV after I removed old paths and re-installed from zip file (with modified directory). Next question: Any reason media pause and resume don't support the mediatype argument? RE: Execute user tasks for Kodi events (callbacks ver2) - KenV99 - 2016-02-04 (2016-02-04, 04:44)thildemar Wrote: Thanks Ken, No. No one asked and I couldn't think of a reason to use the media type with those events. I'll add it in the next build. How will you be using those events with media type? EDIT: I added it in. Please download the latest and let me know if you have any troubles. RE: Execute user tasks for Kodi events (callbacks ver2) - thildemar - 2016-02-04 (2016-02-04, 04:48)KenV99 Wrote:(2016-02-04, 04:44)thildemar Wrote: Thanks Ken, Thanks, I'll try and test tonight. I am using your addon to trigger events in SmartThings for lighting control using an app I wrote on that side (https://community.smartthings.com/t/beta-release-kodi-xbmc-callback-endpoint-for-light-control/34068). I only want to send lighting triggers when playing back TV or Movies, not music or TVTunes or whatnot. That's why the if statement in the code above and why I want mediatype in the pause/resume event. Thanks again! |