Fix artwork cache

Still looking into the delay with extra fanart scenario
This commit is contained in:
angelblue05 2015-12-26 20:07:13 -06:00
parent f472f44a40
commit 493459de33

View file

@ -103,55 +103,58 @@ class Artwork():
result = xbmc.executeJSONRPC(json.dumps(web_user)) result = xbmc.executeJSONRPC(json.dumps(web_user))
self.xbmc_username = "kodi" self.xbmc_username = "kodi"
else:
# Webserver already enabled
web_port = {
"jsonrpc": "2.0", # Webserver already enabled
"id": 1, web_port = {
"method": "Settings.GetSettingValue",
"params": {
"setting": "services.webserverport" "jsonrpc": "2.0",
} "id": 1,
"method": "Settings.GetSettingValue",
"params": {
"setting": "services.webserverport"
} }
result = xbmc.executeJSONRPC(json.dumps(web_port)) }
try: result = xbmc.executeJSONRPC(json.dumps(web_port))
self.xbmc_port = result['result']['value'] result = json.loads(result)
except TypeError: try:
pass self.xbmc_port = result['result']['value']
except TypeError:
pass
web_user = { web_user = {
"jsonrpc": "2.0", "jsonrpc": "2.0",
"id": 1, "id": 1,
"method": "Settings.GetSettingValue", "method": "Settings.GetSettingValue",
"params": { "params": {
"setting": "services.webserverusername" "setting": "services.webserverusername"
}
} }
result = xbmc.executeJSONRPC(json.dumps(web_user)) }
try: result = xbmc.executeJSONRPC(json.dumps(web_user))
self.xbmc_username = result['result']['value'] result = json.loads(result)
except TypeError: try:
pass self.xbmc_username = result['result']['value']
except TypeError:
pass
web_pass = { web_pass = {
"jsonrpc": "2.0", "jsonrpc": "2.0",
"id": 1, "id": 1,
"method": "Settings.GetSettingValue", "method": "Settings.GetSettingValue",
"params": { "params": {
"setting": "services.webserverpassword" "setting": "services.webserverpassword"
}
} }
result = xbmc.executeJSONRPC(json.dumps(web_pass)) }
try: result = xbmc.executeJSONRPC(json.dumps(web_pass))
self.xbmc_password = result['result']['value'] result = json.loads(result)
except TypeError: try:
pass self.xbmc_password = result['result']['value']
except TypeError:
pass
def FullTextureCacheSync(self): def FullTextureCacheSync(self):
# This method will sync all Kodi artwork to textures13.db # This method will sync all Kodi artwork to textures13.db
@ -315,13 +318,13 @@ class Artwork():
cacheimage = True cacheimage = True
self.logMsg("Adding Art Link for kodiId: %s (%s)" % (kodiId, imageUrl), 2) self.logMsg("Adding Art Link for kodiId: %s (%s)" % (kodiId, imageUrl), 2)
query = ' '.join(( query = (
'''
INSERT INTO art(media_id, media_type, type, url)
"INSERT INTO art(", VALUES (?, ?, ?, ?)
"media_id, media_type, type, url)", '''
)
"VALUES (?, ?, ?, ?)"
))
cursor.execute(query, (kodiId, mediaType, imageType, imageUrl)) cursor.execute(query, (kodiId, mediaType, imageType, imageUrl))
else: # Only cache artwork if it changed else: # Only cache artwork if it changed