Android Android Kodi script permission issue
#1
Hey All
I'm wondering if anyone can help me with a workaround for running a script in kodi with locked down file permissions, only rw rw is available and am unable to set x to the files located on the emulated drive due to Android FUSE drive emulation

Script is located in the following directory: I havent actually made an addon, merely just created a folder the script to sit in.
/storage/emulated/0/Android/data/org.xbmc.kodi/files/.kodi/addons/script.hyperion/hyperion_on.py

I'm calling it from a button in the submenu by using the following custom command:
XBMC.RunScript(special://home\addons\script.hyperion\hyperion_on.py)

Code:
#!/usr/bin/python

from __future__ import print_function
import os
import subprocess
import platform
import xbmc
import xbmcgui

PRIVATE_KEY_LOCATION = "/storage/emulated/0/Android/data/org.xbmc.kodi/files/.kodi/addons/script.hyperion/.ssh/id_rsa"
USER = "pi"
HOST = "192.168.1.14"
COMMAND="bash /home/pi/hyperion_on.sh"
# Ports are handled in ~/.ssh/config since we use OpenSSH

#system32 = os.path.join(os.environ['SystemRoot'], 'SysNative' if platform.architecture()[0] == '32bit' else 'System32')
ssh_path = os.path.join('/data/data/com.termux/files/usr/bin/ssh')

ssh = subprocess.Popen([ssh_path, '-i', PRIVATE_KEY_LOCATION, "{}@{}".format(USER, HOST)],
                       stdin=subprocess.PIPE,
                       stdout=subprocess.PIPE,
                       stderr=subprocess.PIPE)

std_data = ssh.communicate(COMMAND)

dialog = xbmcgui.Dialog()
dialog.notification('HYPERION', 'Ambilight has been turned ON', '/storage/emulated/0/Android/data/org.xbmc.kodi/files/.kodi/addons/script.hyperion/icon.png', 5000, True)
Error in log:
Code:
ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
 - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
Error Type: <type 'exceptions.OSError'>
Error Contents: [Errno 13] Permission denied
Traceback (most recent call last):
  File "/storage/emulated/0/Android/data/org.xbmc.kodi/files/.kodi/addons/script.hyperion/hyperion_on.py", line 22, in <module>
    stderr=subprocess.PIPE)
  File "/home/jenkins/workspace/Android-ARM/tools/depends/xbmc-depends/arm-linux-androideabi-android-21/lib/python2.7/subprocess.py", line 711, in __init__
  File "/home/jenkins/workspace/Android-ARM/tools/depends/xbmc-depends/arm-linux-androideabi-android-21/lib/python2.7/subprocess.py", line 1343, in _execute_child
OSError: [Errno 13] Permission denied
-->End of Python script error report<--
Keep in mind I can run this exact python script from termux successfully from the same location in kodi, provided I comment out the xbmc stuff. This is still without x permissions on the file.

Any help, I've tried so many different ways of doing this but it all comes back to permission denied or no such file or directory if i move the script to /data/data/com.termux/files/home/scripts and set x permissions, kodi cant see the file.

This is on a non rooted Xiaomi Mi Box 3 (MDZ-16-AB) running android 8.0 Oreo
Reply

Logout Mark Read Team Forum Stats Members Help
Android Kodi script permission issue0