dont save the new cache data until the display process finishes

This commit is contained in:
faush01
2018-11-12 15:59:47 +11:00
parent 2fcd0fc9f2
commit ddaf662f1c
2 changed files with 7 additions and 3 deletions

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="plugin.video.embycon"
name="EmbyCon"
version="1.6.6"
version="1.6.7"
provider-name="Team B">
<requires>
<import addon="xbmc.python" version="2.25.0"/>

View File

@@ -131,9 +131,12 @@ class CacheManagerThread(threading.Thread):
xbmc.sleep(100)
loops = loops + 1
wait_refresh = home_window.getProperty("wait_refresh")
log.debug("CacheManagerThread : Saving New Data loops({0})", loops)
with open(self.cache_file, 'wb') as handle:
cPickle.dump(self.fresh_data, handle, protocol=cPickle.HIGHEST_PROTOCOL)
home_window.clearProperty("wait_refresh")
else:
@@ -162,8 +165,6 @@ class CacheManagerThread(threading.Thread):
# if they dont match then save the data and trigger a content reload
if cached_hash != loaded_hash:
log.debug("CacheManagerThread : Saving new cache data and reloading container")
with open(self.cache_file, 'wb') as handle:
cPickle.dump(loaded_items, handle, protocol=cPickle.HIGHEST_PROTOCOL)
# we need to refresh but will wait until the main function has finished
loops = 0
@@ -174,6 +175,9 @@ class CacheManagerThread(threading.Thread):
loops = loops + 1
wait_refresh = home_window.getProperty("wait_refresh")
with open(self.cache_file, 'wb') as handle:
cPickle.dump(loaded_items, handle, protocol=cPickle.HIGHEST_PROTOCOL)
home_window.clearProperty("wait_refresh")
log.debug("CacheManagerThread : Sending container refresh ({0})", loops)
xbmc.executebuiltin("Container.Refresh")