mirror of
https://github.com/getbible/v2_builder.git
synced 2024-12-03 15:08:20 +00:00
Merged getBible changes into SWORD-to-JSON
This commit is contained in:
parent
32facc77e9
commit
5051c6d336
10
.gitignore
vendored
Normal file
10
.gitignore
vendored
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
old
|
||||||
|
sword_zip
|
||||||
|
test
|
||||||
|
v2t
|
||||||
|
v2t_scripture
|
||||||
|
v2
|
||||||
|
v2_scripture
|
||||||
|
venv
|
||||||
|
.idea
|
||||||
|
builder.log
|
692
LICENSE
692
LICENSE
@ -1,25 +1,677 @@
|
|||||||
BSD 2-Clause License
|
GNU GENERAL PUBLIC LICENSE
|
||||||
|
Version 3, 29 June 2007
|
||||||
|
|
||||||
Copyright (c) 2017, Jake Wasdin
|
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||||
All rights reserved.
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without
|
Preamble
|
||||||
modification, are permitted provided that the following conditions are met:
|
|
||||||
|
The GNU General Public License is a free, copyleft license for
|
||||||
|
software and other kinds of works.
|
||||||
|
|
||||||
|
The licenses for most software and other practical works are designed
|
||||||
|
to take away your freedom to share and change the works. By contrast,
|
||||||
|
the GNU General Public License is intended to guarantee your freedom to
|
||||||
|
share and change all versions of a program--to make sure it remains free
|
||||||
|
software for all its users. We, the Free Software Foundation, use the
|
||||||
|
GNU General Public License for most of our software; it applies also to
|
||||||
|
any other work released this way by its authors. You can apply it to
|
||||||
|
your programs, too.
|
||||||
|
|
||||||
|
When we speak of free software, we are referring to freedom, not
|
||||||
|
price. Our General Public Licenses are designed to make sure that you
|
||||||
|
have the freedom to distribute copies of free software (and charge for
|
||||||
|
them if you wish), that you receive source code or can get it if you
|
||||||
|
want it, that you can change the software or use pieces of it in new
|
||||||
|
free programs, and that you know you can do these things.
|
||||||
|
|
||||||
|
To protect your rights, we need to prevent others from denying you
|
||||||
|
these rights or asking you to surrender the rights. Therefore, you have
|
||||||
|
certain responsibilities if you distribute copies of the software, or if
|
||||||
|
you modify it: responsibilities to respect the freedom of others.
|
||||||
|
|
||||||
|
For example, if you distribute copies of such a program, whether
|
||||||
|
gratis or for a fee, you must pass on to the recipients the same
|
||||||
|
freedoms that you received. You must make sure that they, too, receive
|
||||||
|
or can get the source code. And you must show them these terms so they
|
||||||
|
know their rights.
|
||||||
|
|
||||||
|
Developers that use the GNU GPL protect your rights with two steps:
|
||||||
|
(1) assert copyright on the software, and (2) offer you this License
|
||||||
|
giving you legal permission to copy, distribute and/or modify it.
|
||||||
|
|
||||||
|
For the developers' and authors' protection, the GPL clearly explains
|
||||||
|
that there is no warranty for this free software. For both users' and
|
||||||
|
authors' sake, the GPL requires that modified versions be marked as
|
||||||
|
changed, so that their problems will not be attributed erroneously to
|
||||||
|
authors of previous versions.
|
||||||
|
|
||||||
|
Some devices are designed to deny users access to install or run
|
||||||
|
modified versions of the software inside them, although the manufacturer
|
||||||
|
can do so. This is fundamentally incompatible with the aim of
|
||||||
|
protecting users' freedom to change the software. The systematic
|
||||||
|
pattern of such abuse occurs in the area of products for individuals to
|
||||||
|
use, which is precisely where it is most unacceptable. Therefore, we
|
||||||
|
have designed this version of the GPL to prohibit the practice for those
|
||||||
|
products. If such problems arise substantially in other domains, we
|
||||||
|
stand ready to extend this provision to those domains in future versions
|
||||||
|
of the GPL, as needed to protect the freedom of users.
|
||||||
|
|
||||||
|
Finally, every program is threatened constantly by software patents.
|
||||||
|
States should not allow patents to restrict development and use of
|
||||||
|
software on general-purpose computers, but in those that do, we wish to
|
||||||
|
avoid the special danger that patents applied to a free program could
|
||||||
|
make it effectively proprietary. To prevent this, the GPL assures that
|
||||||
|
patents cannot be used to render the program non-free.
|
||||||
|
|
||||||
|
The precise terms and conditions for copying, distribution and
|
||||||
|
modification follow.
|
||||||
|
|
||||||
|
TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
0. Definitions.
|
||||||
|
|
||||||
|
"This License" refers to version 3 of the GNU General Public License.
|
||||||
|
|
||||||
|
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||||
|
works, such as semiconductor masks.
|
||||||
|
|
||||||
|
"The Program" refers to any copyrightable work licensed under this
|
||||||
|
License. Each licensee is addressed as "you". "Licensees" and
|
||||||
|
"recipients" may be individuals or organizations.
|
||||||
|
|
||||||
|
To "modify" a work means to copy from or adapt all or part of the work
|
||||||
|
in a fashion requiring copyright permission, other than the making of an
|
||||||
|
exact copy. The resulting work is called a "modified version" of the
|
||||||
|
earlier work or a work "based on" the earlier work.
|
||||||
|
|
||||||
|
A "covered work" means either the unmodified Program or a work based
|
||||||
|
on the Program.
|
||||||
|
|
||||||
|
To "propagate" a work means to do anything with it that, without
|
||||||
|
permission, would make you directly or secondarily liable for
|
||||||
|
infringement under applicable copyright law, except executing it on a
|
||||||
|
computer or modifying a private copy. Propagation includes copying,
|
||||||
|
distribution (with or without modification), making available to the
|
||||||
|
public, and in some countries other activities as well.
|
||||||
|
|
||||||
|
To "convey" a work means any kind of propagation that enables other
|
||||||
|
parties to make or receive copies. Mere interaction with a user through
|
||||||
|
a computer network, with no transfer of a copy, is not conveying.
|
||||||
|
|
||||||
|
An interactive user interface displays "Appropriate Legal Notices"
|
||||||
|
to the extent that it includes a convenient and prominently visible
|
||||||
|
feature that (1) displays an appropriate copyright notice, and (2)
|
||||||
|
tells the user that there is no warranty for the work (except to the
|
||||||
|
extent that warranties are provided), that licensees may convey the
|
||||||
|
work under this License, and how to view a copy of this License. If
|
||||||
|
the interface presents a list of user commands or options, such as a
|
||||||
|
menu, a prominent item in the list meets this criterion.
|
||||||
|
|
||||||
|
1. Source Code.
|
||||||
|
|
||||||
|
The "source code" for a work means the preferred form of the work
|
||||||
|
for making modifications to it. "Object code" means any non-source
|
||||||
|
form of a work.
|
||||||
|
|
||||||
|
A "Standard Interface" means an interface that either is an official
|
||||||
|
standard defined by a recognized standards body, or, in the case of
|
||||||
|
interfaces specified for a particular programming language, one that
|
||||||
|
is widely used among developers working in that language.
|
||||||
|
|
||||||
|
The "System Libraries" of an executable work include anything, other
|
||||||
|
than the work as a whole, that (a) is included in the normal form of
|
||||||
|
packaging a Major Component, but which is not part of that Major
|
||||||
|
Component, and (b) serves only to enable use of the work with that
|
||||||
|
Major Component, or to implement a Standard Interface for which an
|
||||||
|
implementation is available to the public in source code form. A
|
||||||
|
"Major Component", in this context, means a major essential component
|
||||||
|
(kernel, window system, and so on) of the specific operating system
|
||||||
|
(if any) on which the executable work runs, or a compiler used to
|
||||||
|
produce the work, or an object code interpreter used to run it.
|
||||||
|
|
||||||
|
The "Corresponding Source" for a work in object code form means all
|
||||||
|
the source code needed to generate, install, and (for an executable
|
||||||
|
work) run the object code and to modify the work, including scripts to
|
||||||
|
control those activities. However, it does not include the work's
|
||||||
|
System Libraries, or general-purpose tools or generally available free
|
||||||
|
programs which are used unmodified in performing those activities but
|
||||||
|
which are not part of the work. For example, Corresponding Source
|
||||||
|
includes interface definition files associated with source files for
|
||||||
|
the work, and the source code for shared libraries and dynamically
|
||||||
|
linked subprograms that the work is specifically designed to require,
|
||||||
|
such as by intimate data communication or control flow between those
|
||||||
|
subprograms and other parts of the work.
|
||||||
|
|
||||||
|
The Corresponding Source need not include anything that users
|
||||||
|
can regenerate automatically from other parts of the Corresponding
|
||||||
|
Source.
|
||||||
|
|
||||||
|
The Corresponding Source for a work in source code form is that
|
||||||
|
same work.
|
||||||
|
|
||||||
|
2. Basic Permissions.
|
||||||
|
|
||||||
|
All rights granted under this License are granted for the term of
|
||||||
|
copyright on the Program, and are irrevocable provided the stated
|
||||||
|
conditions are met. This License explicitly affirms your unlimited
|
||||||
|
permission to run the unmodified Program. The output from running a
|
||||||
|
covered work is covered by this License only if the output, given its
|
||||||
|
content, constitutes a covered work. This License acknowledges your
|
||||||
|
rights of fair use or other equivalent, as provided by copyright law.
|
||||||
|
|
||||||
|
You may make, run and propagate covered works that you do not
|
||||||
|
convey, without conditions so long as your license otherwise remains
|
||||||
|
in force. You may convey covered works to others for the sole purpose
|
||||||
|
of having them make modifications exclusively for you, or provide you
|
||||||
|
with facilities for running those works, provided that you comply with
|
||||||
|
the terms of this License in conveying all material for which you do
|
||||||
|
not control copyright. Those thus making or running the covered works
|
||||||
|
for you must do so exclusively on your behalf, under your direction
|
||||||
|
and control, on terms that prohibit them from making any copies of
|
||||||
|
your copyrighted material outside their relationship with you.
|
||||||
|
|
||||||
|
Conveying under any other circumstances is permitted solely under
|
||||||
|
the conditions stated below. Sublicensing is not allowed; section 10
|
||||||
|
makes it unnecessary.
|
||||||
|
|
||||||
|
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||||
|
|
||||||
|
No covered work shall be deemed part of an effective technological
|
||||||
|
measure under any applicable law fulfilling obligations under article
|
||||||
|
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||||
|
similar laws prohibiting or restricting circumvention of such
|
||||||
|
measures.
|
||||||
|
|
||||||
|
When you convey a covered work, you waive any legal power to forbid
|
||||||
|
circumvention of technological measures to the extent such circumvention
|
||||||
|
is effected by exercising rights under this License with respect to
|
||||||
|
the covered work, and you disclaim any intention to limit operation or
|
||||||
|
modification of the work as a means of enforcing, against the work's
|
||||||
|
users, your or third parties' legal rights to forbid circumvention of
|
||||||
|
technological measures.
|
||||||
|
|
||||||
|
4. Conveying Verbatim Copies.
|
||||||
|
|
||||||
|
You may convey verbatim copies of the Program's source code as you
|
||||||
|
receive it, in any medium, provided that you conspicuously and
|
||||||
|
appropriately publish on each copy an appropriate copyright notice;
|
||||||
|
keep intact all notices stating that this License and any
|
||||||
|
non-permissive terms added in accord with section 7 apply to the code;
|
||||||
|
keep intact all notices of the absence of any warranty; and give all
|
||||||
|
recipients a copy of this License along with the Program.
|
||||||
|
|
||||||
|
You may charge any price or no price for each copy that you convey,
|
||||||
|
and you may offer support or warranty protection for a fee.
|
||||||
|
|
||||||
|
5. Conveying Modified Source Versions.
|
||||||
|
|
||||||
|
You may convey a work based on the Program, or the modifications to
|
||||||
|
produce it from the Program, in the form of source code under the
|
||||||
|
terms of section 4, provided that you also meet all of these conditions:
|
||||||
|
|
||||||
|
a) The work must carry prominent notices stating that you modified
|
||||||
|
it, and giving a relevant date.
|
||||||
|
|
||||||
|
b) The work must carry prominent notices stating that it is
|
||||||
|
released under this License and any conditions added under section
|
||||||
|
7. This requirement modifies the requirement in section 4 to
|
||||||
|
"keep intact all notices".
|
||||||
|
|
||||||
|
c) You must license the entire work, as a whole, under this
|
||||||
|
License to anyone who comes into possession of a copy. This
|
||||||
|
License will therefore apply, along with any applicable section 7
|
||||||
|
additional terms, to the whole of the work, and all its parts,
|
||||||
|
regardless of how they are packaged. This License gives no
|
||||||
|
permission to license the work in any other way, but it does not
|
||||||
|
invalidate such permission if you have separately received it.
|
||||||
|
|
||||||
|
d) If the work has interactive user interfaces, each must display
|
||||||
|
Appropriate Legal Notices; however, if the Program has interactive
|
||||||
|
interfaces that do not display Appropriate Legal Notices, your
|
||||||
|
work need not make them do so.
|
||||||
|
|
||||||
|
A compilation of a covered work with other separate and independent
|
||||||
|
works, which are not by their nature extensions of the covered work,
|
||||||
|
and which are not combined with it such as to form a larger program,
|
||||||
|
in or on a volume of a storage or distribution medium, is called an
|
||||||
|
"aggregate" if the compilation and its resulting copyright are not
|
||||||
|
used to limit the access or legal rights of the compilation's users
|
||||||
|
beyond what the individual works permit. Inclusion of a covered work
|
||||||
|
in an aggregate does not cause this License to apply to the other
|
||||||
|
parts of the aggregate.
|
||||||
|
|
||||||
|
6. Conveying Non-Source Forms.
|
||||||
|
|
||||||
|
You may convey a covered work in object code form under the terms
|
||||||
|
of sections 4 and 5, provided that you also convey the
|
||||||
|
machine-readable Corresponding Source under the terms of this License,
|
||||||
|
in one of these ways:
|
||||||
|
|
||||||
|
a) Convey the object code in, or embodied in, a physical product
|
||||||
|
(including a physical distribution medium), accompanied by the
|
||||||
|
Corresponding Source fixed on a durable physical medium
|
||||||
|
customarily used for software interchange.
|
||||||
|
|
||||||
|
b) Convey the object code in, or embodied in, a physical product
|
||||||
|
(including a physical distribution medium), accompanied by a
|
||||||
|
written offer, valid for at least three years and valid for as
|
||||||
|
long as you offer spare parts or customer support for that product
|
||||||
|
model, to give anyone who possesses the object code either (1) a
|
||||||
|
copy of the Corresponding Source for all the software in the
|
||||||
|
product that is covered by this License, on a durable physical
|
||||||
|
medium customarily used for software interchange, for a price no
|
||||||
|
more than your reasonable cost of physically performing this
|
||||||
|
conveying of source, or (2) access to copy the
|
||||||
|
Corresponding Source from a network server at no charge.
|
||||||
|
|
||||||
|
c) Convey individual copies of the object code with a copy of the
|
||||||
|
written offer to provide the Corresponding Source. This
|
||||||
|
alternative is allowed only occasionally and noncommercially, and
|
||||||
|
only if you received the object code with such an offer, in accord
|
||||||
|
with subsection 6b.
|
||||||
|
|
||||||
|
d) Convey the object code by offering access from a designated
|
||||||
|
place (gratis or for a charge), and offer equivalent access to the
|
||||||
|
Corresponding Source in the same way through the same place at no
|
||||||
|
further charge. You need not require recipients to copy the
|
||||||
|
Corresponding Source along with the object code. If the place to
|
||||||
|
copy the object code is a network server, the Corresponding Source
|
||||||
|
may be on a different server (operated by you or a third party)
|
||||||
|
that supports equivalent copying facilities, provided you maintain
|
||||||
|
clear directions next to the object code saying where to find the
|
||||||
|
Corresponding Source. Regardless of what server hosts the
|
||||||
|
Corresponding Source, you remain obligated to ensure that it is
|
||||||
|
available for as long as needed to satisfy these requirements.
|
||||||
|
|
||||||
|
e) Convey the object code using peer-to-peer transmission, provided
|
||||||
|
you inform other peers where the object code and Corresponding
|
||||||
|
Source of the work are being offered to the general public at no
|
||||||
|
charge under subsection 6d.
|
||||||
|
|
||||||
|
A separable portion of the object code, whose source code is excluded
|
||||||
|
from the Corresponding Source as a System Library, need not be
|
||||||
|
included in conveying the object code work.
|
||||||
|
|
||||||
|
A "User Product" is either (1) a "consumer product", which means any
|
||||||
|
tangible personal property which is normally used for personal, family,
|
||||||
|
or household purposes, or (2) anything designed or sold for incorporation
|
||||||
|
into a dwelling. In determining whether a product is a consumer product,
|
||||||
|
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||||
|
product received by a particular user, "normally used" refers to a
|
||||||
|
typical or common use of that class of product, regardless of the status
|
||||||
|
of the particular user or of the way in which the particular user
|
||||||
|
actually uses, or expects or is expected to use, the product. A product
|
||||||
|
is a consumer product regardless of whether the product has substantial
|
||||||
|
commercial, industrial or non-consumer uses, unless such uses represent
|
||||||
|
the only significant mode of use of the product.
|
||||||
|
|
||||||
|
"Installation Information" for a User Product means any methods,
|
||||||
|
procedures, authorization keys, or other information required to install
|
||||||
|
and execute modified versions of a covered work in that User Product from
|
||||||
|
a modified version of its Corresponding Source. The information must
|
||||||
|
suffice to ensure that the continued functioning of the modified object
|
||||||
|
code is in no case prevented or interfered with solely because
|
||||||
|
modification has been made.
|
||||||
|
|
||||||
|
If you convey an object code work under this section in, or with, or
|
||||||
|
specifically for use in, a User Product, and the conveying occurs as
|
||||||
|
part of a transaction in which the right of possession and use of the
|
||||||
|
User Product is transferred to the recipient in perpetuity or for a
|
||||||
|
fixed term (regardless of how the transaction is characterized), the
|
||||||
|
Corresponding Source conveyed under this section must be accompanied
|
||||||
|
by the Installation Information. But this requirement does not apply
|
||||||
|
if neither you nor any third party retains the ability to install
|
||||||
|
modified object code on the User Product (for example, the work has
|
||||||
|
been installed in ROM).
|
||||||
|
|
||||||
|
The requirement to provide Installation Information does not include a
|
||||||
|
requirement to continue to provide support service, warranty, or updates
|
||||||
|
for a work that has been modified or installed by the recipient, or for
|
||||||
|
the User Product in which it has been modified or installed. Access to a
|
||||||
|
network may be denied when the modification itself materially and
|
||||||
|
adversely affects the operation of the network or violates the rules and
|
||||||
|
protocols for communication across the network.
|
||||||
|
|
||||||
|
Corresponding Source conveyed, and Installation Information provided,
|
||||||
|
in accord with this section must be in a format that is publicly
|
||||||
|
documented (and with an implementation available to the public in
|
||||||
|
source code form), and must require no special password or key for
|
||||||
|
unpacking, reading or copying.
|
||||||
|
|
||||||
|
7. Additional Terms.
|
||||||
|
|
||||||
|
"Additional permissions" are terms that supplement the terms of this
|
||||||
|
License by making exceptions from one or more of its conditions.
|
||||||
|
Additional permissions that are applicable to the entire Program shall
|
||||||
|
be treated as though they were included in this License, to the extent
|
||||||
|
that they are valid under applicable law. If additional permissions
|
||||||
|
apply only to part of the Program, that part may be used separately
|
||||||
|
under those permissions, but the entire Program remains governed by
|
||||||
|
this License without regard to the additional permissions.
|
||||||
|
|
||||||
|
When you convey a copy of a covered work, you may at your option
|
||||||
|
remove any additional permissions from that copy, or from any part of
|
||||||
|
it. (Additional permissions may be written to require their own
|
||||||
|
removal in certain cases when you modify the work.) You may place
|
||||||
|
additional permissions on material, added by you to a covered work,
|
||||||
|
for which you have or can give appropriate copyright permission.
|
||||||
|
|
||||||
|
Notwithstanding any other provision of this License, for material you
|
||||||
|
add to a covered work, you may (if authorized by the copyright holders of
|
||||||
|
that material) supplement the terms of this License with terms:
|
||||||
|
|
||||||
|
a) Disclaiming warranty or limiting liability differently from the
|
||||||
|
terms of sections 15 and 16 of this License; or
|
||||||
|
|
||||||
|
b) Requiring preservation of specified reasonable legal notices or
|
||||||
|
author attributions in that material or in the Appropriate Legal
|
||||||
|
Notices displayed by works containing it; or
|
||||||
|
|
||||||
|
c) Prohibiting misrepresentation of the origin of that material, or
|
||||||
|
requiring that modified versions of such material be marked in
|
||||||
|
reasonable ways as different from the original version; or
|
||||||
|
|
||||||
|
d) Limiting the use for publicity purposes of names of licensors or
|
||||||
|
authors of the material; or
|
||||||
|
|
||||||
|
e) Declining to grant rights under trademark law for use of some
|
||||||
|
trade names, trademarks, or service marks; or
|
||||||
|
|
||||||
|
f) Requiring indemnification of licensors and authors of that
|
||||||
|
material by anyone who conveys the material (or modified versions of
|
||||||
|
it) with contractual assumptions of liability to the recipient, for
|
||||||
|
any liability that these contractual assumptions directly impose on
|
||||||
|
those licensors and authors.
|
||||||
|
|
||||||
|
All other non-permissive additional terms are considered "further
|
||||||
|
restrictions" within the meaning of section 10. If the Program as you
|
||||||
|
received it, or any part of it, contains a notice stating that it is
|
||||||
|
governed by this License along with a term that is a further
|
||||||
|
restriction, you may remove that term. If a license document contains
|
||||||
|
a further restriction but permits relicensing or conveying under this
|
||||||
|
License, you may add to a covered work material governed by the terms
|
||||||
|
of that license document, provided that the further restriction does
|
||||||
|
not survive such relicensing or conveying.
|
||||||
|
|
||||||
|
If you add terms to a covered work in accord with this section, you
|
||||||
|
must place, in the relevant source files, a statement of the
|
||||||
|
additional terms that apply to those files, or a notice indicating
|
||||||
|
where to find the applicable terms.
|
||||||
|
|
||||||
|
Additional terms, permissive or non-permissive, may be stated in the
|
||||||
|
form of a separately written license, or stated as exceptions;
|
||||||
|
the above requirements apply either way.
|
||||||
|
|
||||||
|
8. Termination.
|
||||||
|
|
||||||
|
You may not propagate or modify a covered work except as expressly
|
||||||
|
provided under this License. Any attempt otherwise to propagate or
|
||||||
|
modify it is void, and will automatically terminate your rights under
|
||||||
|
this License (including any patent licenses granted under the third
|
||||||
|
paragraph of section 11).
|
||||||
|
|
||||||
|
However, if you cease all violation of this License, then your
|
||||||
|
license from a particular copyright holder is reinstated (a)
|
||||||
|
provisionally, unless and until the copyright holder explicitly and
|
||||||
|
finally terminates your license, and (b) permanently, if the copyright
|
||||||
|
holder fails to notify you of the violation by some reasonable means
|
||||||
|
prior to 60 days after the cessation.
|
||||||
|
|
||||||
|
Moreover, your license from a particular copyright holder is
|
||||||
|
reinstated permanently if the copyright holder notifies you of the
|
||||||
|
violation by some reasonable means, this is the first time you have
|
||||||
|
received notice of violation of this License (for any work) from that
|
||||||
|
copyright holder, and you cure the violation prior to 30 days after
|
||||||
|
your receipt of the notice.
|
||||||
|
|
||||||
|
Termination of your rights under this section does not terminate the
|
||||||
|
licenses of parties who have received copies or rights from you under
|
||||||
|
this License. If your rights have been terminated and not permanently
|
||||||
|
reinstated, you do not qualify to receive new licenses for the same
|
||||||
|
material under section 10.
|
||||||
|
|
||||||
|
9. Acceptance Not Required for Having Copies.
|
||||||
|
|
||||||
|
You are not required to accept this License in order to receive or
|
||||||
|
run a copy of the Program. Ancillary propagation of a covered work
|
||||||
|
occurring solely as a consequence of using peer-to-peer transmission
|
||||||
|
to receive a copy likewise does not require acceptance. However,
|
||||||
|
nothing other than this License grants you permission to propagate or
|
||||||
|
modify any covered work. These actions infringe copyright if you do
|
||||||
|
not accept this License. Therefore, by modifying or propagating a
|
||||||
|
covered work, you indicate your acceptance of this License to do so.
|
||||||
|
|
||||||
|
10. Automatic Licensing of Downstream Recipients.
|
||||||
|
|
||||||
|
Each time you convey a covered work, the recipient automatically
|
||||||
|
receives a license from the original licensors, to run, modify and
|
||||||
|
propagate that work, subject to this License. You are not responsible
|
||||||
|
for enforcing compliance by third parties with this License.
|
||||||
|
|
||||||
|
An "entity transaction" is a transaction transferring control of an
|
||||||
|
organization, or substantially all assets of one, or subdividing an
|
||||||
|
organization, or merging organizations. If propagation of a covered
|
||||||
|
work results from an entity transaction, each party to that
|
||||||
|
transaction who receives a copy of the work also receives whatever
|
||||||
|
licenses to the work the party's predecessor in interest had or could
|
||||||
|
give under the previous paragraph, plus a right to possession of the
|
||||||
|
Corresponding Source of the work from the predecessor in interest, if
|
||||||
|
the predecessor has it or can get it with reasonable efforts.
|
||||||
|
|
||||||
|
You may not impose any further restrictions on the exercise of the
|
||||||
|
rights granted or affirmed under this License. For example, you may
|
||||||
|
not impose a license fee, royalty, or other charge for exercise of
|
||||||
|
rights granted under this License, and you may not initiate litigation
|
||||||
|
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||||
|
any patent claim is infringed by making, using, selling, offering for
|
||||||
|
sale, or importing the Program or any portion of it.
|
||||||
|
|
||||||
|
11. Patents.
|
||||||
|
|
||||||
|
A "contributor" is a copyright holder who authorizes use under this
|
||||||
|
License of the Program or a work on which the Program is based. The
|
||||||
|
work thus licensed is called the contributor's "contributor version".
|
||||||
|
|
||||||
|
A contributor's "essential patent claims" are all patent claims
|
||||||
|
owned or controlled by the contributor, whether already acquired or
|
||||||
|
hereafter acquired, that would be infringed by some manner, permitted
|
||||||
|
by this License, of making, using, or selling its contributor version,
|
||||||
|
but do not include claims that would be infringed only as a
|
||||||
|
consequence of further modification of the contributor version. For
|
||||||
|
purposes of this definition, "control" includes the right to grant
|
||||||
|
patent sublicenses in a manner consistent with the requirements of
|
||||||
|
this License.
|
||||||
|
|
||||||
|
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||||
|
patent license under the contributor's essential patent claims, to
|
||||||
|
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||||
|
propagate the contents of its contributor version.
|
||||||
|
|
||||||
|
In the following three paragraphs, a "patent license" is any express
|
||||||
|
agreement or commitment, however denominated, not to enforce a patent
|
||||||
|
(such as an express permission to practice a patent or covenant not to
|
||||||
|
sue for patent infringement). To "grant" such a patent license to a
|
||||||
|
party means to make such an agreement or commitment not to enforce a
|
||||||
|
patent against the party.
|
||||||
|
|
||||||
|
If you convey a covered work, knowingly relying on a patent license,
|
||||||
|
and the Corresponding Source of the work is not available for anyone
|
||||||
|
to copy, free of charge and under the terms of this License, through a
|
||||||
|
publicly available network server or other readily accessible means,
|
||||||
|
then you must either (1) cause the Corresponding Source to be so
|
||||||
|
available, or (2) arrange to deprive yourself of the benefit of the
|
||||||
|
patent license for this particular work, or (3) arrange, in a manner
|
||||||
|
consistent with the requirements of this License, to extend the patent
|
||||||
|
license to downstream recipients. "Knowingly relying" means you have
|
||||||
|
actual knowledge that, but for the patent license, your conveying the
|
||||||
|
covered work in a country, or your recipient's use of the covered work
|
||||||
|
in a country, would infringe one or more identifiable patents in that
|
||||||
|
country that you have reason to believe are valid.
|
||||||
|
|
||||||
|
If, pursuant to or in connection with a single transaction or
|
||||||
|
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||||
|
covered work, and grant a patent license to some of the parties
|
||||||
|
receiving the covered work authorizing them to use, propagate, modify
|
||||||
|
or convey a specific copy of the covered work, then the patent license
|
||||||
|
you grant is automatically extended to all recipients of the covered
|
||||||
|
work and works based on it.
|
||||||
|
|
||||||
|
A patent license is "discriminatory" if it does not include within
|
||||||
|
the scope of its coverage, prohibits the exercise of, or is
|
||||||
|
conditioned on the non-exercise of one or more of the rights that are
|
||||||
|
specifically granted under this License. You may not convey a covered
|
||||||
|
work if you are a party to an arrangement with a third party that is
|
||||||
|
in the business of distributing software, under which you make payment
|
||||||
|
to the third party based on the extent of your activity of conveying
|
||||||
|
the work, and under which the third party grants, to any of the
|
||||||
|
parties who would receive the covered work from you, a discriminatory
|
||||||
|
patent license (a) in connection with copies of the covered work
|
||||||
|
conveyed by you (or copies made from those copies), or (b) primarily
|
||||||
|
for and in connection with specific products or compilations that
|
||||||
|
contain the covered work, unless you entered into that arrangement,
|
||||||
|
or that patent license was granted, prior to 28 March 2007.
|
||||||
|
|
||||||
|
Nothing in this License shall be construed as excluding or limiting
|
||||||
|
any implied license or other defenses to infringement that may
|
||||||
|
otherwise be available to you under applicable patent law.
|
||||||
|
|
||||||
|
12. No Surrender of Others' Freedom.
|
||||||
|
|
||||||
|
If conditions are imposed on you (whether by court order, agreement or
|
||||||
|
otherwise) that contradict the conditions of this License, they do not
|
||||||
|
excuse you from the conditions of this License. If you cannot convey a
|
||||||
|
covered work so as to satisfy simultaneously your obligations under this
|
||||||
|
License and any other pertinent obligations, then as a consequence you may
|
||||||
|
not convey it at all. For example, if you agree to terms that obligate you
|
||||||
|
to collect a royalty for further conveying from those to whom you convey
|
||||||
|
the Program, the only way you could satisfy both those terms and this
|
||||||
|
License would be to refrain entirely from conveying the Program.
|
||||||
|
|
||||||
|
13. Use with the GNU Affero General Public License.
|
||||||
|
|
||||||
|
Notwithstanding any other provision of this License, you have
|
||||||
|
permission to link or combine any covered work with a work licensed
|
||||||
|
under version 3 of the GNU Affero General Public License into a single
|
||||||
|
combined work, and to convey the resulting work. The terms of this
|
||||||
|
License will continue to apply to the part which is the covered work,
|
||||||
|
but the special requirements of the GNU Affero General Public License,
|
||||||
|
section 13, concerning interaction through a network will apply to the
|
||||||
|
combination as such.
|
||||||
|
|
||||||
|
14. Revised Versions of this License.
|
||||||
|
|
||||||
|
The Free Software Foundation may publish revised and/or new versions of
|
||||||
|
the GNU General Public License from time to time. Such new versions will
|
||||||
|
be similar in spirit to the present version, but may differ in detail to
|
||||||
|
address new problems or concerns.
|
||||||
|
|
||||||
|
Each version is given a distinguishing version number. If the
|
||||||
|
Program specifies that a certain numbered version of the GNU General
|
||||||
|
Public License "or any later version" applies to it, you have the
|
||||||
|
option of following the terms and conditions either of that numbered
|
||||||
|
version or of any later version published by the Free Software
|
||||||
|
Foundation. If the Program does not specify a version number of the
|
||||||
|
GNU General Public License, you may choose any version ever published
|
||||||
|
by the Free Software Foundation.
|
||||||
|
|
||||||
|
If the Program specifies that a proxy can decide which future
|
||||||
|
versions of the GNU General Public License can be used, that proxy's
|
||||||
|
public statement of acceptance of a version permanently authorizes you
|
||||||
|
to choose that version for the Program.
|
||||||
|
|
||||||
|
Later license versions may give you additional or different
|
||||||
|
permissions. However, no additional obligations are imposed on any
|
||||||
|
author or copyright holder as a result of your choosing to follow a
|
||||||
|
later version.
|
||||||
|
|
||||||
|
15. Disclaimer of Warranty.
|
||||||
|
|
||||||
|
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||||
|
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||||
|
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||||
|
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
|
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||||
|
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||||
|
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||||
|
|
||||||
|
16. Limitation of Liability.
|
||||||
|
|
||||||
|
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||||
|
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||||
|
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||||
|
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||||
|
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||||
|
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||||
|
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||||
|
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||||
|
SUCH DAMAGES.
|
||||||
|
|
||||||
|
17. Interpretation of Sections 15 and 16.
|
||||||
|
|
||||||
|
If the disclaimer of warranty and limitation of liability provided
|
||||||
|
above cannot be given local legal effect according to their terms,
|
||||||
|
reviewing courts shall apply local law that most closely approximates
|
||||||
|
an absolute waiver of all civil liability in connection with the
|
||||||
|
Program, unless a warranty or assumption of liability accompanies a
|
||||||
|
copy of the Program in return for a fee.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
How to Apply These Terms to Your New Programs
|
||||||
|
|
||||||
|
If you develop a new program, and you want it to be of the greatest
|
||||||
|
possible use to the public, the best way to achieve this is to make it
|
||||||
|
free software which everyone can redistribute and change under these terms.
|
||||||
|
|
||||||
|
To do so, attach the following notices to the program. It is safest
|
||||||
|
to attach them to the start of each source file to most effectively
|
||||||
|
state the exclusion of warranty; and each file should have at least
|
||||||
|
the "copyright" line and a pointer to where the full notice is found.
|
||||||
|
|
||||||
|
<one line to give the program's name and a brief idea of what it does.>
|
||||||
|
Copyright (C) <year> <name of author>
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Also add information on how to contact you by electronic and paper mail.
|
||||||
|
|
||||||
|
If the program does terminal interaction, make it output a short
|
||||||
|
notice like this when it starts in an interactive mode:
|
||||||
|
|
||||||
|
<program> Copyright (C) <year> <name of author>
|
||||||
|
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||||
|
This is free software, and you are welcome to redistribute it
|
||||||
|
under certain conditions; type `show c' for details.
|
||||||
|
|
||||||
|
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||||
|
parts of the General Public License. Of course, your program's commands
|
||||||
|
might be different; for a GUI interface, you would use an "about box".
|
||||||
|
|
||||||
|
You should also get your employer (if you work as a programmer) or school,
|
||||||
|
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||||
|
For more information on this, and how to apply and follow the GNU GPL, see
|
||||||
|
<https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
The GNU General Public License does not permit incorporating your program
|
||||||
|
into proprietary programs. If your program is a subroutine library, you
|
||||||
|
may consider it more useful to permit linking proprietary applications with
|
||||||
|
the library. If this is what you want to do, use the GNU Lesser General
|
||||||
|
Public License instead of this License. But first, please read
|
||||||
|
<https://www.gnu.org/licenses/why-not-lgpl.html>.
|
||||||
|
|
||||||
* Redistributions of source code must retain the above copyright notice, this
|
|
||||||
list of conditions and the following disclaimer.
|
|
||||||
|
|
||||||
* Redistributions in binary form must reproduce the above copyright notice,
|
|
||||||
this list of conditions and the following disclaimer in the documentation
|
|
||||||
and/or other materials provided with the distribution.
|
|
||||||
|
|
||||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
||||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
||||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
||||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
||||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
||||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
||||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
||||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
|
160
README.md
160
README.md
@ -1,36 +1,144 @@
|
|||||||
## SWORD to JSON – Generate json files of many Bible versions
|
# V2 API Builder
|
||||||
|
|
||||||
The [SWORD project provides modules](http://crosswire.org/sword/modules/ModDisp.jsp?modType=Bibles) freely for many different Bibles in many different languages. Often, Bible versions are provided in ways that are not convenient for developers to access. [pysword](https://pypi.python.org/pypi/pysword/0.2.3) is a Python package that provides an easy way to read the Bible modules from SWORD as part of your Python program.
|
These scripts are used to build the version 2 of the getBible API based on the Crosswire modules.
|
||||||
|
|
||||||
This project leverages pysword to generate a json file from a SWORD module. As Bible translations are available in dozens of languages, this provides an easy way to generate a json version of many different Bible versions. An example is included in the project of the public domain KJV version in `kjv.json`.
|
## Before you continue reading the instructions, you must please agree to the following few conventions:
|
||||||
|
|
||||||
As an example, here is the first part of the Bible so that you can see how the file is formatted.
|
- Please run the script (as explained below) once a week to keep your repositories in sync with Crosswire Modules
|
||||||
|
- Please do not remove the hash methods from the project as they are used to identify change for those using your scripture JSON API and HASH repositories
|
||||||
|
- Please do not host the repository that contains all the scripture JSON on a public repository like github (unless private), since if it gets forked those downstream repository may go out of sync with any changes/fixes from the Crosswire Modules
|
||||||
|
- Should you expose the scripture JSON API to the public (like [getBile.net](https://getbible.net/v2/translations.json) has done), please let us know by posting the details in an Issue on this repository.
|
||||||
|
- Should you not be able to do (or continue doing) any of the above requests then please do not place any of the project produced JSON or HASH files in the public space or in any project.
|
||||||
|
|
||||||
|
> You can still just use https://github.com/getbible/v2 directly and do not need to run your own API.
|
||||||
|
|
||||||
|
### You may ask Why?
|
||||||
|
|
||||||
|
Well, because we at getBible would like to comply with the Crosswire conventions to remain in sync with their modules all the way downstream from our project. Those who do not honor these agreements are responsible for Scripture Text (Digital) being incorrectly distributed with errors, as the digital versions of these Bibles may contain spelling mistakes, typos, or other errors like missing verses or chapters. So as they are discovered and fixed, Crosswire releases updates to their modules, and our commitments to the above agreed conventions ensure that these updates flow downstream. Should you have any further questions please do not hesitate to open an issue on this repository. Honestly without these measures there is no getBible project... it is that serious.
|
||||||
|
|
||||||
|
**We made this code public so those who use our [API](https://github.com/getbible/v2) can see how it is build, and help improve and guide the projects code and future.**
|
||||||
|
|
||||||
|
# Okay, Lets get started...
|
||||||
|
|
||||||
|
Should you like to contribute any improvements either in code or conduct, just open an issue as the first step, and beginning of the conversation.
|
||||||
|
|
||||||
|
## Install Dependencies (only Ubuntu 20 *tested)
|
||||||
|
|
||||||
|
Install Python3.8+
|
||||||
|
```bash
|
||||||
|
$ sudo apt-get update
|
||||||
|
$ sudo apt-get install python3.8 python3-pip
|
||||||
```
|
```
|
||||||
{
|
> make sure the [python3 version is 3.8](https://askubuntu.com/a/892322/379265) or higher so that the JSON order remains the same as found on [our API](https://github.com/getbible/v2), else your hash values will not be the same.
|
||||||
"books": [
|
|
||||||
{
|
Install [pysword](https://gitlab.com/tgc-dk/pysword) (A native Python reader of the SWORD Project Bible Modules)
|
||||||
"name": "Genesis",
|
```bash
|
||||||
"chapters": [
|
$ sudo pip3 install pysword
|
||||||
{
|
|
||||||
"chapter": 1,
|
|
||||||
"verses": [
|
|
||||||
{
|
|
||||||
"chapter": 1,
|
|
||||||
"text": "In the beginning God created the heaven and the earth.",
|
|
||||||
"verse": 1,
|
|
||||||
"name": "Genesis 1:1"
|
|
||||||
},
|
|
||||||
```
|
```
|
||||||
|
|
||||||
### How to generate
|
## Setup the Builder
|
||||||
Currently, due to pysword limitations, only Bible modules are supported, not dictionaries and commentaries. Additionally, this project only supports generating a json file that contains all of the text of the Old and New Testaments of a given Bible module.
|
|
||||||
|
|
||||||
First, you will need to install pysword. This can be done using pip: `pip install pysword`
|
Clone this repository
|
||||||
|
```bash
|
||||||
|
$ git clone https://github.com/getbible/v2_builder.git
|
||||||
|
$ cd v2_builder/
|
||||||
|
```
|
||||||
|
|
||||||
Next, you can run using this format: `python sword_to_json.py --source_file KJV.zip --bible_version KJV --output_file new.json`
|
## Run the Builder
|
||||||
|
|
||||||
* _source_file_ – Location of the zipped module you are trying to read. You can pass the filename if you're in the same directory or you can also pass a relative or absolute folder path.
|
Make sure that the following files are executable.
|
||||||
* _bible_version_ – Name of the module you are trying to load, as a SWORD module can include more than one Bible version. If you get the module from the [SWORD project's index](http://crosswire.org/sword/modules/ModDisp.jsp?modType=Bibles), the **Name** column has what you can pass in here.
|
```bash
|
||||||
* _output_file_ – Location of the json file to be written to disk. As with the source file, you can pass the filename if you're in the same directory or you can also pass a relative or absolute folder path.
|
$ sudo chmod +x run.sh
|
||||||
|
$ sudo chmod +x src/hash_books.sh
|
||||||
|
$ sudo chmod +x src/hash_chapters.sh
|
||||||
|
$ sudo chmod +x src/hash_versions.sh
|
||||||
|
$ sudo chmod +x src/movePublicFiles.sh
|
||||||
|
$ sudo chmod +x src/moveToGithub.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
Start the Building process (this will take long)
|
||||||
|
```bash
|
||||||
|
$ ./run.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
### Help Menu
|
||||||
|
```txt
|
||||||
|
Usage: ./run.sh [OPTION...]
|
||||||
|
|
||||||
|
You are able to change a few default behaviours in the getBible API builder
|
||||||
|
------ Passing no command options will fallback on the defaults -------
|
||||||
|
|
||||||
|
Options
|
||||||
|
======================================================
|
||||||
|
-a|--api
|
||||||
|
set the API target folders full path
|
||||||
|
- target folders will be created using this path
|
||||||
|
|
||||||
|
example: ./run.sh -a /home/username/v2
|
||||||
|
example: ./run.sh --api /home/username/v2
|
||||||
|
|
||||||
|
two folders will be created:
|
||||||
|
- /home/username/v2
|
||||||
|
- /home/username/v2_scripture
|
||||||
|
|
||||||
|
defaults:
|
||||||
|
- repo/v2
|
||||||
|
- repo/v2_scripture
|
||||||
|
|
||||||
|
(these are the target folders)
|
||||||
|
======================================================
|
||||||
|
-p|--push
|
||||||
|
push changes to github (only if there are changes)
|
||||||
|
- setup the target folders (see target folders)
|
||||||
|
- linked them to github (your own repos)
|
||||||
|
- must be able to push (ssh authentication needed)
|
||||||
|
|
||||||
|
REMEMBER THE AGREEMENT (README.md)
|
||||||
|
|
||||||
|
example: ./run.sh -p
|
||||||
|
example: ./run.sh --push
|
||||||
|
======================================================
|
||||||
|
-z|--zip
|
||||||
|
set the ZIP target folder full path for the Crosswire Modules
|
||||||
|
|
||||||
|
example: ./run.sh -z /home/username/sword_zip
|
||||||
|
example: ./run.sh --zip /home/username/sword_zip
|
||||||
|
|
||||||
|
defaults:
|
||||||
|
- repo/sword_zip
|
||||||
|
======================================================
|
||||||
|
-d
|
||||||
|
Do not download all Crosswire Modules (helpful in testing)
|
||||||
|
|
||||||
|
example: ./run.sh -d
|
||||||
|
======================================================
|
||||||
|
-h|--help
|
||||||
|
display this help menu
|
||||||
|
|
||||||
|
example: ./run.sh -h
|
||||||
|
example: ./run.sh --help
|
||||||
|
======================================================
|
||||||
|
getBible.net
|
||||||
|
======================================================
|
||||||
|
```
|
||||||
|
|
||||||
|
### Setup Cron Job
|
||||||
|
|
||||||
|
To run this in a crontab
|
||||||
|
```bash
|
||||||
|
$ crontab -e
|
||||||
|
```
|
||||||
|
Then add the following line, update the time as needed
|
||||||
|
```bash
|
||||||
|
10 5 * * MON /home/username/v2_builder/run.sh >> /home/username/v2_builder/builder.log 2>&1
|
||||||
|
```
|
||||||
|
|
||||||
|
# Don't Forget Our Agreement!
|
||||||
|
|
||||||
|
### Free Software (with responsibility)
|
||||||
|
```txt
|
||||||
|
Llewellyn van der Merwe <github@vdm.io>
|
||||||
|
Copyright (C) 2019. All Rights Reserved
|
||||||
|
GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
|
||||||
|
```
|
||||||
|
|
||||||
Note: It can take up to a few minutes to generate the json for any given Bible version. It takes approximately one minute to run on my machine.
|
|
||||||
|
81
conf/CrosswireModulesMap.json
Normal file
81
conf/CrosswireModulesMap.json
Normal file
@ -0,0 +1,81 @@
|
|||||||
|
{
|
||||||
|
"Afr1953" : "aov",
|
||||||
|
"AraSVD" : "arabicsv",
|
||||||
|
"Peshitta" : "peshitta",
|
||||||
|
"ArmEastern" : "easternarmenian",
|
||||||
|
"ArmWestern" : "westernarmenian",
|
||||||
|
"BasHautin" : "basque",
|
||||||
|
"BretonNT" : "breton",
|
||||||
|
"Chamorro" : "chamorro",
|
||||||
|
"ChiNCVs" : "cns",
|
||||||
|
"ChiNCVt" : "cnt",
|
||||||
|
"ChiUns" : "cus",
|
||||||
|
"ChiUn" : "cut",
|
||||||
|
"CopNT" : "coptic",
|
||||||
|
"CopSahHorner" : "sahidic",
|
||||||
|
"Cro" : "croatia",
|
||||||
|
"CzeBKR" : "bkr",
|
||||||
|
"CzeCEP" : "cep",
|
||||||
|
"DaOT1931NT1907" : "danish",
|
||||||
|
"DutSVV" : "statenvertaling",
|
||||||
|
"AKJV" : "akjv",
|
||||||
|
"ASV" : "asv",
|
||||||
|
"BBE" : "basicenglish",
|
||||||
|
"DRC" : "douayrheims",
|
||||||
|
"KJV" : "kjv",
|
||||||
|
"KJVA": "kjva",
|
||||||
|
"Webster" : "wb",
|
||||||
|
"Weymouth" : "weymouth",
|
||||||
|
"WEB" : "web",
|
||||||
|
"Tyndale": "tyndale",
|
||||||
|
"YLT" : "ylt",
|
||||||
|
"Wycliffe" : "wycliffe",
|
||||||
|
"Esperanto" : "esperanto",
|
||||||
|
"Est" : "estonian",
|
||||||
|
"FinBiblia" : "finnish1776",
|
||||||
|
"FinPR" : "pyharaamattu1933",
|
||||||
|
"FinPR92" : "pyharaamattu1992",
|
||||||
|
"FreJND" : "darby",
|
||||||
|
"FreSegond1910" : "ls1910",
|
||||||
|
"FreMartin" : "martin",
|
||||||
|
"GerElb1871" : "elberfelder",
|
||||||
|
"GerElb1905" : "elberfelder1905",
|
||||||
|
"GerLut1545" : "luther1545",
|
||||||
|
"GerSch" : "schlachter",
|
||||||
|
"Wulfila" : "gothic",
|
||||||
|
"GreVamvas" : "moderngreek",
|
||||||
|
"TR" : "textusreceptus",
|
||||||
|
"Tisch" : "tischendorf",
|
||||||
|
"WHNU" : "westcotthort",
|
||||||
|
"Aleppo" : "aleppo",
|
||||||
|
"HebModern" : "modernhebrew",
|
||||||
|
"WLC" : "codex",
|
||||||
|
"HunKar" : "karoli",
|
||||||
|
"ItaDio" : "giovanni",
|
||||||
|
"ItaRive" : "riveduta",
|
||||||
|
"KorRV" : "korean",
|
||||||
|
"VulgClementine" : "vulgate",
|
||||||
|
"Latvian" : "latvian",
|
||||||
|
"LtKBB" : "lithuanian",
|
||||||
|
"ManxGaelic" : "manxgaelic",
|
||||||
|
"Maori" : "maori",
|
||||||
|
"BurJudson" : "judson",
|
||||||
|
"Norsk" : "bibelselskap",
|
||||||
|
"PorAR" : "almeida",
|
||||||
|
"PotLykins" : "potawatomi",
|
||||||
|
"RomCor" : "cornilescu",
|
||||||
|
"RusSynodal" : "synodal",
|
||||||
|
"RusVZh" : "zhuromsky",
|
||||||
|
"ScotsGaelic" : "gaelic",
|
||||||
|
"SpaRV" : "rv1858",
|
||||||
|
"SpaRV1909" : "valera",
|
||||||
|
"SpaRV1865" : "sse",
|
||||||
|
"Swahili" : "swahili",
|
||||||
|
"Swe1917" : "swedish",
|
||||||
|
"TagAngBiblia" : "tagalog",
|
||||||
|
"ThaiKJV" : "thai",
|
||||||
|
"TurNTB" : "turkish",
|
||||||
|
"UkrKulish" : "ukranian",
|
||||||
|
"Uma" : "uma",
|
||||||
|
"Viet" : "vietnamese"
|
||||||
|
}
|
23
conf/bookNames.json
Normal file
23
conf/bookNames.json
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
{
|
||||||
|
"I Samuel" : "1 Samuel",
|
||||||
|
"II Samuel" : "2 Samuel",
|
||||||
|
"I Kings" : "1 Kings",
|
||||||
|
"II Kings" : "2 Kings",
|
||||||
|
"I Chronicles" : "1 Chronicles",
|
||||||
|
"II Chronicles" : "2 Chronicles",
|
||||||
|
"I Corinthians" : "1 Corinthians",
|
||||||
|
"II Corinthians" : "2 Corinthians",
|
||||||
|
"I Thessalonians" : "1 Thessalonians",
|
||||||
|
"II Thessalonians" : "2 Thessalonians",
|
||||||
|
"I Timothy" : "1 Timothy",
|
||||||
|
"II Timothy" : "2 Timothy",
|
||||||
|
"I Peter" : "1 Peter",
|
||||||
|
"II Peter" : "2 Peter",
|
||||||
|
"I John" : "1 John",
|
||||||
|
"II John" : "2 John",
|
||||||
|
"III John" : "3 John",
|
||||||
|
"I Esdras" : "1 Esdras",
|
||||||
|
"II Esdras" : "2 Esdras",
|
||||||
|
"I Maccabees" : "1 Maccabees",
|
||||||
|
"II Maccabees" : "2 Maccabees"
|
||||||
|
}
|
86
conf/bookNumbers.json
Normal file
86
conf/bookNumbers.json
Normal file
@ -0,0 +1,86 @@
|
|||||||
|
{
|
||||||
|
"Genesis" : 1,
|
||||||
|
"Exodus" : 2,
|
||||||
|
"Leviticus" : 3,
|
||||||
|
"Numbers" : 4,
|
||||||
|
"Deuteronomy" : 5,
|
||||||
|
"Joshua" : 6,
|
||||||
|
"Judges" : 7,
|
||||||
|
"Ruth" : 8,
|
||||||
|
"I Samuel" : 9,
|
||||||
|
"II Samuel" : 10,
|
||||||
|
"I Kings" : 11,
|
||||||
|
"II Kings" : 12,
|
||||||
|
"I Chronicles" : 13,
|
||||||
|
"II Chronicles" : 14,
|
||||||
|
"Ezra" : 15,
|
||||||
|
"Nehemiah" : 16,
|
||||||
|
"Esther" : 17,
|
||||||
|
"Job" : 18,
|
||||||
|
"Psalms" : 19,
|
||||||
|
"Proverbs" : 20,
|
||||||
|
"Ecclesiastes" : 21,
|
||||||
|
"Song of Solomon" : 22,
|
||||||
|
"Isaiah" : 23,
|
||||||
|
"Jeremiah" : 24,
|
||||||
|
"Lamentations" : 25,
|
||||||
|
"Ezekiel" : 26,
|
||||||
|
"Daniel" : 27,
|
||||||
|
"Hosea" : 28,
|
||||||
|
"Joel" : 29,
|
||||||
|
"Amos" : 30,
|
||||||
|
"Obadiah" : 31,
|
||||||
|
"Jonah" : 32,
|
||||||
|
"Micah" : 33,
|
||||||
|
"Nahum" : 34,
|
||||||
|
"Habakkuk" : 35,
|
||||||
|
"Zephaniah" : 36,
|
||||||
|
"Haggai" : 37,
|
||||||
|
"Zechariah" : 38,
|
||||||
|
"Malachi" : 39,
|
||||||
|
"Matthew" : 40,
|
||||||
|
"Mark" : 41,
|
||||||
|
"Luke" : 42,
|
||||||
|
"John" : 43,
|
||||||
|
"Acts" : 44,
|
||||||
|
"Romans" : 45,
|
||||||
|
"I Corinthians" : 46,
|
||||||
|
"II Corinthians" : 47,
|
||||||
|
"Galatians" : 48,
|
||||||
|
"Ephesians" : 49,
|
||||||
|
"Philippians" : 50,
|
||||||
|
"Colossians" : 51,
|
||||||
|
"I Thessalonians" : 52,
|
||||||
|
"II Thessalonians" : 53,
|
||||||
|
"I Timothy" : 54,
|
||||||
|
"II Timothy" : 55,
|
||||||
|
"Titus" : 56,
|
||||||
|
"Philemon" : 57,
|
||||||
|
"Hebrews" : 58,
|
||||||
|
"James" : 59,
|
||||||
|
"I Peter" : 60,
|
||||||
|
"II Peter" : 61,
|
||||||
|
"I John" : 62,
|
||||||
|
"II John" : 63,
|
||||||
|
"III John" : 64,
|
||||||
|
"Jude" : 65,
|
||||||
|
"Revelation of John" : 66,
|
||||||
|
"I Esdras" : 67,
|
||||||
|
"II Esdras" : 68,
|
||||||
|
"Tobit" : 69,
|
||||||
|
"Judith" : 70,
|
||||||
|
"Additions to Esther" : 71,
|
||||||
|
"Esther (Greek)" : 71,
|
||||||
|
"Additional Psalm" : 72,
|
||||||
|
"Wisdom" : 73,
|
||||||
|
"Sirach" : 74,
|
||||||
|
"Baruch" : 75,
|
||||||
|
"Prayer of Azariah" : 76,
|
||||||
|
"Susanna" : 77,
|
||||||
|
"Bel and the Dragon" : 78,
|
||||||
|
"Prayer of Manasses" : 79,
|
||||||
|
"I Maccabees" : 80,
|
||||||
|
"II Maccabees" : 81,
|
||||||
|
"III Maccabees" : 82,
|
||||||
|
"IV Maccabees" : 83
|
||||||
|
}
|
127
conf/crosswire.txt
Normal file
127
conf/crosswire.txt
Normal file
@ -0,0 +1,127 @@
|
|||||||
|
ACV
|
||||||
|
AKJV
|
||||||
|
Aleppo
|
||||||
|
ArmEastern
|
||||||
|
ArmWestern
|
||||||
|
ASV
|
||||||
|
Azeri
|
||||||
|
Calo
|
||||||
|
Chamorro
|
||||||
|
ChiUns
|
||||||
|
CopNT
|
||||||
|
CopSahHorner
|
||||||
|
CopSahidica
|
||||||
|
CPDV
|
||||||
|
crosswire.txt
|
||||||
|
Cro
|
||||||
|
CzeB21
|
||||||
|
CzeBKR
|
||||||
|
CzeCSP
|
||||||
|
DaNT1819
|
||||||
|
DaOT1931NT1907
|
||||||
|
DRC
|
||||||
|
Elzevir
|
||||||
|
Esperanto
|
||||||
|
Est
|
||||||
|
ESV2001
|
||||||
|
ESV2011
|
||||||
|
Etheridge
|
||||||
|
FarHezareNoh
|
||||||
|
FinRK
|
||||||
|
FreCrampon
|
||||||
|
FreKhan
|
||||||
|
FreLXX
|
||||||
|
FreMartin
|
||||||
|
FreOltramare1874
|
||||||
|
FreStapfer1889
|
||||||
|
FreSynodale1921
|
||||||
|
Geneva1599
|
||||||
|
GerAlbrecht
|
||||||
|
GerElb1871
|
||||||
|
GerElb1905
|
||||||
|
GerLut1545
|
||||||
|
GerNeUe
|
||||||
|
GerReinhardt
|
||||||
|
GerSch
|
||||||
|
GreVamvas
|
||||||
|
Haitian
|
||||||
|
HebModern
|
||||||
|
HunKar
|
||||||
|
HunUj
|
||||||
|
JapDenmo
|
||||||
|
JapRaguet
|
||||||
|
JPS
|
||||||
|
Jubilee2000
|
||||||
|
KhmerNT
|
||||||
|
KJVA
|
||||||
|
KorHKJV
|
||||||
|
KorRV
|
||||||
|
Leeser
|
||||||
|
LinVB
|
||||||
|
LtKBB
|
||||||
|
LvGluck8
|
||||||
|
Mal1910
|
||||||
|
Maori
|
||||||
|
MapM
|
||||||
|
Mg1865
|
||||||
|
MonKJV
|
||||||
|
Montgomery
|
||||||
|
MorphGNT
|
||||||
|
Murdock
|
||||||
|
Ndebele
|
||||||
|
NETtext
|
||||||
|
NHEBJE
|
||||||
|
NHEB
|
||||||
|
NlCanisius1939
|
||||||
|
NorBroed
|
||||||
|
Norsk
|
||||||
|
NorSMB
|
||||||
|
NorthernAzeri
|
||||||
|
Noyes
|
||||||
|
OSHB
|
||||||
|
OxfordTR
|
||||||
|
Peshitta
|
||||||
|
PolGdanska
|
||||||
|
PorAR
|
||||||
|
PorBLivreTR
|
||||||
|
RNKJV
|
||||||
|
RomCor
|
||||||
|
RusSynodal
|
||||||
|
SahidicBible
|
||||||
|
ScotsGaelic
|
||||||
|
SloOjacano
|
||||||
|
SloStritar
|
||||||
|
SomKQA
|
||||||
|
SpaRV1865
|
||||||
|
SpaRV1909
|
||||||
|
SpaRVG
|
||||||
|
SpaRV
|
||||||
|
SpaSEV
|
||||||
|
SpaTDP
|
||||||
|
SPVar
|
||||||
|
SP
|
||||||
|
SrKDEkavski
|
||||||
|
SrKDIjekav
|
||||||
|
Swahili
|
||||||
|
Swe1917
|
||||||
|
Tausug
|
||||||
|
ThaiKJV
|
||||||
|
Tisch
|
||||||
|
TR
|
||||||
|
TurHADI
|
||||||
|
Twenty
|
||||||
|
Tyndale
|
||||||
|
UKJV
|
||||||
|
ury_WBTI_2005
|
||||||
|
VietLCCMN
|
||||||
|
VietNVB
|
||||||
|
Viet
|
||||||
|
Vulgate
|
||||||
|
VulgConte
|
||||||
|
Webster
|
||||||
|
WEB
|
||||||
|
Weymouth
|
||||||
|
WHNU
|
||||||
|
WLC
|
||||||
|
Wycliffe
|
||||||
|
YLT
|
6
conf/langCorrection.json
Normal file
6
conf/langCorrection.json
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"lzh" : "zh",
|
||||||
|
"kpl" : "kpg",
|
||||||
|
"kon" : "kg",
|
||||||
|
"mal" : "ml"
|
||||||
|
}
|
97
conf/languageNames.json
Normal file
97
conf/languageNames.json
Normal file
@ -0,0 +1,97 @@
|
|||||||
|
{
|
||||||
|
"af" : "Afrikaans",
|
||||||
|
"sq" : "Albanian",
|
||||||
|
"am" : "Amharic",
|
||||||
|
"ar" : "Arabic",
|
||||||
|
"arc" : "Aramaic",
|
||||||
|
"hy" : "Armenian",
|
||||||
|
"az" : "Azeri Northern ",
|
||||||
|
"azb" : "Azeri",
|
||||||
|
"eu" : "Basque",
|
||||||
|
"be" : "Belarusian",
|
||||||
|
"br" : "Breton",
|
||||||
|
"bg" : "Bulgarian",
|
||||||
|
"rmq" : "Calo",
|
||||||
|
"ch" : "Chamorro",
|
||||||
|
"chr" : "Cherokee",
|
||||||
|
"lzh" : "Chinese",
|
||||||
|
"cop" : "Coptic",
|
||||||
|
"hr" : "Croatian",
|
||||||
|
"cs" : "Czech",
|
||||||
|
"da" : "Danish",
|
||||||
|
"prs" : "Dari",
|
||||||
|
"nl" : "Dutch",
|
||||||
|
"en" : "English",
|
||||||
|
"fr" : "French",
|
||||||
|
"eo" : "Esperanto",
|
||||||
|
"et" : "Estonian",
|
||||||
|
"fi" : "Finnish",
|
||||||
|
"gez" : "Ge’ez",
|
||||||
|
"ka" : "Georgian",
|
||||||
|
"de" : "German",
|
||||||
|
"got" : "Gothic",
|
||||||
|
"el" : "Greek Modern",
|
||||||
|
"grc" : "Greek",
|
||||||
|
"ht" : "Haitian Creole",
|
||||||
|
"he" : "Hebrew",
|
||||||
|
"hi" : "Hindi",
|
||||||
|
"hu" : "Hungarian",
|
||||||
|
"ga" : "Irish",
|
||||||
|
"it" : "Italian",
|
||||||
|
"ja" : "Japanese",
|
||||||
|
"kab" : "Kabyle",
|
||||||
|
"kk" : "Kazakh",
|
||||||
|
"kpl" : "Kapingamarangi",
|
||||||
|
"kek" : "Kekchi",
|
||||||
|
"km" : "Khmer",
|
||||||
|
"kon" : "Kikongo",
|
||||||
|
"ko" : "Korean",
|
||||||
|
"la" : "Latin",
|
||||||
|
"lv" : "Latvian",
|
||||||
|
"ln" : "Lingala",
|
||||||
|
"lt" : "Lithuanian",
|
||||||
|
"mg" : "Malagasy",
|
||||||
|
"mal" : "Malayalam",
|
||||||
|
"gv" : "Manx Gaelic",
|
||||||
|
"mi" : "Maori",
|
||||||
|
"mn" : "Mongolian",
|
||||||
|
"my" : "Myanmar Burmse",
|
||||||
|
"nd" : "Ndebele",
|
||||||
|
"nb" : "Norwegian bokmal",
|
||||||
|
"nn" : "Norwegian nynorsk",
|
||||||
|
"ury" : "Orya",
|
||||||
|
"fa" : "Persian",
|
||||||
|
"pon" : "Pohnpeian",
|
||||||
|
"pl" : "Polish",
|
||||||
|
"pt" : "Portuguese",
|
||||||
|
"pot" : "Potawatomi",
|
||||||
|
"rom" : "Romani",
|
||||||
|
"ro" : "Romanian",
|
||||||
|
"ru" : "Russian",
|
||||||
|
"sml" : "Sama",
|
||||||
|
"gd" : "Scottish Gaelic",
|
||||||
|
"sr" : "Serbian",
|
||||||
|
"sn" : "Shona",
|
||||||
|
"cu" : "Slavonic Elizabeth",
|
||||||
|
"sl" : "Slovene",
|
||||||
|
"so" : "Somali",
|
||||||
|
"ckb" : "Sorani Kurdis",
|
||||||
|
"es" : "Spanish",
|
||||||
|
"sw" : "Swahili",
|
||||||
|
"sv" : "Swedish",
|
||||||
|
"syr" : "Syriac",
|
||||||
|
"tl" : "Tagalog",
|
||||||
|
"thv" : "Tamajaq",
|
||||||
|
"tsg" : "Tausug",
|
||||||
|
"th" : "Thai",
|
||||||
|
"tr" : "Turkish",
|
||||||
|
"uk" : "Ukrainian",
|
||||||
|
"ppk" : "Uma",
|
||||||
|
"ur" : "Urdu",
|
||||||
|
"Ur-deva" : "Urdu Devanagari",
|
||||||
|
"ug" : "Uyghur",
|
||||||
|
"vi" : "Vietnamese",
|
||||||
|
"cy" : "Welsh",
|
||||||
|
"wo" : "Wolof",
|
||||||
|
"xh" : "Xhosa"
|
||||||
|
}
|
13
conf/textDirection.json
Normal file
13
conf/textDirection.json
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
{
|
||||||
|
"ar" : "RTL",
|
||||||
|
"arc" : "RTL",
|
||||||
|
"prs" : "RTL",
|
||||||
|
"he" : "RTL",
|
||||||
|
"kk" : "RTL",
|
||||||
|
"mal" : "RTL",
|
||||||
|
"fa" : "RTL",
|
||||||
|
"ckb" : "RTL",
|
||||||
|
"syr" : "RTL",
|
||||||
|
"ur" : "RTL",
|
||||||
|
"Ur-deva" : "RTL"
|
||||||
|
}
|
108
conf/v1Translations.json
Normal file
108
conf/v1Translations.json
Normal file
@ -0,0 +1,108 @@
|
|||||||
|
{
|
||||||
|
"aov" : "Ou Vertaling",
|
||||||
|
"albanian" : "Albanian",
|
||||||
|
"amharic" : "Amharic NT",
|
||||||
|
"hsab" : "Haile Selassie Amharic Bible",
|
||||||
|
"arabicsv" : "Smith and Van Dyke",
|
||||||
|
"peshitta" : "Peshitta NT",
|
||||||
|
"easternarmenian" : "Eastern (Genesis Exodus Gospels)",
|
||||||
|
"westernarmenian" : "Western NT",
|
||||||
|
"basque" : "(Navarro Labourdin) NT",
|
||||||
|
"breton" : "Gospels",
|
||||||
|
"bulgarian1940" : "Bulgarian Bible (1940)",
|
||||||
|
"chamorro" : "(Psalms Gospels Acts)",
|
||||||
|
"cns" : "NCV Simplified",
|
||||||
|
"cnt" : "NCV Traditional",
|
||||||
|
"cus" : "Union Simplified",
|
||||||
|
"cut" : "Union Traditional",
|
||||||
|
"bohairic" : "Bohairic NT",
|
||||||
|
"coptic" : "New Testament",
|
||||||
|
"sahidic" : "Sahidic NT",
|
||||||
|
"croatia" : "Croatian",
|
||||||
|
"bkr" : "Czech BKR",
|
||||||
|
"cep" : "Czech CEP",
|
||||||
|
"kms" : "Czech KMS",
|
||||||
|
"nkb" : "Czech NKB",
|
||||||
|
"danish" : "Danish",
|
||||||
|
"statenvertaling" : "Dutch Staten Vertaling",
|
||||||
|
"akjv" : "American King James Version",
|
||||||
|
"asv" : "American Standard Version",
|
||||||
|
"basicenglish" : "Basic English Bible",
|
||||||
|
"darby" : "Darby",
|
||||||
|
"douayrheims" : "Douay Rheims",
|
||||||
|
"kjv" : "King James Version",
|
||||||
|
"wb" : "Webster's Bible",
|
||||||
|
"weymouth" : "Weymouth NT",
|
||||||
|
"web" : "World English Bible",
|
||||||
|
"ylt" : "Young's Literal Translation",
|
||||||
|
"esperanto" : "Esperanto",
|
||||||
|
"estonian" : "Estonian",
|
||||||
|
"finnish1776" : "Finnish Bible (1776)",
|
||||||
|
"pyharaamattu1933" : "Pyha Raamattu (1933 1938)",
|
||||||
|
"pyharaamattu1992" : "Pyha Raamattu (1992)",
|
||||||
|
"ls1910" : "Louis Segond (1910)",
|
||||||
|
"martin" : "Martin (1744)",
|
||||||
|
"ostervald" : "Ostervald (1996 revision)",
|
||||||
|
"georgian" : "Georgian (Gospels Acts James)",
|
||||||
|
"elberfelder" : "Elberfelder (1871)",
|
||||||
|
"elberfelder1905" : "Elberfelder (1905)",
|
||||||
|
"luther1545" : "Luther (1545)",
|
||||||
|
"luther1912" : "Luther (1912)",
|
||||||
|
"schlachter" : "Schlachter (1951)",
|
||||||
|
"gothic" : "Gothic (Nehemiah NT Portions)",
|
||||||
|
"moderngreek" : "Greek Modern",
|
||||||
|
"majoritytext" : "NT Byzantine Majority Text (2000) Parsed",
|
||||||
|
"byzantine" : "NT Byzantine Majority Text (2000)",
|
||||||
|
"textusreceptus" : "NT Textus Receptus (1550 1894) Parsed",
|
||||||
|
"text" : "Textus Receptus",
|
||||||
|
"tischendorf" : "NT Tischendorf 8th Ed",
|
||||||
|
"westcotthort" : "NT Westcott Hort UBS4 variants Parsed",
|
||||||
|
"westcott" : "NT Westcott Hort UBS4 variants",
|
||||||
|
"lxxpar" : "OT LXX Accented Roots Parsing",
|
||||||
|
"lxx" : "OT LXX Accented",
|
||||||
|
"lxxunaccentspar" : "OT LXX Unaccented Roots Parsing",
|
||||||
|
"lxxunaccents" : "OT LXX Unaccented",
|
||||||
|
"aleppo" : "Aleppo Codex",
|
||||||
|
"modernhebrew" : "Hebrew Modern",
|
||||||
|
"bhsnovowels" : "OT BHS (Consonants Only)",
|
||||||
|
"bhs" : "OT BHS (Consonants and Vowels)",
|
||||||
|
"wlcnovowels" : "OT WLC (Consonants Only)",
|
||||||
|
"wlc" : "OT WLC (Consonants and Vowels)",
|
||||||
|
"codex" : "OT Westminster Leningrad Codex",
|
||||||
|
"karoli" : "Hungarian Karoli",
|
||||||
|
"giovanni" : "Giovanni Diodati Bible (1649)",
|
||||||
|
"riveduta" : "Riveduta Bible (1927)",
|
||||||
|
"kabyle" : "Kabyle NT",
|
||||||
|
"korean" : "Korean",
|
||||||
|
"newvulgate" : "Nova Vulgata",
|
||||||
|
"vulgate" : "Vulgata Clementina",
|
||||||
|
"latvian" : "New Testament",
|
||||||
|
"lithuanian" : "Lithuanian",
|
||||||
|
"manxgaelic" : "Manx Gaelic (Esther Jonah 4 Gospels)",
|
||||||
|
"maori" : "Maori",
|
||||||
|
"judson" : "Judson (1835)",
|
||||||
|
"bibelselskap" : "Det Norsk Bibelselskap (1930)",
|
||||||
|
"almeida" : "Almeida Atualizada",
|
||||||
|
"potawatomi" : "Potawatomi (Matthew Acts) (Lykins 1844)",
|
||||||
|
"rom" : "Romani NT E Lashi Viasta (Gypsy)",
|
||||||
|
"cornilescu" : "Cornilescu",
|
||||||
|
"makarij" : "Makarij Translation Pentateuch (1825)",
|
||||||
|
"synodal" : "Synodal Translation (1876)",
|
||||||
|
"zhuromsky" : "Victor Zhuromsky NT",
|
||||||
|
"gaelic" : "Scots Gaelic (Gospel of Mark)",
|
||||||
|
"valera" : "Reina Valera (1909)",
|
||||||
|
"rv1858" : "Reina Valera NT (1858)",
|
||||||
|
"sse" : "Sagradas Escrituras (1569)",
|
||||||
|
"swahili" : "Swahili",
|
||||||
|
"swedish" : "Swedish (1917)",
|
||||||
|
"tagalog" : "Ang Dating Biblia (1905)",
|
||||||
|
"tamajaq" : "Tamajaq Portions",
|
||||||
|
"thai" : "Thai from kjv",
|
||||||
|
"tnt" : "NT (1987 1994)",
|
||||||
|
"turkish" : "Turkish",
|
||||||
|
"ukranian" : "NT (P Kulish 1871)",
|
||||||
|
"uma" : "Uma NT",
|
||||||
|
"vietnamese" : "Vietnamese (1934)",
|
||||||
|
"wolof" : "Wolof NT",
|
||||||
|
"xhosa" : "Xhosa"
|
||||||
|
}
|
307
run.sh
Executable file
307
run.sh
Executable file
@ -0,0 +1,307 @@
|
|||||||
|
#! /bin/bash
|
||||||
|
|
||||||
|
# Do some prep work
|
||||||
|
command -v jq >/dev/null 2>&1 || { echo >&2 "We require jq for this script to run, but it's not installed. Aborting."; exit 1; }
|
||||||
|
command -v sha1sum >/dev/null 2>&1 || { echo >&2 "We require sha1sum for this script to run, but it's not installed. Aborting."; exit 1; }
|
||||||
|
command -v git >/dev/null 2>&1 || { echo >&2 "We require git for this script to run, but it's not installed. Aborting."; exit 1; }
|
||||||
|
command -v whiptail >/dev/null 2>&1 || { echo >&2 "We require whiptail for this script to run, but it's not installed. Aborting."; exit 1; }
|
||||||
|
command -v python3 >/dev/null 2>&1 || { echo >&2 "We require python3 for this script to run, but it's not installed. Aborting."; exit 1; }
|
||||||
|
|
||||||
|
# main function
|
||||||
|
function main () {
|
||||||
|
# main project Header
|
||||||
|
header_string="getBible JSON API.v2"
|
||||||
|
# remove and re-download Crosswire modules
|
||||||
|
if (( "$DOWNLOAD" == 1 )); then
|
||||||
|
getModules "${DIR_zip}"
|
||||||
|
fi
|
||||||
|
# prep the Scripture Main Git Folder
|
||||||
|
prepScriptureMainGit "${DIR_api}_scripture"
|
||||||
|
# numbers
|
||||||
|
number=$(ls "${DIR_zip}" | wc -l)
|
||||||
|
each_count=$((98 / $number))
|
||||||
|
# Build Static JSON Files
|
||||||
|
setStaticJsonFiles "${DIR_api}_scripture" "${DIR_zip}" "$number" "$each_count" "$header_string"
|
||||||
|
# Remove Empty Folder & Static Files
|
||||||
|
cleanSystem "${DIR_api}_scripture"
|
||||||
|
# start hashing Translations
|
||||||
|
hashingMethod "${DIR_api}_scripture" \
|
||||||
|
"hash_versions" \
|
||||||
|
"Hash Versions | ${header_string}" \
|
||||||
|
"Start Versions Hashing" \
|
||||||
|
"Done Hashing Versions" \
|
||||||
|
"Please wait while we hash all versions"
|
||||||
|
# start hashing Translations Books
|
||||||
|
hashingMethod "${DIR_api}_scripture" \
|
||||||
|
"hash_books" \
|
||||||
|
"Hash Books | ${header_string}" \
|
||||||
|
"Start Versions Books Hashing" \
|
||||||
|
"Done Hashing All Versions Books" \
|
||||||
|
"Please wait while we hash all versions books"
|
||||||
|
# start hashing Translations Books Chapters
|
||||||
|
hashingMethod "${DIR_api}_scripture" \
|
||||||
|
"hash_chapters" \
|
||||||
|
"Hash Chapters | ${header_string}" \
|
||||||
|
"Start Versions Books Chapters Hashing" \
|
||||||
|
"Done Hashing All Versions Books Chapters" \
|
||||||
|
"Please wait while we hash all versions books chapters"
|
||||||
|
# moving all public hash files into place
|
||||||
|
hashingMethod "${DIR_api}" \
|
||||||
|
"movePublicHashFiles" \
|
||||||
|
"Moving Public Hash | ${header_string}" \
|
||||||
|
"Start Moving Public Hashes" \
|
||||||
|
"Done Moving All Public Hashes" \
|
||||||
|
"Please wait while we move all the public hashes into place"
|
||||||
|
# finally check if we must commit and push changes
|
||||||
|
if (( "$PUSH" == 1 )); then
|
||||||
|
"${DIR_src}/moveToGithub.sh" "${DIR_api}"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# remove and re-download Crosswire modules
|
||||||
|
function getModules () {
|
||||||
|
# set local values
|
||||||
|
local modules_path="$1"
|
||||||
|
local header_string="$2"
|
||||||
|
# we first delete the old models
|
||||||
|
rm -fr $modules_path
|
||||||
|
mkdir -p $modules_path
|
||||||
|
# then we get the current modules
|
||||||
|
{
|
||||||
|
sleep 1
|
||||||
|
echo -e "XXX\n0\nStart download of modules... \nXXX"
|
||||||
|
sleep 1
|
||||||
|
python3 -u "${DIR_src}/download.py" --output_path "${modules_path}"
|
||||||
|
sleep 1
|
||||||
|
echo -e "XXX\n100\nDone downloading modules... \nXXX"
|
||||||
|
sleep 2
|
||||||
|
} | whiptail --title "Get Crosswire Modules | ${header_string}" --gauge "Please wait while we download all modules" 7 77 0
|
||||||
|
}
|
||||||
|
|
||||||
|
# prep the Scripture Main Git Folder
|
||||||
|
function prepScriptureMainGit () {
|
||||||
|
# set local values
|
||||||
|
local scripture_path="$1"
|
||||||
|
# if git folder does not exist clone it
|
||||||
|
if [ ! -d "$scripture_path" ]; then
|
||||||
|
# create the git folder (for scripture)
|
||||||
|
mkdir -p "$scripture_path"
|
||||||
|
fi
|
||||||
|
# reset the git folder on each run
|
||||||
|
if [ -d "$scripture_path/.git" ]; then
|
||||||
|
mkdir -p "${scripture_path}Tmp"
|
||||||
|
mv -f "${scripture_path}/.git" "${scripture_path}Tmp"
|
||||||
|
mv -f "${scripture_path}/.gitignore" "${scripture_path}Tmp"
|
||||||
|
|
||||||
|
# now we remove all the old git files (so we start clean each time in the build)
|
||||||
|
rm -fr $scripture_path
|
||||||
|
mv -f "${scripture_path}Tmp" "${scripture_path}"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Build Static JSON Files
|
||||||
|
function setStaticJsonFiles () {
|
||||||
|
# set local values
|
||||||
|
local scripture_path="$1"
|
||||||
|
local modules_path="$2"
|
||||||
|
local counter="$3"
|
||||||
|
local each_count="$4"
|
||||||
|
local header_string="$5"
|
||||||
|
# whiptail messaging
|
||||||
|
{
|
||||||
|
sleep 1
|
||||||
|
echo -e "XXX\n0\nStart Building... \nXXX"
|
||||||
|
sleep 1
|
||||||
|
for filename in $modules_path/*.zip; do
|
||||||
|
# give notice
|
||||||
|
echo -e "XXX\n${counter}\nBuilding ${filename} static json files...\nXXX"
|
||||||
|
# add more
|
||||||
|
next=$(($each_count + $counter))
|
||||||
|
# run script
|
||||||
|
python3 -u "${DIR_src}/sword_to_json.py" --source_file "${filename}" --output_path "${scripture_path}" --counter "${counter}" --next "${next}" --conf_dir "${DIR_conf}"
|
||||||
|
# add more
|
||||||
|
counter=$(($each_count + $counter))
|
||||||
|
# give notice
|
||||||
|
echo -e "XXX\n${counter}\nDone building ${filename} static json files...\nXXX"
|
||||||
|
sleep 1
|
||||||
|
done
|
||||||
|
echo -e "XXX\n100\nDone Building... \nXXX"
|
||||||
|
sleep 1
|
||||||
|
} | whiptail --title "Build Static JSON Files | ${header_string}" --gauge "Please wait while build the static json API" 7 77 0
|
||||||
|
}
|
||||||
|
|
||||||
|
# Remove Empty Folder & Static Files
|
||||||
|
function cleanSystem () {
|
||||||
|
# set local values
|
||||||
|
local scripture_path="$1"
|
||||||
|
# remove all empty files
|
||||||
|
find "${scripture_path}" -name "*.json" -type f -size -500c -delete
|
||||||
|
# remove all empty folders
|
||||||
|
find "${scripture_path}" -type d -empty -delete
|
||||||
|
}
|
||||||
|
|
||||||
|
# hashing all files in the project
|
||||||
|
function hashingMethod () {
|
||||||
|
# set local values
|
||||||
|
local scripture_path="$1"
|
||||||
|
local script_name="$2"
|
||||||
|
local w_title="$3"
|
||||||
|
local w_start_ms="$4"
|
||||||
|
local w_end_ms="$5"
|
||||||
|
local w_initial_ms="$6"
|
||||||
|
# now run the hashing
|
||||||
|
{
|
||||||
|
sleep 1
|
||||||
|
echo -e "XXX\n0\n${w_start_ms}... \nXXX"
|
||||||
|
sleep 1
|
||||||
|
. "${DIR_src}/${script_name}.sh" "${scripture_path}"
|
||||||
|
sleep 1
|
||||||
|
echo -e "XXX\n100\n${w_end_ms}... \nXXX"
|
||||||
|
sleep 1
|
||||||
|
} | whiptail --title "$w_title" --gauge "$w_initial_ms" 7 77 0
|
||||||
|
}
|
||||||
|
|
||||||
|
# help message
|
||||||
|
function show_help () {
|
||||||
|
cat << EOF
|
||||||
|
Usage: ${0##*/:-} [OPTION...]
|
||||||
|
|
||||||
|
You are able to change a few default behaviours in the getBible API builder
|
||||||
|
------ Passing no command options will fallback on the defaults -------
|
||||||
|
|
||||||
|
Options
|
||||||
|
======================================================
|
||||||
|
-a|--api
|
||||||
|
set the API target folders full path
|
||||||
|
- target folders will be created using this path
|
||||||
|
|
||||||
|
example: ${0##*/:-} -a /home/username/v2
|
||||||
|
example: ${0##*/:-} --api /home/username/v2
|
||||||
|
|
||||||
|
two folders will be created:
|
||||||
|
- /home/username/v2
|
||||||
|
- /home/username/v2_scripture
|
||||||
|
|
||||||
|
defaults:
|
||||||
|
- repo/v2
|
||||||
|
- repo/v2_scripture
|
||||||
|
|
||||||
|
(these are the target folders)
|
||||||
|
======================================================
|
||||||
|
-p|--push
|
||||||
|
push changes to github (only if there are changes)
|
||||||
|
- setup the target folders (see target folders)
|
||||||
|
- linked them to github (your own repos)
|
||||||
|
- must be able to push (ssh authentication needed)
|
||||||
|
|
||||||
|
REMEMBER THE AGREEMENT (README.md)
|
||||||
|
|
||||||
|
example: ${0##*/:-} -p
|
||||||
|
example: ${0##*/:-} --push
|
||||||
|
======================================================
|
||||||
|
-z|--zip
|
||||||
|
set the ZIP target folder full path for the Crosswire Modules
|
||||||
|
|
||||||
|
example: ${0##*/:-} -z /home/username/sword_zip
|
||||||
|
example: ${0##*/:-} --zip /home/username/sword_zip
|
||||||
|
|
||||||
|
defaults:
|
||||||
|
- repo/sword_zip
|
||||||
|
======================================================
|
||||||
|
-d
|
||||||
|
Do not download all Crosswire Modules (helpful in testing)
|
||||||
|
|
||||||
|
example: ${0##*/:-} -d
|
||||||
|
======================================================
|
||||||
|
-h|--help
|
||||||
|
display this help menu
|
||||||
|
|
||||||
|
example: ${0##*/:-} -h
|
||||||
|
example: ${0##*/:-} --help
|
||||||
|
======================================================
|
||||||
|
getBible.net
|
||||||
|
======================================================
|
||||||
|
EOF
|
||||||
|
}
|
||||||
|
|
||||||
|
# get script path
|
||||||
|
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||||
|
# set working paths
|
||||||
|
DIR_src="${DIR}/src"
|
||||||
|
DIR_conf="${DIR}/conf"
|
||||||
|
DIR_api="${DIR}/sword_zip"
|
||||||
|
DIR_zip="${DIR}/v2"
|
||||||
|
# download all modules
|
||||||
|
DOWNLOAD=1
|
||||||
|
# push changes to github (you need setup your own repos)
|
||||||
|
PUSH=0
|
||||||
|
# show values do not run
|
||||||
|
SHOWCONF=0
|
||||||
|
|
||||||
|
# check if we have options
|
||||||
|
while :; do
|
||||||
|
case $1 in
|
||||||
|
-h|--help)
|
||||||
|
show_help # Display a usage synopsis.
|
||||||
|
exit
|
||||||
|
;;
|
||||||
|
-d)
|
||||||
|
DOWNLOAD=0
|
||||||
|
;;
|
||||||
|
--show)
|
||||||
|
SHOWCONF=1
|
||||||
|
;;
|
||||||
|
-p|--push)
|
||||||
|
PUSH=1
|
||||||
|
;;
|
||||||
|
-a|--api) # Takes an option argument; ensure it has been specified.
|
||||||
|
if [ "$2" ]; then
|
||||||
|
DIR_api=$2
|
||||||
|
shift
|
||||||
|
else
|
||||||
|
echo 'ERROR: "--api" requires a non-empty option argument.'
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
--api=?*)
|
||||||
|
DIR_api=${1#*=} # Delete everything up to "=" and assign the remainder.
|
||||||
|
;;
|
||||||
|
--api=) # Handle the case of an empty --api=
|
||||||
|
echo 'ERROR: "--api" requires a non-empty option argument.'
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
-z|--zip) # Takes an option argument; ensure it has been specified.
|
||||||
|
if [ "$2" ]; then
|
||||||
|
DIR_zip=$2
|
||||||
|
shift
|
||||||
|
else
|
||||||
|
echo 'ERROR: "--zip" requires a non-empty option argument.'
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
--zip=?*)
|
||||||
|
DIR_zip=${1#*=} # Delete everything up to "=" and assign the remainder.
|
||||||
|
;;
|
||||||
|
--zip=) # Handle the case of an empty --zip=
|
||||||
|
echo 'ERROR: "--zip" requires a non-empty option argument.'
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
*) # Default case: No more options, so break out of the loop.
|
||||||
|
break
|
||||||
|
esac
|
||||||
|
shift
|
||||||
|
done
|
||||||
|
|
||||||
|
# show the config values
|
||||||
|
if (( "$SHOWCONF" == 1 )); then
|
||||||
|
echo "DIR_api: ${DIR_api}"
|
||||||
|
echo "DIR_zip: ${DIR_zip}"
|
||||||
|
echo "DIR_src: ${DIR_src}"
|
||||||
|
echo "DOWNLOAD: ${DOWNLOAD}"
|
||||||
|
echo "PUSH: ${PUSH}"
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
# run Main ;)
|
||||||
|
main
|
||||||
|
|
105
src/download.py
Normal file
105
src/download.py
Normal file
@ -0,0 +1,105 @@
|
|||||||
|
import os, os.path, json, urllib, urllib.request, sys, zipfile, shutil, argparse
|
||||||
|
|
||||||
|
parser = argparse.ArgumentParser()
|
||||||
|
# get the arguments
|
||||||
|
parser.add_argument('--output_path', help='The local path like "V2"', default="V2")
|
||||||
|
# set to args
|
||||||
|
args = parser.parse_args()
|
||||||
|
# this is a full path
|
||||||
|
MAIN_PATH = args.output_path
|
||||||
|
|
||||||
|
# some helper dictionaries
|
||||||
|
v1_translation_names = json.loads(open("../conf/CrosswireModulesMap.json").read())
|
||||||
|
# scripts directory
|
||||||
|
CURRENT_DIR = os.path.dirname(os.path.realpath(__file__))
|
||||||
|
|
||||||
|
# function to create path if not exist
|
||||||
|
def check_path(path):
|
||||||
|
if not os.path.isdir(path):
|
||||||
|
os.makedirs(path)
|
||||||
|
|
||||||
|
def zipper(src, dest, filename):
|
||||||
|
"""Backup files from src to dest."""
|
||||||
|
base = os.path.basename(src)
|
||||||
|
newFile = filename+".zip"
|
||||||
|
|
||||||
|
# Set the current working directory.
|
||||||
|
os.chdir(dest)
|
||||||
|
|
||||||
|
if os.path.exists(newFile):
|
||||||
|
os.unlink(newFile)
|
||||||
|
|
||||||
|
# Write the zipfile and walk the source directory tree.
|
||||||
|
with zipfile.ZipFile(newFile, 'w') as zip:
|
||||||
|
for folder, _ , files in os.walk(src):
|
||||||
|
for file in files:
|
||||||
|
zip.write(os.path.join(folder, file),
|
||||||
|
arcname=os.path.join(folder[len(src):], file),
|
||||||
|
compress_type=zipfile.ZIP_DEFLATED)
|
||||||
|
|
||||||
|
# move back to working directory
|
||||||
|
os.chdir(CURRENT_DIR)
|
||||||
|
|
||||||
|
# make sure the main folder exist
|
||||||
|
check_path(MAIN_PATH)
|
||||||
|
# number of items
|
||||||
|
number = len(v1_translation_names.keys())
|
||||||
|
each_count = int(98 / number)
|
||||||
|
counter = 0
|
||||||
|
# loop the names
|
||||||
|
for sword_name in v1_translation_names:
|
||||||
|
# set local file name
|
||||||
|
file_path = MAIN_PATH+"/"+sword_name+".zip"
|
||||||
|
# set remote URL
|
||||||
|
file_url = "http://www.crosswire.org/ftpmirror/pub/sword/packages/rawzip/"+sword_name+".zip"
|
||||||
|
# notice name
|
||||||
|
file_name = sword_name+".zip"
|
||||||
|
# check if file exist locally
|
||||||
|
if os.path.isfile(file_path):
|
||||||
|
print('XXX\n{}\n{} already exist\nXXX'.format(counter, file_name))
|
||||||
|
else:
|
||||||
|
try:
|
||||||
|
print('XXX\n{}\nDownloading the RAW format of {}\nXXX'.format(counter, file_name))
|
||||||
|
urllib.request.urlretrieve(file_url, file_path)
|
||||||
|
except urllib.error.HTTPError as e:
|
||||||
|
print('XXX\n{} Download {} failed! {}\nXXX'.format(counter, sword_name, e))
|
||||||
|
# check if this is a legitimate zip file
|
||||||
|
if zipfile.is_zipfile(file_path) == False:
|
||||||
|
os.remove(file_path)
|
||||||
|
print('XXX\n{}\n{} was removed since it has errors...\nXXX'.format(counter, file_path))
|
||||||
|
# we try the win repository
|
||||||
|
file_url = "http://www.crosswire.org/ftpmirror/pub/sword/packages/win/" + sword_name + ".zip"
|
||||||
|
try:
|
||||||
|
print('XXX\n{}\nDownloading the WIN format of {}\nXXX'.format(counter, file_name))
|
||||||
|
urllib.request.urlretrieve(file_url, file_path)
|
||||||
|
except urllib.error.HTTPError as e:
|
||||||
|
print('XXX\n{}\n{} Download {} failed! {}\nXXX'.format(sword_name, e))
|
||||||
|
# again check if this is a legitimate zip file
|
||||||
|
if zipfile.is_zipfile(file_path) == False:
|
||||||
|
os.remove(file_path)
|
||||||
|
print('XXX\n{}\n{} was again removed since it has errors...\nXXX'.format(counter, file_name))
|
||||||
|
else:
|
||||||
|
# set local file name
|
||||||
|
folder_path = MAIN_PATH+"/"+sword_name
|
||||||
|
folder_raw_path = MAIN_PATH+"/"+sword_name+"/RAW"
|
||||||
|
data_raw_path = MAIN_PATH+"/"+sword_name+"/data.zip"
|
||||||
|
print('XXX\n{}\n{} is being converted to RAW format\nXXX'.format(counter, file_name))
|
||||||
|
# first we extract the WIN format
|
||||||
|
with zipfile.ZipFile(file_path, 'r') as zip_ref:
|
||||||
|
zip_ref.extractall(folder_path)
|
||||||
|
os.remove(file_path)
|
||||||
|
# now we extract the RAW format
|
||||||
|
with zipfile.ZipFile(data_raw_path, 'r') as zip_ref:
|
||||||
|
zip_ref.extractall(folder_raw_path)
|
||||||
|
os.remove(data_raw_path)
|
||||||
|
# now rename the folder
|
||||||
|
os.rename(folder_raw_path+"/newmods", folder_raw_path+"/mods.d")
|
||||||
|
# now zip the RAW folder
|
||||||
|
zipper(folder_raw_path, MAIN_PATH, sword_name)
|
||||||
|
# now remove the tmp folder
|
||||||
|
try:
|
||||||
|
shutil.rmtree(folder_path)
|
||||||
|
except OSError as e:
|
||||||
|
print("XXX\nError: %s - %s.\nXXX" % (e.filename, e.strerror))
|
||||||
|
# increase the counter
|
||||||
|
counter = int(counter + each_count)
|
132
src/hash_books.sh
Executable file
132
src/hash_books.sh
Executable file
@ -0,0 +1,132 @@
|
|||||||
|
#! /bin/bash
|
||||||
|
|
||||||
|
# Do some prep work
|
||||||
|
command -v jq >/dev/null 2>&1 || { echo >&2 "We require jq for this script to run, but it's not installed. Aborting."; exit 1; }
|
||||||
|
command -v sha1sum >/dev/null 2>&1 || { echo >&2 "We require sha1sum for this script to run, but it's not installed. Aborting."; exit 1; }
|
||||||
|
|
||||||
|
# make sure we have at least one argument
|
||||||
|
if [ $# -eq 0 ]
|
||||||
|
then
|
||||||
|
echo >&2 "Target folder must be supplied. Aborting."
|
||||||
|
exit 1;
|
||||||
|
fi
|
||||||
|
|
||||||
|
# target folder
|
||||||
|
target_folder="$1"
|
||||||
|
# tracker counter
|
||||||
|
counter=0
|
||||||
|
|
||||||
|
# check if the folder exist
|
||||||
|
if [ ! -d $target_folder ]
|
||||||
|
then
|
||||||
|
echo >&2 "Folder $target_folder not found. Aborting.";
|
||||||
|
exit 1;
|
||||||
|
fi
|
||||||
|
|
||||||
|
for filename in $target_folder/*.json; do
|
||||||
|
# setup: positional arguments to pass in literal variables, query with code
|
||||||
|
jq_args=( )
|
||||||
|
jq_query='.'
|
||||||
|
jq_t_args=( )
|
||||||
|
jq_t_query='.'
|
||||||
|
# get the abbreviation
|
||||||
|
abbreviation="${filename/.json/}"
|
||||||
|
abbreviation="${abbreviation/${target_folder}\//}"
|
||||||
|
# do not work with the translations or checksum file
|
||||||
|
if [[ "$abbreviation" == 'translations' || "$abbreviation" == 'checksum' ]]
|
||||||
|
then
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
# do not work with the books or chapters file
|
||||||
|
if [[ "$abbreviation" == 'books' || "$abbreviation" == 'chapters' ]]
|
||||||
|
then
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
# make sure the book directory is build
|
||||||
|
if [ -d "${target_folder}/$abbreviation" ]
|
||||||
|
then
|
||||||
|
# load the translation in
|
||||||
|
bible=$( cat "${filename}" | jq '.' -a )
|
||||||
|
# get book numbers
|
||||||
|
readarray -t booknr < <( echo "${bible}" | jq -r '.books[].nr')
|
||||||
|
# now remove all books
|
||||||
|
bible=$( echo "${bible}" | jq '. | del(.books) | del(.discription)' -a )
|
||||||
|
# set language
|
||||||
|
language=$( echo "${bible}" | jq '.language' -r )
|
||||||
|
# set translation
|
||||||
|
translation=$( echo "${bible}" | jq '.translation' -r )
|
||||||
|
# set direction
|
||||||
|
direction=$( echo "${bible}" | jq '.direction' -r )
|
||||||
|
# start bucket
|
||||||
|
booksBucket="# language translation abbreviation direction name filename sha\n"
|
||||||
|
# checksum
|
||||||
|
checksumBucket="# filename sha\n"
|
||||||
|
# add more
|
||||||
|
next=$(($counter+15))
|
||||||
|
# make sure next is not above 99
|
||||||
|
if (("$next" > 99))
|
||||||
|
then
|
||||||
|
next=99
|
||||||
|
fi
|
||||||
|
counter_inner=$counter
|
||||||
|
# read book names
|
||||||
|
for nr in "${booknr[@]}";
|
||||||
|
do
|
||||||
|
# check if file is set
|
||||||
|
if [ -f "${target_folder}/${abbreviation}/${nr}.json" ]
|
||||||
|
then
|
||||||
|
# load the book in
|
||||||
|
book=$( cat "${target_folder}/${abbreviation}/${nr}.json" | jq '.' -a )
|
||||||
|
# update the file formatting
|
||||||
|
echo "${book}" > "${target_folder}/${abbreviation}/${nr}.json"
|
||||||
|
# get the hash
|
||||||
|
fileHash=$(sha1sum "${target_folder}/${abbreviation}/${nr}.json" | awk '{print $1}')
|
||||||
|
# build the return values
|
||||||
|
book=$( echo "${book}" | jq ". | del(.chapters) | .[\"url\"]=\"https://getbible.net/v2/${abbreviation}/${nr}.json\" | .[\"sha\"]=\"${fileHash}\"" -a )
|
||||||
|
# load the values for json
|
||||||
|
jq_t_args+=( --arg "key$nr" "$nr" )
|
||||||
|
jq_t_args+=( --argjson "value$nr" "$book" )
|
||||||
|
# build query for jq
|
||||||
|
jq_t_query+=" | .[\$key${nr}]=\$value${nr}"
|
||||||
|
# create/update the Bible file checksum
|
||||||
|
echo "${fileHash}" > "${target_folder}/${abbreviation}/${nr}.sha"
|
||||||
|
# load book name
|
||||||
|
book_name=$( echo "${book}" | jq '.name' -r )
|
||||||
|
# load the buckets
|
||||||
|
checksumBucket+="${nr} ${nr} ${fileHash}\n"
|
||||||
|
booksBucket+="${nr} ${language} ${translation} ${abbreviation} ${direction} ${book_name} ${nr} ${fileHash}\n"
|
||||||
|
# load the values for json
|
||||||
|
jq_args+=( --arg "key$nr" "${nr}" )
|
||||||
|
jq_args+=( --arg "value$nr" "$fileHash" )
|
||||||
|
# build query for jq
|
||||||
|
jq_query+=" | .[\$key${nr}]=\$value${nr}"
|
||||||
|
# check if we have counter upto next
|
||||||
|
if (("$counter_inner" >= "$next"))
|
||||||
|
then
|
||||||
|
counter_inner=$counter
|
||||||
|
fi
|
||||||
|
# increment the counter
|
||||||
|
counter_inner=$((counter_inner+1))
|
||||||
|
# give notice
|
||||||
|
echo -e "XXX\n${counter_inner}\nHashing ${abbreviation}/${nr}.json\nXXX"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
# set books checksum to text file
|
||||||
|
echo -e "$checksumBucket" > "${target_folder}/${abbreviation}/checksum"
|
||||||
|
# set books details to text file
|
||||||
|
echo -e "$booksBucket" > "${target_folder}/${abbreviation}/books"
|
||||||
|
# run the generated command with jq
|
||||||
|
jq "${jq_args[@]}" "$jq_query" <<<'{}' > "${target_folder}/${abbreviation}/checksum.json"
|
||||||
|
jq "${jq_t_args[@]}" "$jq_t_query" <<<'{}' > "${target_folder}/${abbreviation}/books.json"
|
||||||
|
# check if we have counter upto 98
|
||||||
|
if (("$counter" >= 98))
|
||||||
|
then
|
||||||
|
counter=70
|
||||||
|
fi
|
||||||
|
# add more
|
||||||
|
counter=$((counter+1))
|
||||||
|
# give notice
|
||||||
|
echo -e "XXX\n${counter}\nDone Hashing $abbreviation books\nXXX"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
135
src/hash_chapters.sh
Executable file
135
src/hash_chapters.sh
Executable file
@ -0,0 +1,135 @@
|
|||||||
|
#! /bin/bash
|
||||||
|
|
||||||
|
# Do some prep work
|
||||||
|
command -v jq >/dev/null 2>&1 || { echo >&2 "We require jq for this script to run, but it's not installed. Aborting."; exit 1; }
|
||||||
|
command -v sha1sum >/dev/null 2>&1 || { echo >&2 "We require sha1sum for this script to run, but it's not installed. Aborting."; exit 1; }
|
||||||
|
|
||||||
|
# make sure we have at least one argument
|
||||||
|
if [ $# -eq 0 ]
|
||||||
|
then
|
||||||
|
echo >&2 "Target folder must be supplied. Aborting."
|
||||||
|
exit 1;
|
||||||
|
fi
|
||||||
|
|
||||||
|
# target folder
|
||||||
|
target_folder="$1"
|
||||||
|
# tracker counter
|
||||||
|
counter=0
|
||||||
|
|
||||||
|
# check if the folder exist
|
||||||
|
if [ ! -d $target_folder ]
|
||||||
|
then
|
||||||
|
echo >&2 "Folder $target_folder not found. Aborting.";
|
||||||
|
exit 1;
|
||||||
|
fi
|
||||||
|
|
||||||
|
for filename in $target_folder/*.json; do
|
||||||
|
# get the abbreviation
|
||||||
|
abbreviation="${filename/.json/}"
|
||||||
|
abbreviation="${abbreviation/${target_folder}\//}"
|
||||||
|
echo "$abbreviation"
|
||||||
|
# do not work with the translations or checksum file
|
||||||
|
if [[ "$abbreviation" == 'translations' || "$abbreviation" == 'checksum' ]]
|
||||||
|
then
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
# do not work with the books or chapters file
|
||||||
|
if [[ "$abbreviation" == 'books' || "$abbreviation" == 'chapters' ]]
|
||||||
|
then
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
# make sure the book directory is build
|
||||||
|
if [ -d "${target_folder}/$abbreviation" ]
|
||||||
|
then
|
||||||
|
# set language
|
||||||
|
language=$( cat "${filename}" | jq '.language' -r )
|
||||||
|
# set translation
|
||||||
|
translation=$( cat "${filename}"| jq '.translation' -r )
|
||||||
|
# set language
|
||||||
|
direction=$( cat "${filename}" | jq '.direction' -r )
|
||||||
|
# get booknumbers
|
||||||
|
readarray -t booknr < <( cat "${filename}" | jq -r '.books[].nr')
|
||||||
|
# add more
|
||||||
|
next=$(($counter+15))
|
||||||
|
# make sure next is not above 99
|
||||||
|
if (("$next" > 99))
|
||||||
|
then
|
||||||
|
next=99
|
||||||
|
fi
|
||||||
|
counter_inner=$counter
|
||||||
|
# read book names
|
||||||
|
for nr in "${booknr[@]}";
|
||||||
|
do
|
||||||
|
# setup: positional arguments to pass in literal variables, query with code
|
||||||
|
jq_args=( )
|
||||||
|
jq_query='.'
|
||||||
|
jq_t_args=( )
|
||||||
|
jq_t_query='.'
|
||||||
|
# check if file is set
|
||||||
|
if [ -f "${target_folder}/${abbreviation}/${nr}.json" ]
|
||||||
|
then
|
||||||
|
# chapters details
|
||||||
|
chaptersBucket="# language translation abbreviation textdirection book_nr book_name filename sha\n"
|
||||||
|
# checksum
|
||||||
|
checksumBucket="# filename sha\n"
|
||||||
|
# get book name
|
||||||
|
book_name=$( cat "${target_folder}/${abbreviation}/${nr}.json" | jq '.name' -r )
|
||||||
|
# get all chapters
|
||||||
|
readarray -t chapters < <( cat "${target_folder}/${abbreviation}/${nr}.json" | jq -r '.chapters[].chapter' | sort -g)
|
||||||
|
# get chapters
|
||||||
|
for chapter in "${chapters[@]}";
|
||||||
|
do
|
||||||
|
# only build hash chapter for existing files
|
||||||
|
if [ -f "${target_folder}/${abbreviation}/${nr}/${chapter}.json" ]
|
||||||
|
then
|
||||||
|
# get the hash
|
||||||
|
fileHash=$(sha1sum "${target_folder}/${abbreviation}/${nr}/${chapter}.json" | awk '{print $1}')
|
||||||
|
# load the book in
|
||||||
|
chapter_info=$( cat "${target_folder}/${abbreviation}/${nr}/${chapter}.json" | jq ". | del(.verses) | .[\"url\"]=\"https://getbible.net/v2/${abbreviation}/${nr}/${chapter}.json\" | .[\"sha\"]=\"${fileHash}\"" -a )
|
||||||
|
# load the values for json
|
||||||
|
jq_t_args+=( --arg "key$chapter" "${chapter}" )
|
||||||
|
jq_t_args+=( --argjson "value$chapter" "${chapter_info}" )
|
||||||
|
# build query for jq
|
||||||
|
jq_t_query+=" | .[\$key${chapter}]=\$value${chapter}"
|
||||||
|
# create/update the Bible file checksum
|
||||||
|
echo "${fileHash}" > "${target_folder}/${abbreviation}/${nr}/${chapter}.sha"
|
||||||
|
# load the buckets
|
||||||
|
checksumBucket+="${chapter} ${chapter} ${fileHash}\n"
|
||||||
|
chaptersBucket+="${chapter} ${language} ${translation} ${abbreviation} ${direction} ${nr} ${book_name} ${chapter} ${fileHash}\n"
|
||||||
|
# load the values for json
|
||||||
|
jq_args+=( --arg "key$chapter" "${chapter}" )
|
||||||
|
jq_args+=( --arg "value$chapter" "$fileHash" )
|
||||||
|
# build query for jq
|
||||||
|
jq_query+=" | .[\$key${chapter}]=\$value${chapter}"
|
||||||
|
# check if we have counter upto next
|
||||||
|
if (("$counter_inner" >= "$next"))
|
||||||
|
then
|
||||||
|
counter_inner=$counter
|
||||||
|
fi
|
||||||
|
# increment the counter
|
||||||
|
counter_inner=$((counter_inner+1))
|
||||||
|
# give notice
|
||||||
|
echo -e "XXX\n${counter_inner}\nHashing ${abbreviation}/${nr}/${chapter}.json\nXXX"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
# set books checksum to text file
|
||||||
|
echo -e "$checksumBucket" > "${target_folder}/${abbreviation}/${nr}/checksum"
|
||||||
|
# set books details to text file
|
||||||
|
echo -e "$chaptersBucket" > "${target_folder}/${abbreviation}/${nr}/chapters"
|
||||||
|
# run the generated command with jq
|
||||||
|
jq "${jq_args[@]}" "$jq_query" <<<'{}' > "${target_folder}/${abbreviation}/${nr}/checksum.json"
|
||||||
|
jq "${jq_t_args[@]}" "$jq_t_query" <<<'{}' > "${target_folder}/${abbreviation}/${nr}/chapters.json"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
# check if we have counter upto 98
|
||||||
|
if (("$counter" >= 98))
|
||||||
|
then
|
||||||
|
counter=70
|
||||||
|
fi
|
||||||
|
# add more
|
||||||
|
counter=$((counter+1))
|
||||||
|
# give notice
|
||||||
|
echo -e "XXX\n${counter}\nDone Hashing $abbreviation chapters\nXXX"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
101
src/hash_versions.sh
Executable file
101
src/hash_versions.sh
Executable file
@ -0,0 +1,101 @@
|
|||||||
|
#! /bin/bash
|
||||||
|
|
||||||
|
# Do some prep work
|
||||||
|
command -v jq >/dev/null 2>&1 || { echo >&2 "We require jq for this script to run, but it's not installed. Aborting."; exit 1; }
|
||||||
|
command -v sha1sum >/dev/null 2>&1 || { echo >&2 "We require sha1sum for this script to run, but it's not installed. Aborting."; exit 1; }
|
||||||
|
|
||||||
|
# make sure we have at least one argument
|
||||||
|
if [ $# -eq 0 ]
|
||||||
|
then
|
||||||
|
echo >&2 "Target folder must be supplied. Aborting."
|
||||||
|
exit 1;
|
||||||
|
fi
|
||||||
|
|
||||||
|
# setup: positional arguments to pass in literal variables, query with code
|
||||||
|
jq_args=( )
|
||||||
|
jq_query='.'
|
||||||
|
jq_t_args=( )
|
||||||
|
jq_t_query='.'
|
||||||
|
|
||||||
|
# counter
|
||||||
|
nr=1
|
||||||
|
|
||||||
|
# target folder
|
||||||
|
target_folder="$1"
|
||||||
|
# tracker counter
|
||||||
|
counter=0
|
||||||
|
|
||||||
|
# check if the folder exist
|
||||||
|
if [ ! -d $target_folder ]
|
||||||
|
then
|
||||||
|
echo >&2 "Folder $target_folder not found. Aborting.";
|
||||||
|
exit 1;
|
||||||
|
fi
|
||||||
|
|
||||||
|
# book names
|
||||||
|
echo "# language translation abbreviation direction filename sha" > "${target_folder}/translations"
|
||||||
|
# checksum
|
||||||
|
echo "# filename sha" > "${target_folder}/checksum"
|
||||||
|
|
||||||
|
|
||||||
|
for filename in $target_folder/*.json; do
|
||||||
|
# get the abbreviation
|
||||||
|
abbreviation="${filename/.json/}"
|
||||||
|
abbreviation="${abbreviation/${target_folder}\//}"
|
||||||
|
# do not work with the translations or checksum file
|
||||||
|
if [[ "$abbreviation" == 'translations' || "$abbreviation" == 'checksum' ]]
|
||||||
|
then
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
# do not work with the books or chapters file
|
||||||
|
if [[ "$abbreviation" == 'books' || "$abbreviation" == 'chapters' ]]
|
||||||
|
then
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
# load the translation in
|
||||||
|
bible=$( cat "${filename}" | jq '.' -a )
|
||||||
|
# update the file formating
|
||||||
|
echo "${bible}" > "${filename}"
|
||||||
|
# build the hash file name
|
||||||
|
hashFileName="${target_folder}/${abbreviation}.sha"
|
||||||
|
# get the hash
|
||||||
|
fileHash=$(sha1sum "${filename}" | awk '{print $1}')
|
||||||
|
# build the return values
|
||||||
|
bible=$( echo "${bible}" | jq ". | del(.books) | del(.discription) | .[\"url\"]=\"https://getbible.net/v2/${abbreviation}.json\" | .[\"sha\"]=\"${fileHash}\"" -a )
|
||||||
|
# get the details
|
||||||
|
language=$( echo "${bible}" | jq '.language' -r )
|
||||||
|
translation=$( echo "${bible}" | jq '.translation' -r )
|
||||||
|
direction=$( echo "${bible}" | jq '.direction' -r )
|
||||||
|
# set file details to text file
|
||||||
|
echo "${nr} ${language} ${translation} ${abbreviation} ${direction} ${abbreviation} ${fileHash}" >> "${target_folder}/translations"
|
||||||
|
# load the values for json
|
||||||
|
jq_t_args+=( --arg "key$nr" "$abbreviation" )
|
||||||
|
jq_t_args+=( --argjson "value$nr" "$bible" )
|
||||||
|
# build query for jq
|
||||||
|
jq_t_query+=" | .[\$key${nr}]=\$value${nr}"
|
||||||
|
# create/update the Bible file checksum
|
||||||
|
echo "${fileHash}" > "$hashFileName"
|
||||||
|
# echo "${fileHash}" > "$_hashFileName"
|
||||||
|
echo "${nr} ${abbreviation} ${fileHash}" >> "${target_folder}/checksum"
|
||||||
|
# load the values for json
|
||||||
|
jq_args+=( --arg "key$nr" "$abbreviation" )
|
||||||
|
jq_args+=( --arg "value$nr" "$fileHash" )
|
||||||
|
# build query for jq
|
||||||
|
jq_query+=" | .[\$key${nr}]=\$value${nr}"
|
||||||
|
#next
|
||||||
|
nr=$((nr+1))
|
||||||
|
# check if we have counter upto 98
|
||||||
|
if (("$counter" >= 98))
|
||||||
|
then
|
||||||
|
counter=70
|
||||||
|
fi
|
||||||
|
# add more
|
||||||
|
counter=$((counter+1))
|
||||||
|
# give notice
|
||||||
|
echo -e "XXX\n${counter}\nDone Hashing $abbreviation\nXXX"
|
||||||
|
done
|
||||||
|
|
||||||
|
# run the generated command with jq
|
||||||
|
jq "${jq_args[@]}" "$jq_query" <<<'{}' > "${target_folder}/checksum.json"
|
||||||
|
jq "${jq_t_args[@]}" "$jq_t_query" <<<'{}' > "${target_folder}/translations.json"
|
||||||
|
|
63
src/movePublicHashFiles.sh
Executable file
63
src/movePublicHashFiles.sh
Executable file
@ -0,0 +1,63 @@
|
|||||||
|
#! /bin/bash
|
||||||
|
|
||||||
|
# make sure we have at least one argument
|
||||||
|
if [ $# -eq 0 ]
|
||||||
|
then
|
||||||
|
echo >&2 "Target folder must be supplied. Aborting."
|
||||||
|
exit 1;
|
||||||
|
fi
|
||||||
|
|
||||||
|
# target folder
|
||||||
|
API_path="$1"
|
||||||
|
|
||||||
|
scripture_path="${API_path}_scripture"
|
||||||
|
hash_path="${API_path}"
|
||||||
|
|
||||||
|
# check if the target to folder exist
|
||||||
|
if [ -d "$hash_path" ]; then
|
||||||
|
# reset the git folder on each run
|
||||||
|
if [ -d "${hash_path}/.git" ]; then
|
||||||
|
mkdir -p "${hash_path}Tmp"
|
||||||
|
mv -f "${hash_path}/.git" "${hash_path}Tmp"
|
||||||
|
mv -f "${hash_path}/LICENSE" "${hash_path}Tmp"
|
||||||
|
mv -f "${hash_path}/README.md" "${hash_path}Tmp"
|
||||||
|
|
||||||
|
# now we remove all the old git files (so we start clean each time in the build)
|
||||||
|
rm -fr $hash_path
|
||||||
|
mv -f "${hash_path}Tmp" "${hash_path}"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
# make sure it is created
|
||||||
|
mkdir -p "$hash_path"
|
||||||
|
fi
|
||||||
|
|
||||||
|
## declare an array variable
|
||||||
|
declare -a arr=('*.sha' 'checksum' 'checksum.json' 'translations' 'translations.json' 'books' 'books.json' 'chapters' 'chapters.json')
|
||||||
|
|
||||||
|
## now loop through the above array
|
||||||
|
for key in "${arr[@]}"
|
||||||
|
do
|
||||||
|
# give notice
|
||||||
|
counter=0
|
||||||
|
echo -e "XXX\n$counter\nMoving all these type ($key) of files\nXXX"
|
||||||
|
sleep 1
|
||||||
|
find "$scripture_path" -type f -name "$key" -print0 | while IFS= read -r -d '' file; do
|
||||||
|
newFile=${file/$scripture_path/$hash_path}
|
||||||
|
newPath=$(dirname "${newFile}")
|
||||||
|
if [ ! -d "$newPath" ]; then
|
||||||
|
mkdir -p "$newPath"
|
||||||
|
fi
|
||||||
|
# copy the files there
|
||||||
|
cp --remove-destination "$file" "$newFile"
|
||||||
|
# check if we have counter up-to total
|
||||||
|
if (("$counter" >= 98))
|
||||||
|
then
|
||||||
|
counter=3
|
||||||
|
fi
|
||||||
|
# increment the counter
|
||||||
|
counter=$((counter+1))
|
||||||
|
# give notice
|
||||||
|
echo -e "XXX\n${counter}\nMoving $file\nXXX"
|
||||||
|
done
|
||||||
|
done
|
||||||
|
|
39
src/moveToGithub.sh
Executable file
39
src/moveToGithub.sh
Executable file
@ -0,0 +1,39 @@
|
|||||||
|
#! /bin/bash
|
||||||
|
|
||||||
|
# Do some prep work
|
||||||
|
command -v git >/dev/null 2>&1 || { echo >&2 "We require git for this script to run, but it's not installed. Aborting."; exit 1; }
|
||||||
|
|
||||||
|
# make sure we have at least one argument
|
||||||
|
if [ $# -eq 0 ]
|
||||||
|
then
|
||||||
|
echo >&2 "Target folder must be supplied. Aborting."
|
||||||
|
exit 1;
|
||||||
|
fi
|
||||||
|
|
||||||
|
# moving data to github
|
||||||
|
echo "[getBible.net] -- Move files in to github......"
|
||||||
|
|
||||||
|
# target folder
|
||||||
|
API_path="$1"
|
||||||
|
|
||||||
|
## declare an array variable
|
||||||
|
declare -a arr=("${API_path}_scripture" "${API_path}")
|
||||||
|
# now we loop over these folders
|
||||||
|
for path in "${arr[@]}"
|
||||||
|
do
|
||||||
|
# got to path
|
||||||
|
cd "${path}"
|
||||||
|
# we first check if there are changes
|
||||||
|
if [[ -z $(git status --porcelain) ]];
|
||||||
|
then
|
||||||
|
echo "Nothing to commit here"
|
||||||
|
else
|
||||||
|
# make sure all new files are added and others removed where needed
|
||||||
|
git add .
|
||||||
|
# now commit the bunch... this will take a while since its a very large repo
|
||||||
|
git commit -am "Update"
|
||||||
|
# now push changes up to github...
|
||||||
|
git push
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
204
src/sword_to_json.py
Normal file
204
src/sword_to_json.py
Normal file
@ -0,0 +1,204 @@
|
|||||||
|
|
||||||
|
import argparse
|
||||||
|
import json
|
||||||
|
import os
|
||||||
|
import requests
|
||||||
|
import sys
|
||||||
|
|
||||||
|
from pysword.modules import SwordModules
|
||||||
|
|
||||||
|
if sys.version_info > (3, 0):
|
||||||
|
from past.builtins import xrange
|
||||||
|
|
||||||
|
# get arguments
|
||||||
|
parser = argparse.ArgumentParser()
|
||||||
|
# get the arguments
|
||||||
|
parser.add_argument('--source_file')
|
||||||
|
parser.add_argument('--output_path')
|
||||||
|
parser.add_argument('--counter')
|
||||||
|
parser.add_argument('--next')
|
||||||
|
parser.add_argument('--conf_dir')
|
||||||
|
# set to args
|
||||||
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
# some helper dictionaries
|
||||||
|
v1_translation_names = json.loads(open(args.conf_dir + "/CrosswireModulesMap.json").read())
|
||||||
|
v1_translations = json.loads(open(args.conf_dir + "/v1Translations.json").read())
|
||||||
|
book_numbers = json.loads(open(args.conf_dir + "/bookNumbers.json").read())
|
||||||
|
book_names = json.loads(open(args.conf_dir + "/bookNames.json").read())
|
||||||
|
lang_correction = json.loads(open(args.conf_dir + "/langCorrection.json").read())
|
||||||
|
language_names = json.loads(open(args.conf_dir + "/languageNames.json").read())
|
||||||
|
text_direction = json.loads(open(args.conf_dir + "/textDirection.json").read())
|
||||||
|
|
||||||
|
# function to build Bible dictionaries
|
||||||
|
def get_bible_dict(source_file, bible_version, output_path, current_counter, next_counter):
|
||||||
|
# set some counter values
|
||||||
|
counter = int(current_counter)
|
||||||
|
current = int(current_counter)
|
||||||
|
next = int(next_counter)
|
||||||
|
# load the sword module
|
||||||
|
module = SwordModules(source_file)
|
||||||
|
# get the config
|
||||||
|
module_config = module.parse_modules()[bible_version]
|
||||||
|
# load the bible version
|
||||||
|
bible_mod = module.get_bible_from_module(bible_version)
|
||||||
|
# load the list of books per/testament
|
||||||
|
testaments = bible_mod.get_structure()._books
|
||||||
|
# merge the books
|
||||||
|
books = []
|
||||||
|
for testament in testaments:
|
||||||
|
books += testaments[testament]
|
||||||
|
# set the abbreviation
|
||||||
|
abbreviation = v1_translation_names.get(bible_version, bible_version.lower())
|
||||||
|
# get v1 Book Names (some are in the same language)
|
||||||
|
v1_book_names = {}
|
||||||
|
# check if this translations was in v1
|
||||||
|
if bible_version in v1_translation_names:
|
||||||
|
try:
|
||||||
|
v1_book_names = requests.get('https://getbible.net/v1/' + abbreviation + '/books.json').json()
|
||||||
|
except ValueError:
|
||||||
|
# no json found
|
||||||
|
v1_book_names = {}
|
||||||
|
# start to build the complete scripture of the translation
|
||||||
|
bible_ = {}
|
||||||
|
bible_['translation'] = v1_translations.get(abbreviation, module_config.get('description', bible_version))
|
||||||
|
bible_['abbreviation'] = abbreviation
|
||||||
|
bible_['discription'] = module_config.get('description', '')
|
||||||
|
# set language
|
||||||
|
lang_ = module_config.get('lang', '')
|
||||||
|
bible_['lang'] = lang_correction.get(lang_, lang_)
|
||||||
|
bible_['language'] = language_names.get(lang_, '')
|
||||||
|
bible_['direction'] = text_direction.get(lang_, 'LTR')
|
||||||
|
# not sure if this is relevant seeing that json.dump ensure_ascii=True
|
||||||
|
bible_['encoding'] = module_config.get('encoding', '')
|
||||||
|
# set global book
|
||||||
|
bible_book = {
|
||||||
|
'translation': bible_.get('translation'),
|
||||||
|
'abbreviation': abbreviation,
|
||||||
|
'lang': bible_.get('lang'),
|
||||||
|
'language': bible_.get('language'),
|
||||||
|
'direction': bible_.get('direction', 'LTR'),
|
||||||
|
'encoding': bible_.get('encoding')
|
||||||
|
}
|
||||||
|
# set global chapter
|
||||||
|
bible_chapter = {
|
||||||
|
'translation': bible_.get('translation'),
|
||||||
|
'abbreviation': abbreviation,
|
||||||
|
'lang': bible_.get('lang'),
|
||||||
|
'language': bible_.get('language'),
|
||||||
|
'direction': bible_.get('direction', 'LTR'),
|
||||||
|
'encoding': bible_.get('encoding')
|
||||||
|
}
|
||||||
|
# start building the books
|
||||||
|
bible_['books'] = []
|
||||||
|
for book in books:
|
||||||
|
# add the book only if it has verses
|
||||||
|
book_has_verses = False;
|
||||||
|
# reset chapter bucket
|
||||||
|
chapters = []
|
||||||
|
# set book number
|
||||||
|
book_nr = book_numbers.get(book.name)
|
||||||
|
# get book name as set in v1
|
||||||
|
book_name = v1_book_names.get(str(book_nr), {}).get('name', book_names.get(book.name, book.name))
|
||||||
|
# get book path
|
||||||
|
book_path = os.path.join(output_path, bible_.get('abbreviation'), str(book_nr))
|
||||||
|
# check if path is set
|
||||||
|
check_path(book_path)
|
||||||
|
# add the book only if it has verses
|
||||||
|
chapter_has_verses = False;
|
||||||
|
for chapter in xrange(1, book.num_chapters+1):
|
||||||
|
# reset verse bucket
|
||||||
|
verses = []
|
||||||
|
for verse in xrange(1, len(book.get_indicies(chapter))+1 ):
|
||||||
|
text = bible_mod.get(books=[book.name], chapters=[chapter], verses=[verse])
|
||||||
|
_text = text.replace('[]', '')
|
||||||
|
if len(text) > 0 and not _text.isspace():
|
||||||
|
book_has_verses = True;
|
||||||
|
chapter_has_verses = True;
|
||||||
|
verses.append({
|
||||||
|
'chapter': chapter,
|
||||||
|
'verse': verse,
|
||||||
|
'name': book_name + " " + str(chapter) + ":" + str(verse),
|
||||||
|
'text': text
|
||||||
|
})
|
||||||
|
if chapter_has_verses:
|
||||||
|
# load to complete Bible
|
||||||
|
chapters.append({
|
||||||
|
'chapter': chapter,
|
||||||
|
'name': book_name + " " + str(chapter),
|
||||||
|
'verses': verses
|
||||||
|
})
|
||||||
|
# set chapter
|
||||||
|
bible_chapter['book_nr'] = book_nr
|
||||||
|
bible_chapter['book_name'] = book_name
|
||||||
|
bible_chapter['chapter'] = chapter
|
||||||
|
bible_chapter['name'] = book_name + " " + str(chapter)
|
||||||
|
bible_chapter['verses'] = verses
|
||||||
|
# store to chapter file
|
||||||
|
write_json(bible_chapter, os.path.join(book_path, str(chapter) + '.json'))
|
||||||
|
print('XXX\n{}\nChapter {} was added to {}-{}\nXXX'.format(counter, chapter, book_name, abbreviation))
|
||||||
|
counter = increment_counter(counter, next, current)
|
||||||
|
if book_has_verses:
|
||||||
|
# load to complete Bible
|
||||||
|
bible_['books'].append({
|
||||||
|
'nr': book_nr,
|
||||||
|
'name': book_name,
|
||||||
|
'chapters': chapters
|
||||||
|
})
|
||||||
|
# set book
|
||||||
|
bible_book['nr'] = book_nr
|
||||||
|
bible_book['name'] = book_name
|
||||||
|
bible_book['chapters'] = chapters
|
||||||
|
# store to book file
|
||||||
|
write_json(bible_book, book_path + '.json')
|
||||||
|
print('XXX\n{}\nBook ({}) was added to {}\nXXX'.format(counter, book_name, abbreviation))
|
||||||
|
counter = increment_counter(counter, next, current)
|
||||||
|
# add distribution info
|
||||||
|
bible_['distribution_lcsh'] = module_config.get('lcsh', '')
|
||||||
|
bible_['distribution_version'] = module_config.get('version', '')
|
||||||
|
bible_['distribution_version_date'] = module_config.get('SwordVersionDate', module_config.get('swordversiondate', ''))
|
||||||
|
bible_['distribution_abbreviation'] = module_config.get('abbreviation', abbreviation)
|
||||||
|
bible_['distribution_about'] = module_config.get('about', '')
|
||||||
|
bible_['distribution_license'] = module_config.get('distributionlicense', '')
|
||||||
|
bible_['distribution_sourcetype'] = module_config.get('sourcetype', '')
|
||||||
|
bible_['distribution_source'] = module_config.get('textsource', '')
|
||||||
|
bible_['distribution_versification'] = module_config.get('versification', '')
|
||||||
|
|
||||||
|
# load the distribution history
|
||||||
|
bible_['distribution_history'] = {}
|
||||||
|
for k,v in module_config.items():
|
||||||
|
if 'history' in k:
|
||||||
|
bible_['distribution_history'][k] = v
|
||||||
|
|
||||||
|
return bible_
|
||||||
|
|
||||||
|
# function to safe the json file output
|
||||||
|
def write_json(bible_dict, output_file):
|
||||||
|
with open(output_file, 'w') as outfile:
|
||||||
|
json.dump(bible_dict, outfile, indent=4)
|
||||||
|
|
||||||
|
# function to create path if not exist
|
||||||
|
def check_path(path):
|
||||||
|
if not os.path.isdir(path):
|
||||||
|
os.makedirs(path)
|
||||||
|
|
||||||
|
# function to manange increment of counter
|
||||||
|
def increment_counter(counter, next, current):
|
||||||
|
if counter >= next:
|
||||||
|
return int(current)
|
||||||
|
return counter + 1
|
||||||
|
|
||||||
|
# customary main function
|
||||||
|
def main():
|
||||||
|
# check if books directory exist
|
||||||
|
check_path(args.output_path)
|
||||||
|
# get version name from source file
|
||||||
|
bible_version = args.source_file.replace(".zip", "").rsplit('/', 1)[-1]
|
||||||
|
# get the all the scripture of this Bible
|
||||||
|
bible_dict = get_bible_dict(args.source_file, bible_version, args.output_path, args.counter, args.next)
|
||||||
|
# set the correct file name to match v1 if found
|
||||||
|
version_file_name = v1_translation_names.get(bible_version, bible_version.lower()) + '.json'
|
||||||
|
# save to json
|
||||||
|
write_json(bible_dict, os.path.join(args.output_path, version_file_name))
|
||||||
|
|
||||||
|
if __name__ == "__main__": main()
|
28
src/sword_to_json_LICENSE
Normal file
28
src/sword_to_json_LICENSE
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
BSD 2-Clause License
|
||||||
|
|
||||||
|
Copyright (c) 2017, Jake Wasdin
|
||||||
|
Copyright (c) 2018, Llewellyn van der Merwe
|
||||||
|
All rights reserved.
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
modification, are permitted provided that the following conditions are met:
|
||||||
|
|
||||||
|
* Redistributions of source code must retain the above copyright notice, this
|
||||||
|
list of conditions and the following disclaimer.
|
||||||
|
|
||||||
|
* Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
this list of conditions and the following disclaimer in the documentation
|
||||||
|
and/or other materials provided with the distribution.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||||
|
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
|
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||||
|
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||||
|
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||||
|
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
|
@ -1,56 +0,0 @@
|
|||||||
from pysword.modules import SwordModules
|
|
||||||
import argparse, json, sys
|
|
||||||
|
|
||||||
if sys.version_info > (3, 0):
|
|
||||||
from past.builtins import xrange
|
|
||||||
|
|
||||||
|
|
||||||
def generate_dict(source_file, bible_version):
|
|
||||||
modules = SwordModules(source_file)
|
|
||||||
found_modules = modules.parse_modules()
|
|
||||||
bible = modules.get_bible_from_module(bible_version)
|
|
||||||
|
|
||||||
books = bible.get_structure()._books['ot'] + bible.get_structure()._books['nt']
|
|
||||||
|
|
||||||
bib = {}
|
|
||||||
bib['books'] = []
|
|
||||||
|
|
||||||
for book in books:
|
|
||||||
chapters = []
|
|
||||||
for chapter in xrange(1, book.num_chapters+1):
|
|
||||||
verses = []
|
|
||||||
for verse in xrange(1, len(book.get_indicies(chapter))+1 ):
|
|
||||||
verses.append({
|
|
||||||
'verse': verse,
|
|
||||||
'chapter': chapter,
|
|
||||||
'name': book.name + " " + str(chapter) + ":" + str(verse),
|
|
||||||
'text': bible.get(books=[book.name], chapters=[chapter], verses=[verse])
|
|
||||||
})
|
|
||||||
chapters.append({
|
|
||||||
'chapter': chapter,
|
|
||||||
'name': book.name + " " + str(chapter),
|
|
||||||
'verses': verses
|
|
||||||
})
|
|
||||||
bib['books'].append({
|
|
||||||
'name': book.name,
|
|
||||||
'chapters': chapters
|
|
||||||
})
|
|
||||||
|
|
||||||
return bib
|
|
||||||
|
|
||||||
def write_json(bible_dict, output_file):
|
|
||||||
with open(output_file, 'w') as outfile:
|
|
||||||
json.dump(bible_dict, outfile)
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
|
||||||
parser = argparse.ArgumentParser()
|
|
||||||
parser.add_argument('--source_file')
|
|
||||||
parser.add_argument('--bible_version')
|
|
||||||
parser.add_argument('--output_file')
|
|
||||||
args = parser.parse_args()
|
|
||||||
|
|
||||||
bible_dict = generate_dict(args.source_file, args.bible_version)
|
|
||||||
write_json(bible_dict, args.output_file)
|
|
||||||
|
|
||||||
if __name__ == "__main__": main()
|
|
Loading…
Reference in New Issue
Block a user