add option to disable local data cache

This commit is contained in:
sfaulds
2017-04-19 13:23:44 +10:00
parent 9f3dc789fd
commit 742cf09792
3 changed files with 18 additions and 6 deletions

View File

@@ -38,6 +38,7 @@
<string id="30135">Error</string>
<string id="30136">EmbyCon service is not running</string>
<string id="30137">Please restart Kodi</string>
<string id="30138">Cache Emby Data Locally</string>
<string id="30150">Skin does not support setting views</string>
<string id="30151">Select item action (Requires Restart)</string>

View File

@@ -57,14 +57,25 @@ class DataManager():
return json.loads(jsonData)
def GetContent(self, url):
__addon__ = xbmcaddon.Addon(id='plugin.video.embycon')
use_cache_system = __addon__.getSetting('cacheEmbyData') == "true"
if use_cache_system == False:
# dont use cache system at all, just get the result and return
log.info("GetContent - Not using cache system")
jsonData = DownloadUtils().downloadUrl(url, suppress=False, popup=1)
result = self.loadJasonData(jsonData)
log.info("Returning Loaded Result")
return result
# first get the url hash
m = hashlib.md5()
m.update(url)
urlHash = m.hexdigest()
# build cache data path
__addon__ = xbmcaddon.Addon(id='plugin.video.embycon')
__addondir__ = xbmc.translatePath( __addon__.getAddonInfo('profile'))
if not os.path.exists(os.path.join(__addondir__, "cache")):
os.makedirs(os.path.join(__addondir__, "cache"))
@@ -74,10 +85,10 @@ class DataManager():
# are we forcing a reload
WINDOW = xbmcgui.Window( 10000 )
force_data_reload = WINDOW.getProperty("force_data_reload")
WINDOW.setProperty("force_data_reload", "false")
force_data_reload = WINDOW.getProperty("force_data_reload") == "true"
WINDOW.clearProperty("force_data_reload")
if(os.path.exists(cacheDataPath)) and force_data_reload != "true":
if os.path.exists(cacheDataPath) and not force_data_reload:
# load data from cache if it is available and trigger a background
# verification process to test cache validity
log.info("Loading Cached File")

View File

@@ -8,7 +8,6 @@
<setting id="username" type="text" label="30024" />
<setting id="password" type="text" option="hidden" label="30025" />
<setting id="deviceName" type="text" label="30016" default="EmbyCon" visible="true" enable="true" />
</category>
<category label="30207">
<setting id="playback_type" type="enum" label="30206" values="File Direct Path|HTTP Direct Stream|HTTP Transcode" default="0" />
@@ -28,5 +27,6 @@
<category label="30022"> <!-- Advanced -->
<setting id="logLevel" type="enum" label="30004" values="None|Info|Debug" default="0" />
<setting id="profile" type="bool" label="30010" default="false" visible="true" enable="true" />
<setting id="cacheEmbyData" type="bool" label="30138" default="false" visible="true" enable="true" />
</category>
</settings>