+ autostart KOD at Kodi boot option
This commit is contained in:
@@ -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}
|
||||
|
||||
Reference in New Issue
Block a user