Don't crash when a user skips server setup

This commit is contained in:
Matt 2020-12-14 22:34:23 -05:00
parent ac9db1b486
commit 49ce9e4359

View file

@ -58,10 +58,10 @@ class Events(object):
api_client = jellyfin_client.jellyfin api_client = jellyfin_client.jellyfin
addon_data = xbmc.translatePath("special://profile/addon_data/plugin.video.jellyfin/data.json") addon_data = xbmc.translatePath("special://profile/addon_data/plugin.video.jellyfin/data.json")
try:
with open(addon_data, 'rb') as infile: with open(addon_data, 'rb') as infile:
data = json.load(infile) data = json.load(infile)
try:
server_data = data['Servers'][0] server_data = data['Servers'][0]
api_client.config.data['auth.server'] = server_data.get('address') api_client.config.data['auth.server'] = server_data.get('address')
api_client.config.data['auth.server-name'] = server_data.get('Name') api_client.config.data['auth.server-name'] = server_data.get('Name')