Skip to content

Commit

Permalink
Fix plugin URI redirect from search
Browse files Browse the repository at this point in the history
  • Loading branch information
MoojMidge committed Dec 7, 2024
1 parent dfcd335 commit d47d61f
Showing 1 changed file with 20 additions and 12 deletions.
32 changes: 20 additions & 12 deletions resources/lib/youtube_plugin/kodion/plugin/xbmc/xbmc_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,14 +263,19 @@ def run(self, provider, context, focused=None):
ui.clear_property(CONTENT_TYPE)

if not options or options.get(provider.RESULT_FALLBACK, True):
result, post_run_action = self.uri_action(
_, _post_run_action = self.uri_action(
context,
context.get_parent_uri(params={
'window_fallback': True,
'window_replace': True,
'window_return': False,
}),
)
if post_run_action and _post_run_action:
post_run_action = (post_run_action, _post_run_action)
else:
post_run_action = _post_run_action

cache_to_disc = False
update_listing = True

Expand All @@ -285,21 +290,24 @@ def run(self, provider, context, focused=None):
if container and position:
context.send_notification(CONTAINER_FOCUS, [container, position])

if post_run_action:
if isinstance(post_run_action, tuple):
self.post_run(context, ui, *post_run_action)
elif post_run_action:
self.post_run(context, ui, post_run_action)
return succeeded

@staticmethod
def post_run(context, ui, action, timeout=30):
while ui.busy_dialog_active():
timeout -= 1
if timeout < 0:
context.log_error('Multiple busy dialogs active'
' - Post run action unable to execute')
break
context.sleep(1)
else:
context.execute(action)
def post_run(context, ui, *actions, timeout=30):
for action in actions:
while ui.busy_dialog_active():
timeout -= 1
if timeout < 0:
context.log_error('Multiple busy dialogs active'
' - Post run action unable to execute')
break
context.sleep(1)
else:
context.execute(action)

@staticmethod
def uri_action(context, uri):
Expand Down

0 comments on commit d47d61f

Please sign in to comment.