From ebd59760aede0df12f0c8d91a00d36aac6132b55 Mon Sep 17 00:00:00 2001 From: mani Date: Tue, 6 Jan 2026 00:46:21 +0100 Subject: [PATCH] Fix context menu import causing movies not to load - Fix incorrect import: change 'from . import translation' to 'from .utils import translate_string' - Add try/except block to prevent context menu errors from breaking playback - Add defensive check for item_details.id existence - Add error logging for debugging context menu issues This fixes the critical bug where the movie menu would not load due to the incorrect translation import. --- resources/lib/item_functions.py | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/resources/lib/item_functions.py b/resources/lib/item_functions.py index da3ec4b..db84a0c 100644 --- a/resources/lib/item_functions.py +++ b/resources/lib/item_functions.py @@ -596,18 +596,24 @@ def add_gui_item(url, item_details, display_options, folder=True, default_sort=F list_item.setProperties(item_properties) # Add context menu for playable video items - if not folder and is_video and item_details.item_type.lower() in ['movie', 'episode']: - from . import translation - context_menu = [] + if not folder and is_video and item_details.id and item_details.item_type.lower() in ['movie', 'episode']: + try: + from .utils import translate_string + context_menu = [] - # Add "Play with track selection" option - play_with_selection_url = ( - 'RunPlugin(plugin://plugin.video.jellycon/' - '?mode=PLAY&item_id={}&force_track_selection=true)'.format(item_details.id) - ) - context_menu.append((translation.translate_string(30701), play_with_selection_url)) + # Add "Play with track selection" option + play_with_selection_url = ( + 'RunPlugin(plugin://plugin.video.jellycon/' + '?mode=PLAY&item_id={}&force_track_selection=true)'.format(item_details.id) + ) + context_menu.append((translate_string(30701), play_with_selection_url)) - list_item.addContextMenuItems(context_menu) + list_item.addContextMenuItems(context_menu) + except Exception as e: + # Don't break playback if context menu fails + import logging + log = logging.getLogger(__name__) + log.debug("Failed to add context menu: {0}".format(e)) return u, list_item, folder