+ 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}
|
||||
|
||||
@@ -5518,4 +5518,24 @@ msgstr ""
|
||||
|
||||
msgctxt "#70705"
|
||||
msgid "Use your custom channel URLs"
|
||||
msgstr ""
|
||||
msgstr ""
|
||||
|
||||
msgctxt "#70706"
|
||||
msgid "autostart KOD at Kodi boot"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "#70707"
|
||||
msgid "Enable"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "#70708"
|
||||
msgid "Disable"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "#70710"
|
||||
msgid "Your new settings has just been saved"
|
||||
msgstr "Le nuove impostazioni sono state salvate"
|
||||
|
||||
msgctxt "#70711"
|
||||
msgid "Ops! There's been a problem during saving your setting"
|
||||
msgstr "Ops! C'è stato un problema durante il salvataggio delle impostazioni"
|
||||
@@ -5518,4 +5518,24 @@ msgstr "TMDB ID (0 per annullare)"
|
||||
|
||||
msgctxt "#70705"
|
||||
msgid "Use your custom channel URLs"
|
||||
msgstr "Utilizza URL personalizzati per i canali"
|
||||
msgstr "Utilizza URL personalizzati per i canali"
|
||||
|
||||
msgctxt "#70706"
|
||||
msgid "autostart KOD at Kodi boot"
|
||||
msgstr "avvio automatico di KOD al boot di Kodi"
|
||||
|
||||
msgctxt "#70707"
|
||||
msgid "Enable"
|
||||
msgstr "Attivia"
|
||||
|
||||
msgctxt "#70708"
|
||||
msgid "Disable"
|
||||
msgstr "Disattiva"
|
||||
|
||||
msgctxt "#70709"
|
||||
msgid "Your new settings has just been saved"
|
||||
msgstr "Le nuove impostazioni sono state salvate"
|
||||
|
||||
msgctxt "#70710"
|
||||
msgid "Ops! There's been a problem during saving your setting"
|
||||
msgstr "Ops! C'è stato un problema durante il salvataggio delle impostazioni"
|
||||
@@ -11,7 +11,7 @@ from platformcode import config, logger
|
||||
from platformcode import platformtools
|
||||
|
||||
CHANNELNAME = "setting"
|
||||
|
||||
AUTOSTART = config.is_autorun_enabled()
|
||||
|
||||
def mainlist(item):
|
||||
logger.info()
|
||||
@@ -20,7 +20,7 @@ def mainlist(item):
|
||||
itemlist.append(Item(channel=CHANNELNAME, title=config.get_localized_string(60535), action="settings", folder=False,
|
||||
thumbnail=get_thumb("setting_0.png")))
|
||||
|
||||
itemlist.append(Item(channel=CHANNELNAME, title="", action="", folder=False, thumbnail=get_thumb("setting_0.png")))
|
||||
#itemlist.append(Item(channel=CHANNELNAME, title="", action="", folder=False, thumbnail=get_thumb("setting_0.png")))
|
||||
|
||||
itemlist.append(Item(channel=CHANNELNAME, title=config.get_localized_string(60536) + ":", text_bold=True, action="", folder=False,
|
||||
thumbnail=get_thumb("setting_0.png")))
|
||||
@@ -43,7 +43,13 @@ def mainlist(item):
|
||||
itemlist.append(Item(channel=CHANNELNAME, title=" " + config.get_localized_string(70253), action="setting_torrent",
|
||||
folder=True, thumbnail=get_thumb("channels_torrent.png")))
|
||||
|
||||
itemlist.append(Item(channel=CHANNELNAME, action="", title="", folder=False, thumbnail=get_thumb("setting_0.png")))
|
||||
if AUTOSTART is False:
|
||||
autostart_mode = config.get_localized_string(70707)
|
||||
else:
|
||||
autostart_mode = config.get_localized_string(70708)
|
||||
itemlist.append(Item(channel=CHANNELNAME, title=autostart_mode + " " + config.get_localized_string(70706), action="autostart", folder=False, thumbnail=get_thumb("setting_0.png")))
|
||||
|
||||
#itemlist.append(Item(channel=CHANNELNAME, action="", title="", folder=False, thumbnail=get_thumb("setting_0.png")))
|
||||
itemlist.append(Item(channel=CHANNELNAME, title=config.get_localized_string(60544), action="submenu_tools", folder=True,
|
||||
thumbnail=get_thumb("setting_0.png")))
|
||||
|
||||
@@ -84,6 +90,13 @@ def channel_config(item):
|
||||
item.config))
|
||||
|
||||
|
||||
def autostart():
|
||||
if config.enable_disable_autorun(AUTOSTART):
|
||||
xbmcgui.Dialog().ok(config.get_localized_string(20000), config.get_localized_string(70709))
|
||||
else:
|
||||
xbmcgui.Dialog().ok(config.get_localized_string(20000), config.get_localized_string(70710))
|
||||
|
||||
|
||||
def setting_torrent(item):
|
||||
logger.info()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user