diff options
author | Vilem Duha <vilem.duha@gmail.com> | 2019-06-01 19:21:40 +0300 |
---|---|---|
committer | Vilem Duha <vilem.duha@gmail.com> | 2019-06-01 19:49:19 +0300 |
commit | 75fc9e45892dd8b011a4facf3d549b0df0d7a6dd (patch) | |
tree | cea8a61e85d5f6ee5baf9684a8c01fca0c0e2431 | |
parent | 07d74a9b2e341c2eea77404b25d45791e3c46296 (diff) |
BlenderKit: fix a bug in text splitting(could run eternal while) and fix wrong argument in Oauth
-rw-r--r-- | blenderkit/bkit_oauth.py | 5 | ||||
-rw-r--r-- | blenderkit/paths.py | 2 | ||||
-rw-r--r-- | blenderkit/search.py | 6 |
3 files changed, 7 insertions, 6 deletions
diff --git a/blenderkit/bkit_oauth.py b/blenderkit/bkit_oauth.py index 28ca2d89..6685ff2c 100644 --- a/blenderkit/bkit_oauth.py +++ b/blenderkit/bkit_oauth.py @@ -62,11 +62,10 @@ def refresh_token_thread(): def refresh_token(api_key_refresh): - authenticator = oauth.SimpleOAuthAuthenticator(server_url=paths.get_bkit_url(), client_id=CLIENT_ID, ports=PORTS, - redirect_url='') + authenticator = oauth.SimpleOAuthAuthenticator(server_url=paths.get_bkit_url(), client_id=CLIENT_ID, ports=PORTS) auth_token, refresh_token = authenticator.get_refreshed_token(api_key_refresh) if auth_token is not None and refresh_token is not None: - tasks_queue.add_task((blenderkit.bkit_oauth.write_tokens, (auth_token, refresh_token))) + tasks_queue.add_task((write_tokens, (auth_token, refresh_token))) def write_tokens(auth_token, refresh_token): diff --git a/blenderkit/paths.py b/blenderkit/paths.py index 6103ce8a..df765b3f 100644 --- a/blenderkit/paths.py +++ b/blenderkit/paths.py @@ -18,6 +18,7 @@ import bpy, os, sys +_presets = os.path.join(bpy.utils.user_resource('SCRIPTS'), "presets") BLENDERKIT_LOCAL = "http://localhost:8001" BLENDERKIT_MAIN = "https://www.blenderkit.com" BLENDERKIT_DEVEL = "https://devel.blenderkit.com" @@ -34,7 +35,6 @@ BLENDERKIT_SIGNUP_URL = "https://www.blenderkit.com/accounts/register" BLENDERKIT_ADDON_URL = "https://www.blenderkit.com/api/v1/assets/6923b215-7df0-46f3-95ae-a2b5ff44ddd5/" BLENDERKIT_ADDON_FILE_URL = "https://www.blenderkit.com/get-blenderkit/" BLENDERKIT_SETTINGS_FILENAME = os.path.join(_presets, "bkit.json") -_presets = os.path.join(bpy.utils.user_resource('SCRIPTS'), "presets") def get_bkit_url(): diff --git a/blenderkit/search.py b/blenderkit/search.py index eb1d2888..569d6a76 100644 --- a/blenderkit/search.py +++ b/blenderkit/search.py @@ -308,11 +308,13 @@ def split_subs(text): threshold = 40 text = text.rstrip() lines = [] + while len(text) > threshold: i = text.rfind(' ', 0, threshold) i1 = text.rfind(',', 0, threshold) - i = max(i, i1) - if i == -1: + i2 = text.rfind('.', 0, threshold) + i = max(i, i1, i2) + if i <= 0: i = threshold lines.append(text[:i]) text = text[i:] |