It is executable, but it does not run from the command line, I believe OSMC has its own Python that runs from inside OSMC, so from the command line it produces an error (hence it does work from the remote.xml).
To clarify, the script IS working, when called from remote.xml, but is not working from cron.
I have amended the file to use full paths, but this has made no difference.
When calling the script from the command line the output is:
Traceback (most recent call last):
File "/home/osmc/.kodi/userdata/pyscript/test.py", line 4, in <module>
import xbmc
ImportError: No module named xbmc
But I believe this is due to the internal/external python issue - externally it cannot import xbmc.
Unless cron is also outside then I can understand that it will not work, but as I understand it cron operates with the internal python.
Sam, thanks for the input, but I’m afraid I was lost almost immediately!
I’m afraid my coding skills (as you can probably tell from the python script!) are minimal, and I have no idea how to use the JSONRPC api - is this used in cron to launch the python script, or to replace the python script ?
Hi Sam, I appreciate you are busy - this is a hell of a project you have to keep a grip on, and ‘odd’ little personal projects like this are not what you need to be working on, so I did some research…
I found this page that has a similar goal, in that it checks that there is media playing, and pause/unpause if there is.
I have re-purposed this to simply detect that media is playing, and copy/delete my file as required (though it does seem to work the other way around!). I don’t really understand what it is doing to get the result, which is a shame, as I like to understand things.
I have to say this seems to be a much more complicated way of ding things, and I am lucky that there was an example with similar goals.