updates: fix install dialog labels and use InstallAddon flow
This commit is contained in:
@@ -1181,7 +1181,7 @@ def _fetch_changelog_for_channel(channel: int, version: str) -> str:
|
||||
return _extract_changelog_section(text, version)
|
||||
|
||||
|
||||
def _install_addon_version(info_url: str, version: str) -> bool:
|
||||
def _install_addon_version_manual(info_url: str, version: str) -> bool:
|
||||
base = info_url[: -len("/addons.xml")] if info_url.endswith("/addons.xml") else info_url.rstrip("/")
|
||||
zip_url = f"{base}/{UPDATE_ADDON_ID}/{UPDATE_ADDON_ID}-{version}.zip"
|
||||
try:
|
||||
@@ -1217,6 +1217,29 @@ def _install_addon_version(info_url: str, version: str) -> bool:
|
||||
return True
|
||||
|
||||
|
||||
def _install_addon_version(info_url: str, version: str) -> bool:
|
||||
base = info_url[: -len("/addons.xml")] if info_url.endswith("/addons.xml") else info_url.rstrip("/")
|
||||
zip_url = f"{base}/{UPDATE_ADDON_ID}/{UPDATE_ADDON_ID}-{version}.zip"
|
||||
|
||||
# Prefer Kodi's own installer to get proper install flow and dependency handling.
|
||||
builtin = getattr(xbmc, "executebuiltin", None)
|
||||
if callable(builtin):
|
||||
try:
|
||||
before = _installed_addon_version_from_disk()
|
||||
builtin(f"InstallAddon({zip_url})")
|
||||
for _ in range(20):
|
||||
time.sleep(1)
|
||||
current = _installed_addon_version_from_disk()
|
||||
if current == version:
|
||||
return True
|
||||
if before == version:
|
||||
return True
|
||||
except Exception as exc:
|
||||
_log(f"InstallAddon fehlgeschlagen, fallback aktiv: {exc}", xbmc.LOGWARNING)
|
||||
|
||||
return _install_addon_version_manual(info_url, version)
|
||||
|
||||
|
||||
def _sync_update_channel_status_settings() -> None:
|
||||
channel = _selected_update_channel()
|
||||
channel_label = _channel_label(channel)
|
||||
@@ -3521,14 +3544,16 @@ def _show_version_selector() -> None:
|
||||
"Version installieren",
|
||||
f"Version: {version}",
|
||||
"Installation jetzt starten?",
|
||||
yeslabel="Installieren",
|
||||
nolabel="Abbrechen",
|
||||
"",
|
||||
"Abbrechen",
|
||||
"Installieren",
|
||||
)
|
||||
except TypeError:
|
||||
confirm = dialog.yesno("Version installieren", f"Version: {version}", "Installation jetzt starten?")
|
||||
if not confirm:
|
||||
return
|
||||
|
||||
xbmcgui.Dialog().notification("Updates", f"Installation gestartet: {version}", xbmcgui.NOTIFICATION_INFO, 2500)
|
||||
ok = _install_addon_version(info_url, version)
|
||||
if ok:
|
||||
_sync_update_version_settings()
|
||||
|
||||
Reference in New Issue
Block a user