scripts for my gemini capsule
bibles: fix the web
Zach DeCook 2021-10-30
parent 5efd583 · commit b375292
-rwxr-xr-xindex.gmi1
-rwxr-xr-xwebp.py10
2 files changed, 6 insertions, 5 deletions
diff --git a/index.gmi b/index.gmi
index 4469b01..b775432 100755
--- a/index.gmi
+++ b/index.gmi
@@ -6,6 +6,7 @@ printf '20 text/gemini \r\n
## Experimental bible reading scripts
=> /cgi-bin/net.sh Wrapper for New English Translation API.
=> /cgi-bin/oeb.py Open English Bible (WIP) rough-ish script for reading.
+=> /cgi-bin/webp.py World English Bible reading script
## misc
=> /cgi-bin/oebindex.sh Index for Open English Bible current completed books
diff --git a/webp.py b/webp.py
index c79ba4a..7532b13 100755
--- a/webp.py
+++ b/webp.py
@@ -19,7 +19,8 @@ def main(qs):
if not qs:
print("10 Enter a scripture reference\r\n")
return
-
+ books=subprocess.check_output([f"find", "webp/", "-name", f'??-*.usfm']).strip().split(b"\n")
+ books.sort()
passages = parse_string(qs)
# TODO: Also handle "john 3, tomato 2" errors?
if type(passages[0]) == tuple:
@@ -32,10 +33,9 @@ def main(qs):
print("# " + passage.format())
printing = 0
inendc = False
- bookabbrev = passage.start.format('a').upper()
- eprint(bookabbrev)
- fname = subprocess.check_output([f"find", "webp/", "-name", f'*-{bookabbrev}*']).strip()
- f = open(fname)
+ bookn = passage.start.book
+ eprint(bookn)
+ f = open(books[bookn])
startc = passage.start.chapter
startv= passage.start.verse
endc = passage.end.chapter