From acfb9d41287d8ba42903a6e03edefc1717ec159c Mon Sep 17 00:00:00 2001 From: tomkat83 Date: Sun, 7 May 2017 13:42:46 +0200 Subject: [PATCH] Fix TypeError with AdvancedSettings.xml missing - Fixes #290 --- resources/lib/initialsetup.py | 9 +++++---- resources/lib/music.py | 5 +++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/resources/lib/initialsetup.py b/resources/lib/initialsetup.py index 887c04a0..5d9eba95 100644 --- a/resources/lib/initialsetup.py +++ b/resources/lib/initialsetup.py @@ -401,12 +401,13 @@ class InitialSetup(): dialog = self.dialog # Get current Kodi video cache setting - cache, _ = advancedsettings_xml(['cache', 'memorysize']) - if cache is not None: - cache = str(cache.text) - else: + try: + cache, _ = advancedsettings_xml(['cache', 'memorysize']) + except TypeError: # Kodi default cache cache = '20971520' + else: + cache = str(cache.text) log.info('Current Kodi video memory cache in bytes: %s' % cache) settings('kodi_video_cache', value=cache) diff --git a/resources/lib/music.py b/resources/lib/music.py index 9ed2cb7b..3e967bbd 100644 --- a/resources/lib/music.py +++ b/resources/lib/music.py @@ -21,8 +21,9 @@ def get_current_music_folders(): excludefromscan music folders in the advancedsettings.xml """ paths = [] - root, _ = advancedsettings_xml(['audio', 'excludefromscan']) - if root is None: + try: + root, _ = advancedsettings_xml(['audio', 'excludefromscan']) + except TypeError: return paths for element in root: