- 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
Instead of setting addon variables to None (which causes issues),
fix the root cause by removing unnecessary module-level initialization:
- Remove module-level user_details loading in functions.py
- Load user_details locally in functions where actually needed
- Wrap remaining module-level addon access in try/except in:
- service.py (log_timing_data)
- default.py (log_timing_data)
- kodi_utils.py (addon variable)
- functions.py (__addon__ and related variables)
This prevents crashes during installation/update while avoiding
None-related issues during normal operation.
- Remove incorrect addContextMenuItems() from item_functions.py as JellyCon uses custom context menu system
- Add "Play with track selection" entry to JellyCon's ActionMenu in show_menu() for Movies and Episodes
- Add handler for play_with_track_selection action that sets force_track_selection parameter
Context Menu Integration:
- Add 'Play with track selection' option to video context menus
- Available for movies and episodes via long-press/context menu
- Forces manual track selection dialog even when auto-selection is configured
Language Selection Improvements:
- Add dropdown selectors for preferred audio/subtitle languages
- Support German, English, French, Spanish, Italian, Japanese, Russian
- Add comprehensive language matching (e.g., 'ger' matches 'deu', 'deutsch', 'german')
- Add setting to auto-select 'No subtitles' when no matching subtitle found
Track Selection Scoring System:
- Audio tracks: Language match (+100), default flag (+50),
channel count (+5-40), codec quality (+10-30), exclude commentary (-100)
- Subtitle tracks: Language match (+100), forced flag (+50),
SRT preference (+30), default flag (+10)
Implementation Details:
- Add force_track_selection parameter throughout playback chain
- Preserve server/remote control track selections when not forcing manual selection
- Add extensive debug logging for track selection decisions
- Respect user preferences while allowing manual override via context menu