Remove remaining problematic module-level addon access
Some checks failed
Build JellyCon / build (py2) (push) Has been cancelled
Build JellyCon / build (py3) (push) Has been cancelled
CodeQL Analysis / analyze (python, 3.9) (push) Has been cancelled
Release Drafter / Update release draft (push) Has been cancelled
Test JellyCon / test (3.9) (push) Has been cancelled

- Remove module-level addon variable in kodi_utils.py
- Load addon locally in add_menu_directory_item() where needed
- Load addon locally in SHOW_SETTINGS mode in functions.py
- Keep __addon__ fallback in functions.py for non-critical uses (__addondir__, addon_id, PLUGINPATH) which have safe fallback values
- loghandler.py already has proper exception handling around __pluginpath__ usage
This commit is contained in:
mani
2026-01-06 01:15:50 +01:00
parent a71efe14c1
commit 51aaa1f603
2 changed files with 3 additions and 6 deletions

View File

@@ -125,7 +125,8 @@ def main_entry_point():
elif mode == "CLONE_SKIN":
clone_default_skin()
elif mode == "SHOW_SETTINGS":
__addon__.openSettings()
addon = xbmcaddon.Addon()
addon.openSettings()
window = xbmcgui.getCurrentWindowId()
if window == 10000:
log.debug(

View File

@@ -11,11 +11,6 @@ import xbmcaddon
from .lazylogger import LazyLogger
log = LazyLogger(__name__)
try:
addon = xbmcaddon.Addon()
except Exception:
# During installation/update, addon might not be fully registered yet
addon = None
class HomeWindow:
@@ -45,6 +40,7 @@ def add_menu_directory_item(label, path, folder=True, art=None, properties=None)
li = xbmcgui.ListItem(label, path=path, offscreen=True)
if art is None:
art = {}
addon = xbmcaddon.Addon()
art["thumb"] = addon.getAddonInfo('icon')
if properties is not None:
li.setProperties(properties)