From 25172c2f57e9d93d5fec062f4b91f79aff0bae41 Mon Sep 17 00:00:00 2001 From: croneter Date: Sun, 2 Feb 2020 14:09:10 +0100 Subject: [PATCH] Other Kodi add-ons can now search for Plex items using plugin://plugin.video.plexkodiconnect?mode=search&query= --- default.py | 6 ++++-- resources/lib/entrypoint.py | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/default.py b/default.py index a05dc5d4..149f145e 100644 --- a/default.py +++ b/default.py @@ -50,7 +50,8 @@ class Main(): plex_type=params.get('plex_type'), section_id=params.get('section_id'), synched=params.get('synched') != 'false', - prompt=params.get('prompt')) + prompt=params.get('prompt'), + query=params.get('query')) elif mode == 'show_section': entrypoint.show_section(params.get('section_index')) @@ -66,7 +67,8 @@ class Main(): entrypoint.browse_plex(key='/hubs/search', args={'includeCollections': 1, 'includeExternalMedia': 1}, - prompt=utils.lang(137)) + prompt=utils.lang(137), + query=params.get('query')) elif mode == 'route_to_extras': # Hack so we can store this path in the Kodi DB diff --git a/resources/lib/entrypoint.py b/resources/lib/entrypoint.py index 8880501e..ee25c2b1 100644 --- a/resources/lib/entrypoint.py +++ b/resources/lib/entrypoint.py @@ -468,7 +468,7 @@ def watchlater(): def browse_plex(key=None, plex_type=None, section_id=None, synched=True, - args=None, prompt=None): + args=None, prompt=None, query=None): """ Lists the content of a Plex folder, e.g. channels. Either pass in key (to be used directly for PMS url {server}) or the section_id @@ -483,7 +483,9 @@ def browse_plex(key=None, plex_type=None, section_id=None, synched=True, return app.init(entrypoint=True) args = args or {} - if prompt: + if query: + args['query'] = query + elif prompt: prompt = utils.dialog('input', prompt) if prompt is None: # User cancelled