From c473305556998f7ecb1d54887265e255a3a0ef96 Mon Sep 17 00:00:00 2001 From: im85288 Date: Fri, 3 Apr 2015 11:33:44 +0100 Subject: [PATCH] add a loop for deleting the database if it fails first time and back out if it does not work --- resources/lib/Utils.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/resources/lib/Utils.py b/resources/lib/Utils.py index 016291dd..b1e53184 100644 --- a/resources/lib/Utils.py +++ b/resources/lib/Utils.py @@ -171,8 +171,19 @@ def reset(): xbmc.sleep(1000) # delete db - os.remove(getKodiDBPath()) - + deletecount = 0 + deleted = False + while(deleted == False): + try: + os.remove(getKodiDBPath()) + deleted = True + except: + deletecount += 1 + if(deletecount > 10): + dialog.ok('Warning', 'Could not delete Database, please try again later') + return + xbmc.sleep(1000) + # remove from addon data directory addon = xbmcaddon.Addon(id='plugin.video.emby') addondir = xbmc.translatePath(addon.getAddonInfo('profile'))