scripts for my gemini capsule
Diffstat (limited to 'webp.py')
-rwxr-xr-xwebp.py15
1 files changed, 10 insertions, 5 deletions
diff --git a/webp.py b/webp.py
index 20e406f..8046c9f 100755
--- a/webp.py
+++ b/webp.py
@@ -19,18 +19,23 @@ 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:
print("51 " + str(passages[0][0]) + "'\r\n")
return
print("20 text/gemini\r\n")
- print('=>https://ebible.org/find/details.php?id=engwebp&all=1 This content from World English Bible (public domain)')
- print('=> gemini://gemini.zachdecook.com/usfm2gmi/ and rendered with usfm2gmi')
+ printwebp(passages)
+
+def printwebp(passages, title=True, plug=True):
+ books=subprocess.check_output([f"find", "webp/", "-name", f'??-*.usfm']).strip().split(b"\n")
+ books.sort()
+ if plug:
+ print('=>https://ebible.org/find/details.php?id=engwebp&all=1 This content from World English Bible (public domain)')
+ print('=> gemini://gemini.zachdecook.com/usfm2gmi/ and rendered with usfm2gmi')
for passage in passages:
- print("# " + passage.format())
+ if title:
+ print("# " + passage.format())
printing = 0
inendc = False
bookn = passage.start.book