Skip to content

Commit

Permalink
Merge pull request #1429 from otseng/main
Browse files Browse the repository at this point in the history
Add concordance to api server (#292)
  • Loading branch information
eliranwong committed May 14, 2024
2 parents cfe96c5 + 1b355d6 commit 622f91e
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 5 deletions.
2 changes: 1 addition & 1 deletion UniqueBibleAppVersion.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
35.28
35.29
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 35.29:
* Add concordance to api server

Changes in 35.28:
* Add "Install ALL" to module downloads

Expand Down
8 changes: 4 additions & 4 deletions patches.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1356,7 +1356,6 @@
(35.19, "file", "startup/nonGui.py")
(35.19, "file", "util/ConfigUtil.py")
(35.20, "file", "util/TextUtil.py")
(35.21, "file", "util/RemoteApiHandler.py")
(35.22, "file", "util/RemoteCliHandler.py")
(35.23, "file", "util/checkup.py")
(35.24, "file", "gui/MaterialMainWindow.py")
Expand Down Expand Up @@ -1394,6 +1393,7 @@
(35.28, "file", ".gitignore")
(35.28, "file", "gui/MainWindow.py")
(35.28, "file", "util/DatafileLocation.py")
(35.28, "file", "patches.txt")
(35.28, "file", "latest_changes.txt")
(35.28, "file", "UniqueBibleAppVersion.txt")
(35.29, "file", "util/RemoteApiHandler.py")
(35.29, "file", "latest_changes.txt")
(35.29, "file", "UniqueBibleAppVersion.txt")
(35.29, "file", "patches.txt")
27 changes: 27 additions & 0 deletions util/RemoteApiHandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,8 @@ def processRequest(self, request):
self.processCrossReferenceCommand(cmd)
elif command == "search":
self.processSearchCommand(cmd, query)
elif command == "concordance":
self.processConcordanceCommand(cmd, query)
elif command == "morphology":
self.processMorphologyCommand(cmd)
elif command == "searchtool":
Expand Down Expand Up @@ -372,6 +374,31 @@ def processSearchCommand(self, cmd, query):
except Exception as ex:
self.sendError("Invalid search command - " + ex)

# /concordance/KJVx/G1654
def processConcordanceCommand(self, cmd, query):
try:
text = cmd[1]
strongs = cmd[2]
query = "SELECT Book, Chapter, Verse, Scripture FROM Verses "
query += "WHERE "
query += "(Scripture LIKE ?) "
query += "ORDER BY Book, Chapter, Verse "
query += "LIMIT 5000 "
t = ("%{0} %".format(strongs),)
verses = Bible(text).getSearchVerses(query, t)

processed = []
for data in verses:
verse = data[3].replace(strongs + " ", "XXXXX")
verse = re.sub(r"[HG][0-9]+? ", "", verse)
verse = re.sub(r" ([,.;:])", "\\1", verse)
verse = verse.replace("XXXXX", strongs + " ")
processed.append((data[0], data[1], data[2], verse))

self.jsonData['data'] = processed
except Exception as ex:
self.sendError("Invalid search command - " + ex)

# /morphology/1/34684
def processMorphologyCommand(self, cmd):
if len(cmd) < 3:
Expand Down

0 comments on commit 622f91e

Please sign in to comment.