Files
jellycon/resources/lib/kodi_utils.py
mani 51aaa1f603
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 remaining problematic module-level addon access
- 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
2026-01-06 01:15:50 +01:00

50 lines
1.2 KiB
Python

from __future__ import (
division, absolute_import, print_function, unicode_literals
)
import sys
import xbmcgui
import xbmcplugin
import xbmcaddon
from .lazylogger import LazyLogger
log = LazyLogger(__name__)
class HomeWindow:
"""
xbmcgui.Window(10000) with add-on id prefixed to keys
"""
def __init__(self):
self.id_string = 'plugin.video.jellycon-%s'
self.window = xbmcgui.Window(10000)
def get_property(self, key):
key = self.id_string % key
value = self.window.getProperty(key)
return value
def set_property(self, key, value):
key = self.id_string % key
self.window.setProperty(key, value)
def clear_property(self, key):
key = self.id_string % key
self.window.clearProperty(key)
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)
li.setArt(art)
xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=path, listitem=li, isFolder=folder)