Ensure file properties exists

For credentials and sync information
This commit is contained in:
angelblue05 2018-09-06 15:40:23 -05:00
parent b35c7b5715
commit 5f9c071c39
2 changed files with 10 additions and 2 deletions

View file

@ -227,7 +227,12 @@ def get_sync():
with open(os.path.join(path, 'sync.json')) as infile:
sync = json.load(infile)
except Exception:
sync = {'Libraries': [], 'RestorePoint': {}, 'Whitelist': []}
sync = {}
sync['Libraries'] = sync.get('Libraries', [])
sync['RestorePoint'] = sync.get('RestorePoint', {})
sync['Whitelist'] = sync.get('Whitelist', [])
sync['SortedViews'] = sync.get('SortedViews', [])
return sync
@ -254,7 +259,9 @@ def get_credentials():
with open(os.path.join(path, 'data.json')) as infile:
credentials = json.load(infile)
except Exception:
credentials = {'Servers': []}
credentials = {}
credentials['Servers'] = credentials.get('Servers', [])
return credentials

View file

@ -3,6 +3,7 @@
##################################################################################################
import logging
import xbmc
import database