Fix context menu implementation for track selection
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 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
This commit is contained in:
mani
2026-01-06 00:55:13 +01:00
parent ebd59760ae
commit 1c75b09824
2 changed files with 11 additions and 20 deletions

View File

@@ -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)

View File

@@ -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