Updated meta generation.
This commit is contained in:
parent
8ee9f53a9e
commit
33169bcfba
1 changed files with 112 additions and 4 deletions
|
|
@ -3,7 +3,109 @@
|
|||
import json
|
||||
import requests
|
||||
|
||||
aliases = {'gn': 'gen', 'ex': 'exo', 'lv': 'lev', 'nm': 'num', 'numb': 'num', 'nmb': 'num', 'nmbs': 'num', 'dt': 'deu', 'deut': 'deu', 'deuter': 'deu', 'js': 'jos', 'josh': 'jos', 'jd': 'jdg', 'jdgs': 'jdg', 'rt': 'rut', '1s': '1sa', '1sam': '1sa', '1 s': '1sa', '1 sa': '1sa', '1 sam': '1sa', '2s': '2sa', '2sam': '2sa', '2 s': '2sa', '2 sa': '2sa', '2 sam': '2sa', '1k': '1ki', '1kgs': '1ki', '1king': '1ki', '1 k': '1ki', '1 ki': '1ki', '1 kgs': '1ki', '1 king': '1ki', '2k': '2ki', '2kgs': '2ki', '2king': '2ki', '2 k': '2ki', '2 ki': '2ki', '2 kgs': '2ki', '2 king': '2ki', '1c': '1ch', '1chr': '1ch', '1chron': '1ch', '1 c': '1ch', '1 ch': '1ch', '1 chr': '1ch', '1 chron': '1ch', '2c': '2ch', '2chr': '2ch', '2chron': '2ch', '2 c': '2ch', '2 ch': '2ch', '2 chr': '2ch', '2 chron': '2ch', 'ez': 'ezr', 'nh': 'neh', 'es': 'est', 'jo': 'jon', 'ps': 'psa', 'psalm': 'psa', 'pss': 'psa', 'pr': 'pro', 'prov': 'pro', 'ec': 'ecc', 'eccl': 'ecc', 'eccle': 'ecc', 'sn': 'sng', 'son': 'sng', 'song': 'sng', 'sol': 'sng', 'is': 'isa', 'isai': 'isa', 'jr': 'jer', 'jere': 'jer', 'jerem': 'jer', 'lm': 'lam', 'lamen': 'lam', 'eze': 'ezk', 'ezek': 'ezk', 'dn': 'dan', 'hs': 'hos', 'jl': 'jol', 'am': 'amo', 'ob': 'oba', 'obd': 'oba', 'obad': 'oba', 'mc': 'mic', 'na': 'nam', 'hb': 'hab', 'haba': 'hab', 'habak': 'hab', 'ze': 'zec', 'zf': 'zep', 'zef': 'zep', 'hg': 'hag', 'zech': 'zec', 'ml': 'mal', 'mala': 'mal', 'mt': 'mat', 'matt': 'mat', 'mk': 'mrk', 'lk': 'luk', 'jn': 'jhn', 'ac': 'act', 'rm': 'rom', 'rms': 'rom', '1cor': '1co', '1corin': '1co', '1 co': '1co', '1 cor': '1co', '1 corin': '1co', '2cor': '2co', '2corin': '2co', '2 co': '2co', '2 cor': '2co', '2 corin': '2co', 'gl': 'gal', 'ep': 'eph', 'ef': 'eph', 'ph': 'php', 'phil': 'php', 'cl': 'col', 'colo': 'col', '1thes': '1th', '1thess': '1th', '1 thes': '1th', '1 thess': '1th', '2thes': '2th', '2thess': '2th', '2 thes': '2th', '2 thess': '2th', '1tim': '1ti', '1 ti': '1ti', '1 tim': '1ti', '2tim': '2ti', '2 ti': '2ti', '2 tim': '2ti', 'ti': 'tit', 'pi': 'phm', 'philm': 'phm', 'philem': 'phm', 'he': 'heb', 'ja': 'jas', 'jam': 'jas', '1p': '1pe', '1pt': '1pe', '1pet': '1pe', '1 p': '1pe', '1 pe': '1pe', '1 pt': '1pe', '1 pet': '1pe', '2p': '2pe', '2pt': '2pe', '2pet': '2pe', '2 p': '2pe', '2 pe': '2pe', '2 pt': '2pe', '2 pet': '2pe', '1jon': '1jn', '1 jn': '1jn', '1 jon': '1jn', '2jon': '2jn', '2 jn': '2jn', '2 jon': '2jn', '3jon': '3jn', '3 jn': '3jn', '3 jon': '3jn', 'ju': 'jud', 'rv': 'rev', 'reve': 'rev'}
|
||||
alias_map = {
|
||||
'gen': ['genesis', 'gn'],
|
||||
'exo': ['exodus', 'ex'],
|
||||
'lev': ['leviticus', 'lv'],
|
||||
'num': ['numbers', 'nm', 'numb', 'nmb', 'nmbs'],
|
||||
'deu': ['deuteronomy', 'dt', 'deut', 'deuter'],
|
||||
'jos': ['joshua', 'js', 'josh'],
|
||||
'jdg': ['judges', 'jd', 'jdgs'],
|
||||
'rut': ['ruth', 'rt'],
|
||||
'1sa': ['1 samuel', '1s', '1sam', '1 s', '1 sa', '1 sam',
|
||||
# Apocrypha
|
||||
'1 kingdoms', '1 realms',
|
||||
],
|
||||
'2sa': ['2 samuel', '2s', '2sam', '2 s', '2 sa', '2 sam'
|
||||
# Apocrypha
|
||||
'2 kingdoms', '2 realms',
|
||||
],
|
||||
'1ki': ['1 kings', '1k', '1kgs', '1king', '1 k', '1 ki', '1 kgs', '1 king'
|
||||
# Apocrypha
|
||||
'3k', '3kgs', '3king', '3 k', '3 ki', '3 kgs', '3 king',
|
||||
'3 kingdoms', '3 realms',
|
||||
],
|
||||
'2ki': ['2 kings', '2k', '2kgs', '2king', '2 k', '2 ki', '2 kgs', '2 king'
|
||||
# Apocrypha
|
||||
'4k', '4kgs', '4king', '4 k', '4 ki', '4 kgs', '4 king',
|
||||
'4 kingdoms', '4 realms',
|
||||
],
|
||||
'1ch': ['1 chronicles', '1c', '1chr', '1chron', '1 c', '1 ch', '1 chr', '1 chron'],
|
||||
'2ch': ['2 chronicles', '2c', '2chr', '2chron', '2 c', '2 ch', '2 chr', '2 chron'],
|
||||
'ezr': ['ezra', 'ez'],
|
||||
'neh': ['nehemiah', 'nh'],
|
||||
'est': ['esther', 'es'],
|
||||
'job': ['job', 'jb'],
|
||||
'psa': ['psalms', 'ps', 'psalm', 'pss'],
|
||||
'pro': ['proverbs', 'pr', 'prov'],
|
||||
'ecc': ['ecclesiastes', 'ec', 'eccl', 'eccle'],
|
||||
'sng': ['song of solomon', 'song of songs', 'sn', 'son', 'song', 'sol'],
|
||||
'isa': ['isaiah', 'is', 'isai'],
|
||||
'jer': ['jeremiah', 'jr', 'jere', 'jerem'],
|
||||
'lam': ['lamentations', 'lm', 'lamen'],
|
||||
'ezk': ['ezekiel', 'eze', 'ezek'],
|
||||
'dan': ['daniel', 'dn'],
|
||||
'hos': ['hosea', 'hs'],
|
||||
'jol': ['joel', 'jl'],
|
||||
'amo': ['amos', 'am'],
|
||||
'oba': ['obadiah', 'ob', 'obd', 'obad'],
|
||||
'jon': ['jonah', 'jo'],
|
||||
'mic': ['micah', 'micha', 'mc'],
|
||||
'nam': ['nahum', 'na'],
|
||||
'hab': ['habakkuk', 'hb', 'haba', 'habak'],
|
||||
'zep': ['zephaniah', 'zf', 'zef'],
|
||||
'hag': ['haggai', 'hg'],
|
||||
'zec': ['zechariah', 'ze', 'zech'],
|
||||
'mal': ['malachi', 'ml', 'mala'],
|
||||
'mat': ['matthew', 'mt', 'matt'],
|
||||
'mrk': ['mark', 'mk'],
|
||||
'luk': ['luke', 'lk'],
|
||||
'jhn': ['john', 'jn'],
|
||||
'act': ['acts', 'ac'],
|
||||
'rom': ['romans', 'rm', 'rms'],
|
||||
'1co': ['1 corinthians', '1cor', '1corin', '1 co', '1 cor', '1 corin'],
|
||||
'2co': ['2 corinthians', '2cor', '2corin', '2 co', '2 cor', '2 corin'],
|
||||
'gal': ['galatians', 'gl'],
|
||||
'eph': ['ephesians', 'ep', 'ef'],
|
||||
'php': ['philippians', 'ph', 'phil'],
|
||||
'col': ['colossians', 'cl', 'colo'],
|
||||
'1th': ['1 thessalonians', '1thes', '1thess', '1 thes', '1 thess'],
|
||||
'2th': ['2 thessalonians', '2thes', '2thess', '2 thes', '2 thess'],
|
||||
'1ti': ['1 timothy', '1tim', '1 ti', '1 tim'],
|
||||
'2ti': ['2 timothy', '2tim', '2 ti', '2 tim'],
|
||||
'tit': ['titus', 'ti'],
|
||||
'phm': ['philemon', 'pi', 'philm', 'philem'],
|
||||
'heb': ['hebrews', 'he'],
|
||||
'jas': ['james', 'ja', 'jam'],
|
||||
'1pe': ['1 peter', '1p', '1pt', '1pet', '1 p', '1 pe', '1 pt', '1 pet'],
|
||||
'2pe': ['2 peter', '2p', '2pt', '2pet', '2 p', '2 pe', '2 pt', '2 pet'],
|
||||
'1jn': ['1 john', '1jon', '1 jn', '1 jon'],
|
||||
'2jn': ['2 john', '2jon', '2 jn', '2 jon'],
|
||||
'3jn': ['3 john', '3jon', '3 jn', '3 jon'],
|
||||
'jud': ['jude', 'ju'],
|
||||
'rev': ['revelation', 'rv', 'reve'],
|
||||
# Apocrypha.
|
||||
'tob': ['tobit', 'tb'],
|
||||
'jdt': ['judith', 'jt'],
|
||||
'wis': ['wisdom', 'wisdom of solomon', 'ws'],
|
||||
'sir': ['sirach', 'sr'],
|
||||
'bar': ['baruch', 'br'],
|
||||
'bel': ['bel and the dragon', 'bl', 'bd'],
|
||||
'sus': ['susanna', 'su'],
|
||||
'1ma': ['1 maccabees', '1mac', '1 mac'],
|
||||
'2ma': ['2 maccabees', '2mac', '2 mac'],
|
||||
'3ma': ['3 maccabees', '3mac', '3 mac'],
|
||||
'4ma': ['4 maccabees', '4mac', '4 mac'],
|
||||
'1es': ['1 esdras', '1esd', '1 esd'],
|
||||
# Not present in all LXX.
|
||||
'lje': ['epistle of jeremy', 'ej'],
|
||||
's3y': ['prayer of azarias', 'az'],
|
||||
'man': ['prayer of manasses', 'prayer of manasseh', 'mana'],
|
||||
|
||||
}
|
||||
aliases = {i: k for k, v in alias_map.items() for i in v}
|
||||
for k in alias_map.keys():
|
||||
aliases[k] = k
|
||||
|
||||
use_translations = [
|
||||
"AAB", # Accessible Ancients Bible AAB
|
||||
|
|
@ -53,11 +155,17 @@ def filter_translations(t=None):
|
|||
for translation in t:
|
||||
if "id" in translation and translation["id"] in use_translations:
|
||||
tx.append(translation)
|
||||
return tx
|
||||
return {x["id"]: x for x in tx}
|
||||
|
||||
def get_translation_meta(t):
|
||||
req = requests.get(f"https://helloao.org${t["listOfBooksApiLink"]}")
|
||||
t["books"] = req.json()
|
||||
req = requests.get(f"https://bible.helloao.org{t["listOfBooksApiLink"]}")
|
||||
return req.json()
|
||||
|
||||
def write_meta(file="meta.js"):
|
||||
with open(file, 'wb') as fp:
|
||||
fp.write(b"// Translation meta\n\n")
|
||||
fp.write(f"export const aliases = {json.dumps(aliases)};\n\n".encode("utf8"))
|
||||
fp.write(f"export const translations = {json.dumps(use_translations)};\n".encode("utf8"))
|
||||
|
||||
if __name__ == "__main__":
|
||||
pass
|
||||
|
|
|
|||
Loading…
Reference in a new issue