From 9f67d91e5920e1e8c859602e8cefd055647d53ad Mon Sep 17 00:00:00 2001 From: MoojMidge <56883549+MoojMidge@users.noreply.github.com> Date: Sat, 16 Nov 2024 08:06:07 +1100 Subject: [PATCH] Reduce unnecessary window navigation fallback attempts --- .../kodion/abstract_provider.py | 7 +------ .../youtube_plugin/youtube/helper/yt_video.py | 2 +- .../lib/youtube_plugin/youtube/provider.py | 20 +++++++++---------- 3 files changed, 12 insertions(+), 17 deletions(-) diff --git a/resources/lib/youtube_plugin/kodion/abstract_provider.py b/resources/lib/youtube_plugin/kodion/abstract_provider.py index 2e9909fe2..9038e3646 100644 --- a/resources/lib/youtube_plugin/kodion/abstract_provider.py +++ b/resources/lib/youtube_plugin/kodion/abstract_provider.py @@ -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') diff --git a/resources/lib/youtube_plugin/youtube/helper/yt_video.py b/resources/lib/youtube_plugin/youtube/helper/yt_video.py index 294a51a9a..3569ae9fb 100644 --- a/resources/lib/youtube_plugin/youtube/helper/yt_video.py +++ b/resources/lib/youtube_plugin/youtube/helper/yt_video.py @@ -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: diff --git a/resources/lib/youtube_plugin/youtube/provider.py b/resources/lib/youtube_plugin/youtube/provider.py index f602c935f..a19cb3590 100644 --- a/resources/lib/youtube_plugin/youtube/provider.py +++ b/resources/lib/youtube_plugin/youtube/provider.py @@ -767,7 +767,7 @@ 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): @@ -775,11 +775,11 @@ def _search_channel_or_playlist(self, context, 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() @@ -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 )) @@ -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() @@ -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() @@ -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() @@ -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() @@ -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() @@ -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()