Add web config

This commit is contained in:
Nirvana
2025-12-16 13:28:34 +01:00
parent ccc421b8b2
commit 9f793a7872
@@ -64,37 +64,64 @@ class EnvironmentManager:
# Import inside the method where we know Kodi is available
import xbmcaddon as kodi_xbmcaddon
import xbmcvfs as kodi_xbmcvfs
print("DEBUG: Imports successful", file=sys.stderr)
# Create addon instance
self._addon = kodi_xbmcaddon.Addon()
print(f"DEBUG: Addon created: {self._addon.getAddonInfo('id')}", file=sys.stderr)
self._config['environment'] = 'kodi'
self._config['addon_id'] = self._addon.getAddonInfo('id')
print(f"DEBUG: addon_id set: {self._config['addon_id']}", file=sys.stderr)
self._config['addon_name'] = self._addon.getAddonInfo('name')
print(f"DEBUG: addon_name set: {self._config['addon_name']}", file=sys.stderr)
self._config['addon_version'] = self._addon.getAddonInfo('version')
print(f"DEBUG: addon_version set: {self._config['addon_version']}", file=sys.stderr)
self._config['addon_path'] = self._addon.getAddonInfo('path')
print(f"DEBUG: addon_path set: {self._config['addon_path']}", file=sys.stderr)
# Get profile path
print("DEBUG: Getting profile info...", file=sys.stderr)
profile_info = self._addon.getAddonInfo('profile')
print(f"DEBUG: profile_info: {profile_info}", file=sys.stderr)
print("DEBUG: Translating path...", file=sys.stderr)
profile_path = kodi_xbmcvfs.translatePath(profile_info)
print(f"DEBUG: profile_path translated: {profile_path}", file=sys.stderr)
self._config['profile_path'] = str(profile_path)
print(f"DEBUG: profile_path set in config", file=sys.stderr)
# Get settings
print("DEBUG: Getting default_country setting...", file=sys.stderr)
default_country = self._addon.getSetting('default_country')
print(f"DEBUG: default_country raw value: {repr(default_country)}", file=sys.stderr)
self._config['default_country'] = str(default_country) if default_country else 'DE'
print(f"DEBUG: default_country set: {self._config['default_country']}", file=sys.stderr)
print("DEBUG: Getting server_port setting...", file=sys.stderr)
server_port = self._addon.getSetting('server_port')
print(f"DEBUG: server_port raw value: {repr(server_port)}", file=sys.stderr)
try:
self._config['server_port'] = int(str(server_port)) if server_port else 7777
except ValueError:
print(f"DEBUG: server_port set: {self._config['server_port']}", file=sys.stderr)
except ValueError as ve:
print(f"DEBUG: ValueError converting port: {ve}", file=sys.stderr)
self._config['server_port'] = 7777
except Exception as init_error: # noqa: B902
print("DEBUG: _init_kodi completed successfully!", file=sys.stderr)
except Exception as init_error:
print(f"DEBUG: Exception caught in _init_kodi!", file=sys.stderr)
print(f"DEBUG: Exception type: {type(init_error).__name__}", file=sys.stderr)
print(f"DEBUG: Exception message: {str(init_error)}", file=sys.stderr)
import traceback
print("DEBUG: Full traceback:", file=sys.stderr)
traceback.print_exc()
# Log the error and fallback to standalone
self._log_init_error("Kodi initialization failed", init_error)
self._is_kodi = False