Skip to content

Commit

Permalink
Reduce unnecessary window navigation fallback attempts
Browse files Browse the repository at this point in the history
  • Loading branch information
MoojMidge committed Nov 15, 2024
1 parent 434369d commit 9f67d91
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 17 deletions.
7 changes: 1 addition & 6 deletions resources/lib/youtube_plugin/kodion/abstract_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,12 +263,7 @@ def reroute(self, context, path=None, params=None, uri=None):
container_uri = context.get_infolabel('Container.FolderPath')
if context.is_plugin_path(container_uri):
context.log_debug('Rerouting - Fallback route not required')
return (
False,
{
self.RESULT_FALLBACK: False,
},
)
return False, {self.RESULT_FALLBACK: False}

if 'refresh' in params:
container = context.get_infolabel('System.CurrentControlId')
Expand Down
2 changes: 1 addition & 1 deletion resources/lib/youtube_plugin/youtube/helper/yt_video.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def _process_rate_video(provider, context, re_match):
client = provider.get_client(context)
json_data = client.get_video_rating(video_id)
if not json_data:
return False
return False, {provider.RESULT_FALLBACK: False}

items = json_data.get('items', [])
if items:
Expand Down
20 changes: 10 additions & 10 deletions resources/lib/youtube_plugin/youtube/provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -767,19 +767,19 @@ def on_sign(provider, context, re_match):

if mode == 'in' or (mode == 'out' and sign_out_confirmed):
yt_login.process(mode, provider, context)
return False
return True

def _search_channel_or_playlist(self, context, identifier):
if re.match(r'U[CU][0-9a-zA-Z_\-]{20,24}', identifier):
json_data = self.get_client(context).get_channels(identifier)
elif re.match(r'[OP]L[0-9a-zA-Z_\-]{30,40}', identifier):
json_data = self.get_client(context).get_playlists(identifier)
else:
return False
return None

if json_data:
return v3.response_to_items(self, context, json_data)
return False
return None

def on_search_run(self, context, query):
data_cache = context.get_data_cache()
Expand Down Expand Up @@ -937,7 +937,7 @@ def on_configure_addon(provider, context, re_match):
action = re_match.group('action')
if action == 'setup_wizard':
provider.run_wizard(context)
return False
return False, {provider.RESULT_FALLBACK: False}
return UriItem('script://{addon},config/{action}'.format(
addon=ADDON_ID, action=action
))
Expand Down Expand Up @@ -1136,7 +1136,7 @@ def on_playback_history(provider, context, re_match):
localize('history.clear'),
localize('history.clear.check')
):
return False
return False, {provider.RESULT_FALLBACK: False}

playback_history.clear()
ui.refresh_container()
Expand All @@ -1159,7 +1159,7 @@ def on_playback_history(provider, context, re_match):
localize('content.remove'),
localize('content.remove.check') % video_name,
):
return False
return False, {provider.RESULT_FALLBACK: False}

playback_history.del_item(video_id)
ui.refresh_container()
Expand Down Expand Up @@ -1708,7 +1708,7 @@ def _update(new_item):
context.localize('bookmarks.clear'),
localize('bookmarks.clear.check')
):
return False
return False, {provider.RESULT_FALLBACK: False}

context.get_bookmarks_list().clear()
ui.refresh_container()
Expand Down Expand Up @@ -1742,7 +1742,7 @@ def _update(new_item):
localize('content.remove'),
localize('content.remove.check') % bookmark_name,
):
return False
return False, {provider.RESULT_FALLBACK: False}

context.get_bookmarks_list().del_item(item_id)
context.get_ui().refresh_container()
Expand Down Expand Up @@ -1809,7 +1809,7 @@ def on_watch_later(provider, context, re_match):
localize('watch_later.clear'),
localize('watch_later.clear.check')
):
return False
return False, {provider.RESULT_FALLBACK: False}

context.get_watch_later_list().clear()
ui.refresh_container()
Expand Down Expand Up @@ -1838,7 +1838,7 @@ def on_watch_later(provider, context, re_match):
localize('content.remove'),
localize('content.remove.check') % video_name,
):
return False
return False, {provider.RESULT_FALLBACK: False}

context.get_watch_later_list().del_item(video_id)
ui.refresh_container()
Expand Down

0 comments on commit 9f67d91

Please sign in to comment.