Skip to content

Commit

Permalink
Merge pull request #1376 from otseng/main
Browse files Browse the repository at this point in the history
Ver 34.91; Added lexiconreverse to api server (#270)
  • Loading branch information
otseng committed Jun 30, 2023
2 parents 7df852b + 8c3df8b commit 09b81ef
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 6 deletions.
2 changes: 1 addition & 1 deletion UniqueBibleAppVersion.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
34.90
34.91
10 changes: 10 additions & 0 deletions db/ToolsSqlite.py
Original file line number Diff line number Diff line change
Expand Up @@ -958,6 +958,16 @@ def getReverseContent(self, entry):
contentText = re.sub("(" + entry + ")", r"<z>\1</z>", 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):
Expand Down
3 changes: 3 additions & 0 deletions latest_changes.txt
Original file line number Diff line number Diff line change
@@ -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

Expand Down
10 changes: 5 additions & 5 deletions patches.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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")
15 changes: 15 additions & 0 deletions util/RemoteApiHandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -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":
Expand Down Expand Up @@ -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):
Expand Down

0 comments on commit 09b81ef

Please sign in to comment.