diff --git a/UniqueBibleAppVersion.txt b/UniqueBibleAppVersion.txt index 250b382c8..e1b26f1b5 100755 --- a/UniqueBibleAppVersion.txt +++ b/UniqueBibleAppVersion.txt @@ -1 +1 @@ -34.90 +34.91 diff --git a/db/ToolsSqlite.py b/db/ToolsSqlite.py index c79a617e1..2f0275ecb 100644 --- a/db/ToolsSqlite.py +++ b/db/ToolsSqlite.py @@ -958,6 +958,16 @@ def getReverseContent(self, entry): contentText = re.sub("(" + entry + ")", r"\1", contentText, flags=re.IGNORECASE) return contentText + def getRawReverseContent(self, entry): + try: + search = "%{0}%".format(entry) + query = "SELECT Topic, Definition FROM Lexicon WHERE Definition LIKE ?" + self.cursor.execute(query, (search,)) + return self.cursor.fetchall() + except Exception as ex: + return "" + + class BookData: def __init__(self): diff --git a/latest_changes.txt b/latest_changes.txt index f5722629a..69038f731 100755 --- a/latest_changes.txt +++ b/latest_changes.txt @@ -1,3 +1,6 @@ +Changes in 34.91: +* Added lexiconreverse to api server + Changes in 34.90: * added support of gpt-3.5-turbo-16k diff --git a/patches.txt b/patches.txt index 7a92d3144..7fed34437 100755 --- a/patches.txt +++ b/patches.txt @@ -1222,9 +1222,7 @@ (33.20, "file", "util/PromptValidator.py") (33.25, "file", "util/LexicalData.py") (33.28, "file", ".gitignore") -(33.38, "file", "util/RemoteApiHandler.py") (33.48, "file", "gui/CentralWidget.py") -(33.50, "file", "db/ToolsSqlite.py") (33.50, "file", "gui/MiniControl.py") (33.50, "file", "gui/NoteEditor.py") (33.50, "file", "plugins/context/English Dictionaries_Ctrl+Shift+D.py") @@ -1388,6 +1386,8 @@ (34.89, "file", "util/AGBparagraphs_expanded.py") (34.89, "file", "marvelData/AGBTS_data.sqlite") (34.90, "file", "util/LocalCliHandler.py") -(34.90, "file", "latest_changes.txt") -(34.90, "file", "patches.txt") -(34.90, "file", "UniqueBibleAppVersion.txt") +(34.91, "file", "db/ToolsSqlite.py") +(34.91, "file", "util/RemoteApiHandler.py") +(34.91, "file", "latest_changes.txt") +(34.91, "file", "UniqueBibleAppVersion.txt") +(34.91, "file", "patches.txt") diff --git a/util/RemoteApiHandler.py b/util/RemoteApiHandler.py index 6d3d6092d..4a2930619 100644 --- a/util/RemoteApiHandler.py +++ b/util/RemoteApiHandler.py @@ -124,6 +124,8 @@ def processRequest(self, request): self.processCommentaryCommand(cmd) elif command == "lexicon": self.processLexiconCommand(cmd) + elif command == "lexiconreverse": + self.processLexiconReverseCommand(cmd) elif command == "devotional": self.processDevotionalCommand(cmd) elif command == "dictionary": @@ -273,6 +275,19 @@ def processLexiconCommand(self, cmd): data = Lexicon(cmd[1]).getRawContent(cmd[2]) self.jsonData['data'] = data if data else ("[Not found]",) + # /lexiconreverse + # /lexiconreverse/TRLIT/love + def processLexiconReverseCommand(self, cmd): + CatalogUtil.reloadLocalCatalog() + if len(cmd) == 1: + self.jsonData['data'] = [lexicon for lexicon in LexiconData().lexiconList] + return + elif len(cmd) < 3: + self.sendError("Invalid Lexicon command") + return + data = Lexicon(cmd[1]).getRawReverseContent(cmd[2]) + self.jsonData['data'] = data if data else ("[Not found]",) + # /devotional # /devotional/Chambers+-+My+Utmost+For+His+Highest/12/25 def processDevotionalCommand(self, cmd):