[Bf-extensions-cvs] [75fc9e45] master: BlenderKit: fix a bug in text splitting(could run eternal while) and fix wrong argument in Oauth

Vilem Duha noreply at git.blender.org
Sat Jun 1 18:57:22 CEST 2019


Commit: 75fc9e45892dd8b011a4facf3d549b0df0d7a6dd
Author: Vilem Duha
Date:   Sat Jun 1 18:21:40 2019 +0200
Branches: master
https://developer.blender.org/rBA75fc9e45892dd8b011a4facf3d549b0df0d7a6dd

BlenderKit: fix a bug in text splitting(could run eternal while) and fix wrong argument in Oauth

===================================================================

M	blenderkit/bkit_oauth.py
M	blenderkit/paths.py
M	blenderkit/search.py

===================================================================

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:]



More information about the Bf-extensions-cvs mailing list