Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2.6.0~alpha2 #13

Merged
merged 2 commits into from
Nov 18, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion addon.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='UTF-8' standalone='yes'?>
<addon id="script.common.plugin.cache" name="Common plugin cache" provider-name="anxdpanic, TheCollective" version="2.6.0~alpha1">
<addon id="script.common.plugin.cache" name="Common plugin cache" provider-name="anxdpanic, TheCollective" version="2.6.0~alpha2">
<requires>
<import addon="xbmc.python" version="2.24.0"/>
</requires>
Expand Down
40 changes: 34 additions & 6 deletions resources/lib/storage_server/StorageServer.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@
except ImportError:
sqlite = None

try:
basestring
except NameError:
basestring = str

PY3 = sys.version_info[0] >= 3


Expand Down Expand Up @@ -522,14 +527,37 @@ def _generateKey(self, funct, *args):
if isinstance(params, dict):
for key in sorted(params.keys()):
if key not in ["new_results_function"]:
keyhash.update("'%s'='%s'" % (key, params[key]))
val = params[key]
if not isinstance(val, basestring):
val = str(val)
if PY3:
if isinstance(key, str):
key = key.encode('utf-8')
if isinstance(val, str):
val = val.encode('utf-8')
key_val_pair = b"'%s'='%s'" % (key, val)
else:
key_val_pair = "'%s'='%s'" % (key, val)
keyhash.update(key_val_pair)
elif isinstance(params, list):
keyhash.update(",".join(["%s" % el for el in params]))
if PY3:
hash_list = []
for el in params:
if not isinstance(el, basestring):
el = str(el)
if isinstance(el, str):
el = el.encode('utf-8')
hash_list.append(el)
keyhash.update(b",".join([b"%s" % el for el in hash_list]))
else:
keyhash.update(",".join(["%s" % el for el in params]))
else:
try:
keyhash.update(params)
except:
keyhash.update(str(params))
if not isinstance(params, basestring):
params = str(params)
if PY3:
if isinstance(params, str):
params = params.encode('utf-8')
keyhash.update(params)

name += "|" + keyhash.hexdigest() + "|"

Expand Down