Skip to content

Instantly share code, notes, and snippets.

@richmahn
Last active September 16, 2020 13:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save richmahn/9bdfd83edc48d06b5b4f5bddda33b442 to your computer and use it in GitHub Desktop.
Save richmahn/9bdfd83edc48d06b5b4f5bddda33b442 to your computer and use it in GitHub Desktop.
declare -A ORDERED_BOOK_LIST
ORDERED_BOOKS_LIST=(
'gen'
'exo'
'lev'
'num'
'deu'
'jos'
'jdg'
'rut'
'1sa'
'2sa'
'1ki'
'2ki'
'1ch'
'2ch'
'ezr'
'neh'
'est'
'job'
'psa'
'pro'
'ecc'
'sng'
'isa'
'jer'
'lam'
'ezk'
'dan'
'hos'
'jol'
'amo'
'oba'
'jon'
'mic'
'nam'
'hab'
'zep'
'hag'
'zec'
'mal'
'mat'
'mrk'
'luk'
'jhn'
'act'
'rom'
'1co'
'2co'
'gal'
'eph'
'php'
'col'
'1th'
'2th'
'1ti'
'2ti'
'tit'
'phm'
'heb'
'jas'
'1pe'
'2pe'
'1jn'
'2jn'
'3jn'
'jud'
'rev'
)
#!/usr/bin/env bash
set -e
set -x
source bible_books.sh
token="<YOUR TOKEN>"
for i in "${!ORDERED_BOOKS_LIST[@]}";
do
if [ $i -gt 38 ]; then
book="${ORDERED_BOOKS_LIST[$i]}"
repo="vi_ult_${book}_book"
rm -rf $repo
git clone git@git.door43.org:VGM/vi_${book}_text_reg.git $repo
curl -X DELETE "https://git.door43.org/api/v1/repos/vi_gl/$repo?access_token=$token" -H "accept: application/json"
curl -X POST "https://git.door43.org/api/v1/orgs/vi_gl/repos?access_token=$token" -H "accept: application/json" -H "Content-Type: application/json" -d "{ \"auto_init\": false, \"default_branch\": \"master\", \"description\": \"$repo\", \"name\": \"$repo\", \"private\": false}"
cd $repo
title=`cat front/title.txt`
file="$repo.usfm"
echo "\\id ${book^^} unfoldingWord Literal Text
\\ide UTF-8
\\h ${title}
\\toc1 ${title}
\\toc2 ${title}
\\toc3 ${book}
\\mt ${title}
" > $file
for dir in [0-9]*/; do
dir=${dir%/}
ch=${dir#0}
echo "$dir"
echo -e "\n\n\\\c ${ch}" >> $file
for f in $dir/*.txt; do
echo -e "\n\\s5\n" >> $file
cat $f >> $file
done
done
rm -rf .git
rm -rf front [0-9]*/
cp ../manifest.json .
sed -i '' "s/bookid/$book/g" manifest.json
sed -i '' "s/Bookname/$title/g" manifest.json
git init
git add .
git commit -m "Initial commit"
git remote add origin git@git.door43.org:vi_gl/$repo.git
git push --set-upstream origin master
cd ..
exit
fi
done
{
"project": {
"id": "bookid",
"name": "Bookname"
},
"resource": {
"id": "ULT",
"name": "ULT - Bookname"
},
"target_language": {
"id": "vi",
"name": "English",
"direction": "ltr",
"book": {
"name": "Bookname"
}
},
"ts_project": {
"id": "bookid",
"name": "Bookname"
},
"type": {
"id": "text",
"name": "Text"
},
"source_translations": [
{
"language_id": "en",
"resource_id": "ult",
"checking_level": "",
"date_modified": "2020-07-23T18:37:37.983Z",
"version": ""
}
],
"translators": [],
"checkers": [],
"time_created": "2020-09-16:37:37.983Z",
"tools": [],
"repo": "",
"license": "CC BY-SA 4.0",
"tsv_relation": [
"en/ult",
"el-x-koine/ugnt?v=0.13",
"hbo/uhb?v=2.1.14"
],
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment