From 9c11dbc113e0fd966b8c118af3ac2bf87b058fc1 Mon Sep 17 00:00:00 2001 From: Matt Date: Sun, 24 May 2020 16:26:39 -0400 Subject: [PATCH] Validate token returns dict no matter what --- jellyfin_kodi/jellyfin/api.py | 2 +- jellyfin_kodi/jellyfin/connection_manager.py | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/jellyfin_kodi/jellyfin/api.py b/jellyfin_kodi/jellyfin/api.py index 686588b3..cc8b1547 100644 --- a/jellyfin_kodi/jellyfin/api.py +++ b/jellyfin_kodi/jellyfin/api.py @@ -434,7 +434,7 @@ class API(object): if response.status_code == 200: return response.json() else: - return response.status_code + return { 'Status_Code': response.status_code } def get_public_info(self, server_address): response = self.send_request(server_address, "system/info/public") diff --git a/jellyfin_kodi/jellyfin/connection_manager.py b/jellyfin_kodi/jellyfin/connection_manager.py index a23ef4f3..f5eb05e5 100644 --- a/jellyfin_kodi/jellyfin/connection_manager.py +++ b/jellyfin_kodi/jellyfin/connection_manager.py @@ -309,7 +309,7 @@ class ConnectionManager(object): elif verify_authentication and server.get('AccessToken'): system_info = self.API.validate_authentication_token(server) - if system_info and type(system_info) == dict: + if 'Status_Code' not in system_info: self._update_server_info(server, system_info) self.config.data['auth.user_id'] = server['UserId'] @@ -319,9 +319,8 @@ class ConnectionManager(object): server['UserId'] = None server['AccessToken'] = None - return { - 'State': CONNECTION_STATE['Unavailable'], - 'Status_Code': system_info} + system_info['State'] = CONNECTION_STATE['Unavailable'] + return system_info self._update_server_info(server, system_info)