diff --git a/plugin.program.autowidget/resources/lib/common/utils.py b/plugin.program.autowidget/resources/lib/common/utils.py index afee6028..c915fedd 100644 --- a/plugin.program.autowidget/resources/lib/common/utils.py +++ b/plugin.program.autowidget/resources/lib/common/utils.py @@ -378,7 +378,6 @@ def _get_json_version(): return (result['major'], result['minor'], result['patch']) def cache_files(path): - hash = hashlib.sha1(path).hexdigest() hash = hashlib.sha1(six.text_type(path)).hexdigest() cache_path = os.path.join(_addon_path, '{}.cache'.format(hash)) version = _get_json_version() @@ -391,7 +390,7 @@ def cache_files(path): files_json = call_jsonrpc(json.dumps(params)) files = json.loads(files_json) write_json(cache_path, files) - expiry = cache_expiry(hash, add=hashlib.sha1(json.dumps(files_json)).hexdigest()) + expiry = cache_expiry(hash, add=hashlib.sha1(files_json.encode('utf8')).hexdigest()) log("Wrote cache (exp in {}s): {}".format(expiry-time.time(), hash), 'notice') return files diff --git a/plugin.program.autowidget/resources/lib/refresh.py b/plugin.program.autowidget/resources/lib/refresh.py index 8983289d..24fda655 100644 --- a/plugin.program.autowidget/resources/lib/refresh.py +++ b/plugin.program.autowidget/resources/lib/refresh.py @@ -255,11 +255,14 @@ def get_files_list(path, titles=None, widget_id=None): def queue_widget_update(widget_id): global _thread + new_thread = False if _thread is None or not _thread.is_alive(): _thread = Worker() _thread.daemon = True - _thread.queue.put(widget_id) - _thread.start() + new_thread = True + _thread.queue.put(widget_id) + if new_thread: + _thread.start() class Worker(threading.Thread): def __init__(self):