18
18
from uniquebible .util .GitHubRepoInfo import GitHubRepoInfo
19
19
from uniquebible .util .TextCommandParser import TextCommandParser
20
20
from uniquebible .util .RemoteCliMainWindow import RemoteCliMainWindow
21
+ from uniquebible .util .LocalCliHandler import LocalCliHandler
21
22
from uniquebible .util .TextUtil import TextUtil
22
23
from urllib .parse import urlparse , parse_qs
23
24
from uniquebible .util .FileUtil import FileUtil
@@ -153,7 +154,7 @@ def refineCommand(self, command, mainVerse):
153
154
if command in self .textCommandParser .parent .textList :
154
155
command = f"TEXT:::{ command } "
155
156
# match a bible reference, started with book number, e.g. 43.3.16
156
- elif re .search ("^[0-9]+?\.[0-9]+?\.[0-9]+?$" , command ):
157
+ elif re .search (r "^[0-9]+?\.[0-9]+?\.[0-9]+?$" , command ):
157
158
b , c , v = [int (i ) for i in command .split ("." )]
158
159
command = self .textCommandParser .bcvToVerseReference (b , c , v )
159
160
else :
@@ -351,9 +352,20 @@ def do_GET(self):
351
352
if cmd :
352
353
self .command = query_components ["cmd" ][0 ].strip ()
353
354
self .command = self .command .replace ("+" , " " )
355
+ if self .command == ".suggestions" :
356
+ self .commonHeader ()
357
+ textCommandSuggestion = [key + ":::" for key in self .textCommandParser .interpreters .keys ()]
358
+ terminalUseLighterCompleter = config .terminalUseLighterCompleter
359
+ config .terminalUseLighterCompleter = True
360
+ content = LocalCliHandler (allowPrivateData = allowPrivateData ).getCommandCompleterSuggestions (textCommandSuggestion = textCommandSuggestion )
361
+ config .terminalUseLighterCompleter = terminalUseLighterCompleter
362
+ self .wfile .write (bytes (json .dumps (content ), "utf8" ))
363
+ return
354
364
else :
355
365
self .command = "John 3:16-16"
356
366
# tweak configs
367
+ displayChapterMenuTogetherWithBibleChapter = config .displayChapterMenuTogetherWithBibleChapter
368
+ config .displayChapterMenuTogetherWithBibleChapter = False
357
369
addFavouriteToMultiRef = config .addFavouriteToMultiRef
358
370
config .addFavouriteToMultiRef = False
359
371
# output
@@ -375,6 +387,7 @@ def do_GET(self):
375
387
self .wfile .write (bytes (content , "utf8" ))
376
388
# restore user config
377
389
config .addFavouriteToMultiRef = addFavouriteToMultiRef
390
+ config .displayChapterMenuTogetherWithBibleChapter = displayChapterMenuTogetherWithBibleChapter
378
391
elif self .ignoreCommand (self .path ):
379
392
print (f"Ignoring command: { self .path } " )
380
393
self .blankPage ()
@@ -1628,7 +1641,7 @@ def helpContent(self):
1628
1641
<p>"""
1629
1642
content = "\n " .join (
1630
1643
[re .sub (" #" , "#" , value [- 1 ]) for value in self .textCommandParser .interpreters .values ()])
1631
- content = re .sub ("(\[KEYWORD\] )(.*?)$" , r"""\1<ref onclick="displayCommand('\2:::')">\2</ref>""" , content , flags = re .M )
1644
+ content = re .sub (r "(\[KEYWORD\] )(.*?)$" , r"""\1<ref onclick="displayCommand('\2:::')">\2</ref>""" , content , flags = re .M )
1632
1645
content = dotCommands + re .sub (r"\n" , "<br/>" , content ) + "</p>"
1633
1646
return content
1634
1647
@@ -1684,14 +1697,14 @@ def getQrCodeCommand(self):
1684
1697
def getPlaylistFromHTML (self , html ):
1685
1698
playlist = []
1686
1699
#searchPattern = """[Rr][Ee][Aa][Dd][Cc][Hh][Aa][Pp][Tt][Ee][Rr]:::([A-Za-z0-9]+?)\.([0-9]+?)\.([0-9]+?)[\."']"""
1687
- searchPattern = """_[Cc][Hh][Aa][Pp][Tt][Ee][Rr][Ss]:::([^\.>]+?)_([0-9]+?)\.([0-9]+?)["'].*onclick=["']rC\("""
1700
+ searchPattern = r """_[Cc][Hh][Aa][Pp][Tt][Ee][Rr][Ss]:::([^\.>]+?)_([0-9]+?)\.([0-9]+?)["'].*onclick=["']rC\("""
1688
1701
found = re .search (searchPattern , html )
1689
1702
if found :
1690
1703
text , b , c = found [1 ], found [2 ], found [3 ]
1691
1704
text = FileUtil .getMP3TextFile (text )
1692
1705
playlist = RemoteCliMainWindow ().playAudioBibleChapterVerseByVerse (text , b , c )
1693
1706
else :
1694
- searchPattern = """[Rr][Ee][Aa][Dd][Vv][Ee][Rr][Ss][Ee]:::([A-Za-z0-9]+?)\.([0-9]+?)\.([0-9]+?)\.([0-9]+?)["']"""
1707
+ searchPattern = r """[Rr][Ee][Aa][Dd][Vv][Ee][Rr][Ss][Ee]:::([A-Za-z0-9]+?)\.([0-9]+?)\.([0-9]+?)\.([0-9]+?)["']"""
1695
1708
found = re .findall (searchPattern , html )
1696
1709
if found :
1697
1710
for entry in found :
@@ -1702,7 +1715,7 @@ def getPlaylistFromHTML(self, html):
1702
1715
if os .path .isfile (audioFilePath ):
1703
1716
playlist .append ((audioFile , audioFilePath ))
1704
1717
else :
1705
- searchPattern = """[Rr][Ee][Aa][Dd]([Ww][Oo][Rr][Dd]|[Ll][Ee][Xx][Ee][Mm][Ee]):::([A-Za-z0-9]+?)\.([0-9]+?)\.([0-9]+?)\.([0-9]+?)\.([0-9]+?)["']"""
1718
+ searchPattern = r """[Rr][Ee][Aa][Dd]([Ww][Oo][Rr][Dd]|[Ll][Ee][Xx][Ee][Mm][Ee]):::([A-Za-z0-9]+?)\.([0-9]+?)\.([0-9]+?)\.([0-9]+?)\.([0-9]+?)["']"""
1706
1719
found = re .findall (searchPattern , html )
1707
1720
if found :
1708
1721
for entry in found :
0 commit comments