+ autostart KOD at Kodi boot option

This commit is contained in:
cttynul
2019-06-07 04:08:35 +02:00
parent 45796c324a
commit 6bc54772ad
4 changed files with 86 additions and 5 deletions

View File

@@ -115,6 +115,34 @@ def get_system_platform():
platform = "osx"
return platform
def is_autorun_enabled():
try:
if "xbmc.executebuiltin('XBMC.RunAddon(plugin.video.kod)')" in open(os.path.join(xbmc.translatePath('special://userdata'),'autoexec.py')).read():
return True
else:
return False
except:
# if error in reading from file autoexec doesnt exists
return False
def enable_disable_autorun(is_enabled):
# using autoexec.py and not service.py to force autorun
path = os.path.join(xbmc.translatePath('special://userdata'),'autoexec.py')
append_write = 'a' if os.path.exists(path) else 'w'
if is_enabled is False:
with open(path, append_write) as file:
file.write("import xbmc\nxbmc.executebuiltin('XBMC.RunAddon(plugin.video.kod)')")
else:
file = open(path, "r")
old_content = file.read()
new_content = old_content.replace("xbmc.executebuiltin('XBMC.RunAddon(plugin.video.kod)')", "")
file.close()
with open(path, "w") as file:
file.write(new_content)
return True
def get_all_settings_addon():
# Lee el archivo settings.xml y retorna un diccionario con {id: value}