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,7 +103,7 @@ 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 # Webserver already enabled
web_port = { web_port = {
@ -116,6 +116,7 @@ class Artwork():
} }
} }
result = xbmc.executeJSONRPC(json.dumps(web_port)) result = xbmc.executeJSONRPC(json.dumps(web_port))
result = json.loads(result)
try: try:
self.xbmc_port = result['result']['value'] self.xbmc_port = result['result']['value']
except TypeError: except TypeError:
@ -132,6 +133,7 @@ class Artwork():
} }
} }
result = xbmc.executeJSONRPC(json.dumps(web_user)) result = xbmc.executeJSONRPC(json.dumps(web_user))
result = json.loads(result)
try: try:
self.xbmc_username = result['result']['value'] self.xbmc_username = result['result']['value']
except TypeError: except TypeError:
@ -148,6 +150,7 @@ class Artwork():
} }
} }
result = xbmc.executeJSONRPC(json.dumps(web_pass)) result = xbmc.executeJSONRPC(json.dumps(web_pass))
result = json.loads(result)
try: try:
self.xbmc_password = result['result']['value'] self.xbmc_password = result['result']['value']
except TypeError: except TypeError:
@ -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