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)
|
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("/")
|
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"
|
zip_url = f"{base}/{UPDATE_ADDON_ID}/{UPDATE_ADDON_ID}-{version}.zip"
|
||||||
try:
|
try:
|
||||||
@@ -1217,6 +1217,29 @@ def _install_addon_version(info_url: str, version: str) -> bool:
|
|||||||
return True
|
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:
|
def _sync_update_channel_status_settings() -> None:
|
||||||
channel = _selected_update_channel()
|
channel = _selected_update_channel()
|
||||||
channel_label = _channel_label(channel)
|
channel_label = _channel_label(channel)
|
||||||
@@ -3521,14 +3544,16 @@ def _show_version_selector() -> None:
|
|||||||
"Version installieren",
|
"Version installieren",
|
||||||
f"Version: {version}",
|
f"Version: {version}",
|
||||||
"Installation jetzt starten?",
|
"Installation jetzt starten?",
|
||||||
yeslabel="Installieren",
|
"",
|
||||||
nolabel="Abbrechen",
|
"Abbrechen",
|
||||||
|
"Installieren",
|
||||||
)
|
)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
confirm = dialog.yesno("Version installieren", f"Version: {version}", "Installation jetzt starten?")
|
confirm = dialog.yesno("Version installieren", f"Version: {version}", "Installation jetzt starten?")
|
||||||
if not confirm:
|
if not confirm:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
xbmcgui.Dialog().notification("Updates", f"Installation gestartet: {version}", xbmcgui.NOTIFICATION_INFO, 2500)
|
||||||
ok = _install_addon_version(info_url, version)
|
ok = _install_addon_version(info_url, version)
|
||||||
if ok:
|
if ok:
|
||||||
_sync_update_version_settings()
|
_sync_update_version_settings()
|
||||||
|
|||||||
Reference in New Issue
Block a user