From 1c75b09824bfbcb432f57ea20f0093796c9fe7f2 Mon Sep 17 00:00:00 2001 From: mani Date: Tue, 6 Jan 2026 00:55:13 +0100 Subject: [PATCH] Fix context menu implementation for track selection - 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 --- resources/lib/functions.py | 11 +++++++++++ resources/lib/item_functions.py | 20 -------------------- 2 files changed, 11 insertions(+), 20 deletions(-) diff --git a/resources/lib/functions.py b/resources/lib/functions.py index fa618f2..cf061bf 100644 --- a/resources/lib/functions.py +++ b/resources/lib/functions.py @@ -343,6 +343,12 @@ def show_menu(params): li.setProperty('menu_id', 'play') action_items.append(li) + # Add "Play with track selection" for Movies and Episodes + if result["Type"] in ["Episode", "Movie"]: + li = xbmcgui.ListItem(translate_string(30701), offscreen=True) + li.setProperty('menu_id', 'play_with_track_selection') + action_items.append(li) + if result["Type"] in ["Season", "MusicArtist", "MusicAlbum", "Playlist", "MusicGenre"]: li = xbmcgui.ListItem(translate_string(30317), offscreen=True) @@ -473,6 +479,11 @@ def show_menu(params): log.debug("Play Item") play_action(params) + elif selected_action == "play_with_track_selection": + log.debug("Play Item with Track Selection") + params["force_track_selection"] = "true" + play_action(params) + elif selected_action == "set_view": log.debug("Setting view type for {0} to {1}".format( view_key, container_view_id) diff --git a/resources/lib/item_functions.py b/resources/lib/item_functions.py index db84a0c..45dd2e1 100644 --- a/resources/lib/item_functions.py +++ b/resources/lib/item_functions.py @@ -595,26 +595,6 @@ 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.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((translate_string(30701), play_with_selection_url)) - - 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