[RELEASE] Execute user scripts on specific XBMC actions (play starts/stops...) - 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 scripts on specific XBMC actions (play starts/stops...) (/showthread.php?tid=151011) |
RE: [RELEASE] Execute user scripts on specific XBMC actions (play starts/stops...) - KenV99 - 2014-03-23 (2014-03-22, 12:07)flarc Wrote: Hello Pilluli, Hmmmm. I'm thinking that it definitely may be related to the portable mode, because I know for sure that the code retrieves the settings properly during initialization in the non-portable mode. In addition, when I step through using a debugger, that code is properly executed. The python extensions for XBMC do not provide alternate means of retrieving the settings in portable mode versus non-portable. The extension provides automatic path translation due to the differences in OS's. I will look into running the debugger when starting in portable mode and tracing the calls, but I'll have to figure out the process of copying over my settings to the portable_data directory. Are you running from the Program Files directory using 'run as admin' or are you running from a different read/write directory? The code as it stands should read the settings at initialization and whenever the settings change. Although it could be written to read the settings before each script call, I'd like to investigate why it's failing currently before resorting to that. I'm also contemplating including code in my fork to directly execute url/http calls and more detailed error catching and logging. And optionally provide on-screen notifications when the scripts run to also help with debugging. If it seems to work well, perhaps I'll ask pilulli to consider pulling that code back into the master. RE: [RELEASE] Execute user scripts on specific XBMC actions (play starts/stops...) - Elessar88 - 2014-04-02 Registered just to post this message: Thanks! This addon was the missing link from XBMC events to controlling my lights. RE: [RELEASE] Execute user scripts on specific XBMC actions (play starts/stops...) - flarc - 2014-04-04 Hello KenV99. "Are you running from the Program Files directory using 'run as admin' or are you running from a different read/write directory?" I am running from the program files, yes. RE: [RELEASE] Execute user scripts on specific XBMC actions (play starts/stops...) - Elessar88 - 2014-04-05 Hi Guys, I'm trying to call a simple python script from this addon, but the xbmc log shows it doesn't work: Code: Line 864: 10:04:13 T:2936144992 DEBUG: XBMC callbacks: Going to execute script = "/storage/downloads/playerstart.py" The script sends a udp packet to my wifi-enabled light bulbs: Code: #!/usr/bin/python Currently, I can run the script without problem from the command line. Also python is installed correctly. My settings.xml is as follows: Code: <setting id="player_starts" value="/storage/downloads/playerstart.py" /> Is there a way to get more debug info than the two lines shown in the XBMC debug window? I'm going to try flarc's method today. RE: [RELEASE] Execute user scripts on specific XBMC actions (play starts/stops...) - Elessar88 - 2014-04-06 Fixed it by adding python Code: <setting id="player_starts" value=" python /storage/downloads/playerstart.py" /> Moreover, is there a way to find out the title of the movie/episode that is playing? I tried: Code: if xbmc.getInfoLabel('VideoPlayer.Season') != "" and xbmc.getInfoLabel('VideoPlayer.TVShowTitle') != "": and in my python script I call: Code: import sys But this does not work. RE: [RELEASE] Execute user scripts on specific XBMC actions (play starts/stops...) - KenV99 - 2014-04-06 (2014-04-06, 13:59)Elessar88 Wrote: Fixed it by adding python Since you seem adept at writing python, why not just put your python code directly in the default.py of the add-on in the class "MyPlayer" under the " def onPlayBackStarted(self):" method? You can then use "self.getVideoInfoTag" to get the tag of the currently playing file and then "getTitle" to get the title... See http://mirrors.xbmc.org/docs/python-docs/12.2-frodo/xbmc.html RE: [RELEASE] Execute user scripts on specific XBMC actions (play starts/stops...) - Elessar88 - 2014-04-07 Hi Ken, Not sure why I didn't think of that before, thanks RE: [RELEASE] Execute user scripts on specific XBMC actions (play starts/stops...) - StarkJohan - 2014-04-11 I'm trying to add functionality to catch xbmc.shutdown but my python skills are very limited. I'm guessing this should be fairly simple to implement but please correct me if I'm wrong. I don't want to dig into your code unless this is possible. Could you perhaps point me in the right direction? Any help is appreciated. Also, thanks for a neat add-on, it's very useful and works like a charm. RE: [RELEASE] Execute user scripts on specific XBMC actions (play starts/stops...) - Rumik - 2014-04-12 Great idea! I'm trying to use this to run Artwork Organiser whenever the database updates, but I've no idea if it's working as I get no feedback, nor any prompt that Artwork Organiser is running. Honestly I'm surprised that addon doesn't have a scheduler of its own! RE: [RELEASE] Execute user scripts on specific XBMC actions (play starts/stops...) - flarc - 2014-04-19 (2014-04-04, 17:09)flarc Wrote: Hello KenV99. Hello KenV99. I hardcoded the script command line into the the default.py, and now of course it works. ex.: Code: [...] As my config will be stable for a long time, i will stick with this unclean way to make it work. Thx anyway for your support. And thx to both Pilluli and you for the trick to make my command line work with space inside. RE: [RELEASE] Execute user scripts on specific XBMC actions (play starts/stops...) - PyRo1509 - 2014-05-26 EDIT: Ignore, I have a low IQ; Permissions. --==-=-=-=-=-=-==-=-=-=-=--=-=-=--=-=-=- Hello. Love the script, except the only action it is doing now is writing errors to my debug log I have tried: Quote:/Users/pyro/Desktop/wemo/pauseXBMC.sh All the script does is simply make x=1; Code: #!/bin/bash Code: 13:32:36 T:4626214912 DEBUG: XBMC callbacks: player pauses It is all the same. I am using 12.3 on a 10.9.3 mac mini Thanks for the good work! RE: [RELEASE] Execute user scripts on specific XBMC actions (play starts/stops...) - Samu-rai - 2014-06-02 I've been trying to use this addon to run another addon when the library updates. But after almost 3 days of effort, with what appears to be no progress at all, I think I'm about to go insane I've tried to follow every suggestion through out this thread, but still no joy. I would be very grateful if someone could offer some assistance. The script is simple: Code: import xbmc Now after reading all the info about needing to mark the script as executable etc, I thought it may be easier to just hardcode the above into the script as others have suggested: Code: def onDatabaseUpdated(self,db): But this doesn't appear to work either. Although I have limited coding knowledge, I consider myself to be pretty knowledgeable when it comes to XBMC. However, this has me doubting that. Where am I going wrong? FYI - I am running a Linux build. [RELEASE] Execute user scripts on specific XBMC actions (play starts/stops...) - spoyser - 2014-06-05 Your xbmc.executebuiltin etc doesn't look like it is indented correctly. It should be at the same level as the # of the line above it. You also need to ensure that you still have a database update script set, or just change the Code: if script_db_update: Code: if True: RE: [RELEASE] Execute user scripts on specific XBMC actions (play starts/stops...) - Samu-rai - 2014-06-06 Changing it to True worked! I knew it would be something tiny, but I never would of got that. Thanks spoyser. Much obliged. RE: [RELEASE] Execute user scripts on specific XBMC actions (play starts/stops...) - schumi2004 - 2014-06-06 Can this script also launch scripts/commands on profile switching? |