Skip to content

Commit

Permalink
Add Quick Search and search management context menu items to Search l…
Browse files Browse the repository at this point in the history
…istitems
  • Loading branch information
MoojMidge committed Nov 10, 2024
1 parent 64b5df5 commit 1252251
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 7 deletions.
4 changes: 0 additions & 4 deletions resources/lib/youtube_plugin/kodion/constants/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,6 @@
CONTAINER_POSITION = 'container_position'
CONTENT_TYPE = 'content_type'
DEVELOPER_CONFIGS = 'configs'
LICENSE_TOKEN = 'license_token'
LICENSE_URL = 'license_url'
PLAYER_DATA = 'player_json'
PLAYLIST_PATH = 'playlist_path'
PLAYLIST_POSITION = 'playlist_position'
Expand Down Expand Up @@ -144,8 +142,6 @@
'CONTAINER_POSITION',
'CONTENT_TYPE',
'DEVELOPER_CONFIGS',
'LICENSE_TOKEN',
'LICENSE_URL',
'PLAYER_DATA',
'PLAYLIST_PATH',
'PLAYLIST_POSITION',
Expand Down
15 changes: 12 additions & 3 deletions resources/lib/youtube_plugin/kodion/items/menu_items.py
Original file line number Diff line number Diff line change
Expand Up @@ -680,11 +680,20 @@ def goto_home(context):
)


def goto_quick_search(context):
return (
context.localize('search.quick'),
def goto_quick_search(context, params=None, incognito=None):
if params is None:
params = {}
if incognito is None:
incognito = params.get('incognito')
else:
params['incognito'] = incognito
return (
context.localize('search.quick.incognito'
if incognito else
'search.quick'),
context.create_uri(
(PATHS.ROUTE, PATHS.SEARCH, 'input',),
params,
run=True,
),
)
Expand Down
13 changes: 13 additions & 0 deletions resources/lib/youtube_plugin/kodion/items/new_search_item.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

from __future__ import absolute_import, division, unicode_literals

from . import menu_items
from .directory_item import DirectoryItem
from ..constants import PATHS

Expand Down Expand Up @@ -47,3 +48,15 @@ def __init__(self,
),
image=image,
fanart=fanart)

if context.is_plugin_path(context.get_uri(), (PATHS.SEARCH, 'list',)):
context_menu = [
menu_items.search_clear(context),
menu_items.separator(),
menu_items.goto_quick_search(context, params, not incognito)
]
else:
context_menu = [
menu_items.goto_quick_search(context, params, not incognito)
]
self.add_context_menu(context_menu)
9 changes: 9 additions & 0 deletions resources/lib/youtube_plugin/kodion/items/search_item.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

from __future__ import absolute_import, division, unicode_literals

from . import menu_items
from .directory_item import DirectoryItem
from ..constants import PATHS

Expand Down Expand Up @@ -38,3 +39,11 @@ def __init__(self,
),
image=image,
fanart=fanart)

context_menu = [
menu_items.search_clear(context),
menu_items.separator(),
menu_items.goto_quick_search(context, params),
menu_items.goto_quick_search(context, params, incognito=True)
]
self.add_context_menu(context_menu)

0 comments on commit 1252251

Please sign in to comment.