From f8ec610f9bd1851bd278c1cb855aebbf8038f4cd Mon Sep 17 00:00:00 2001 From: MoojMidge <56883549+MoojMidge@users.noreply.github.com> Date: Tue, 19 Nov 2024 07:10:01 +1100 Subject: [PATCH] Fix uncaught exception when sign-in does not succeed #985 --- .../kodion/json_store/access_manager.py | 11 ++++++----- .../lib/youtube_plugin/youtube/helper/yt_login.py | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/resources/lib/youtube_plugin/kodion/json_store/access_manager.py b/resources/lib/youtube_plugin/kodion/json_store/access_manager.py index a6d8b62d5..e6e9a4b83 100644 --- a/resources/lib/youtube_plugin/kodion/json_store/access_manager.py +++ b/resources/lib/youtube_plugin/kodion/json_store/access_manager.py @@ -456,11 +456,12 @@ def update_access_token(self, } if expiry is not None: - details['token_expires'] = time.time() + ( - min(map(int, [val for val in expiry if val])) - if isinstance(expiry, (list, tuple)) else - int(expiry) - ) + if isinstance(expiry, (list, tuple)): + expiry = [val for val in expiry if val] + expiry = min(map(int, expiry)) if expiry else -1 + else: + expiry = int(expiry) + details['token_expires'] = time.time() + expiry if refresh_token is not None: details['refresh_token'] = ( diff --git a/resources/lib/youtube_plugin/youtube/helper/yt_login.py b/resources/lib/youtube_plugin/youtube/helper/yt_login.py index f495b993a..3d6ba7d18 100644 --- a/resources/lib/youtube_plugin/youtube/helper/yt_login.py +++ b/resources/lib/youtube_plugin/youtube/helper/yt_login.py @@ -121,7 +121,7 @@ def _do_login(token_type): tokens = ['tv', 'personal'] for token_type, token in enumerate(tokens): - new_token = _do_login(token_type) or (None, 0, None) + new_token = _do_login(token_type) or ('', -1, '') tokens[token_type] = new_token context.log_debug('YouTube Login:'