Initial commit

This commit is contained in:
Christoph Stahl 2025-04-09 21:35:02 +02:00
commit e28265ed2a
19 changed files with 5073 additions and 0 deletions

674
LICENSE Normal file
View file

@ -0,0 +1,674 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
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>.

7
README.md Normal file
View file

@ -0,0 +1,7 @@
# mkoldproxy
Generate proxy images for Magic the gathering cards.
# License
This software is licensed under the GNU General Public License Version 3 (See LICENSE)

73
mkoldproxy/art.py Normal file
View file

@ -0,0 +1,73 @@
import re
from .mtgpics_overrides import (
set_override,
cn_set_override,
override_pic,
cn_override,
)
from .cache_url import get
def find_mtgpic_link(set_name: str, cn: int, backside: bool) -> str:
set_name, cn = (
cn_set_override[(set_name, cn)]
if (set_name, cn) in cn_set_override
else (set_name, cn)
)
set_name = set_override[set_name] if set_name in set_override else set_name
cn = (
cn_override[set_name][cn]
if set_name in cn_override and cn in cn_override[set_name]
else cn
)
mtgpic_r = get(f"https://www.mtgpics.com/card?ref={set_name}{cn:03d}")
content = mtgpic_r.content.decode("iso-8859-1").splitlines()
illus_id = ""
for c in content:
res = re.findall(r"""onclick="LoadIllus..([0-9]*)""", c)
if res:
if len(res) > 1 and backside:
illus_id = res[1]
else:
illus_id = res[0]
if illus_id == "":
raise RuntimeError()
illuspage = get(f"https://www.mtgpics.com/load_illus?i={illus_id}")
content = illuspage.content.decode("iso-8859-1").splitlines()
for c in content:
res = re.match(r"<img src=([^>]*)>", c)
if res is not None:
pic = (
override_pic[res.group(1)]
if res.group(1) in override_pic
else res.group(1)
)
return f"https://www.mtgpics.com/{pic}"
return ""
def find_artwork(
set_name: str, cn_: str, backup_url: str, backside: bool = False
) -> str:
cn = int("".join(c for c in cn_ if c in "0123456789"))
# crop = False
try:
url = find_mtgpic_link(set_name, cn, backside)
# crop = True
# pics_result = get(url)
except RuntimeError:
print(f"Scryfall backup for {set_name} {cn}")
url = backup_url
# pics_result = get(backup_url)
# crop = False
# img = Image.open(BytesIO(pics_result.content))
# if crop:
# # cut off bottom ~6 percent
# height = img.height
# img = img.crop((0, 0, img.width, int(height * 0.94)))
return url

65
mkoldproxy/cache_url.py Normal file
View file

@ -0,0 +1,65 @@
import sqlite3
from typing import Optional
import requests
import json
from requests.models import Response
class Cache:
def __init__(self, sqlite_file: str, threading: bool = False):
self.sqlite_file = sqlite_file
self.threading = threading
self.init = False
if not threading:
self.conn = sqlite3.connect(sqlite_file)
self.conn.execute(
"CREATE TABLE IF NOT EXISTS cache (url TEXT PRIMARY KEY, headers TEXT, status_code INTEGER, content BLOB)"
)
self.init = True
def get(self, url) -> Response:
if self.threading:
conn = sqlite3.connect(self.sqlite_file)
else:
conn = self.conn
cursor = conn.cursor()
cursor.execute(
"SELECT headers, status_code, content FROM cache WHERE url = ?", (url,)
)
row = cursor.fetchone()
cursor.close()
if row is None:
response = requests.get(url)
headers = json.dumps(dict(response.headers))
content = response.content
status_code = response.status_code
conn.execute(
"INSERT INTO cache (url, headers, status_code, content) VALUES (?, ?, ?, ?)",
(url, headers, status_code, content),
)
conn.commit()
else:
response = Response()
response._content = row[2]
response.status_code = row[1]
response.headers = json.loads(row[0])
return response
__cache__ = None
def get_cache(sqlite_file: Optional[str] = None, threading: bool = False) -> Cache:
global __cache__
if __cache__ is None:
if sqlite_file is None:
sqlite_file = ":memory:"
__cache__ = Cache(sqlite_file, threading)
return __cache__
def get(url: str) -> Response:
return get_cache().get(url)

107
mkoldproxy/datatypes.py Normal file
View file

@ -0,0 +1,107 @@
from __future__ import annotations
from typing import Any, Literal, Optional, TypeAlias
from dataclasses import dataclass, field
from PIL import Image
@dataclass
class ArtInfo:
url: Optional[str]
# anchor: Literal["top", "left", "top-left"] = "top"
x_perc_offset: Optional[float] = None
y_perc_offset: Optional[float] = None
zoom: Optional[float] = None
image: Optional[Image.Image] = None
def merge(self, other: "ArtInfo"):
if self.url is None:
self.url = other.url
if self.x_perc_offset is None:
self.x_perc_offset = other.x_perc_offset
if self.y_perc_offset is None:
self.y_perc_offset = other.y_perc_offset
if self.zoom is None:
self.zoom = other.zoom
if self.image is None:
self.image = other.image
@dataclass
class Face:
name: str
mana_cost: str
colors: list[str]
type_line: str
supertypes: list[str]
types: list[str]
subtypes: list[str]
oracle_text: list[str]
flavor_text: Optional[str]
img: ArtInfo
artist: str
border_color: str
produces: Optional[str]
power: Optional[str]
toughness: Optional[str]
loyalty: Optional[str]
color_indicator: Optional[str]
layout: Optional[str]
textless: bool
@dataclass
class Card:
rarity: str
set: str
cn: str
cn_int: int
cn_add: str
layout: str
faces: list[Face]
BBox: TypeAlias = tuple[int, int, int, int]
@dataclass
class Frame:
images: dict[str, str]
art_box: Optional[BBox] = field(default=None)
title_box: Optional[BBox] = field(default=None)
mana_box: Optional[BBox] = field(default=None)
type_box: Optional[BBox] = field(default=None)
rules_box: Optional[BBox] = field(default=None)
pt_box: Optional[BBox] = field(default=None)
set_symbol_box: Optional[BBox] = field(default=None)
artist_box: Optional[BBox] = field(default=None)
copyright_box: Optional[BBox] = field(default=None)
@dataclass
class Dimensions:
art_box: BBox
title_box: BBox
title_left_box: BBox
title_right_box: BBox
mana_box: BBox
type_box: BBox
rules_boxes: list[BBox]
pt_box: BBox
set_symbol_box: BBox
artist_box: BBox
copyright_box: BBox
mdfc_box: BBox
title_box2: BBox
mana_box2: BBox
type_box2: BBox
proxy_box: BBox
@classmethod
def load(cls, data: dict[str, Any]) -> Dimensions:
dimensions: dict[str, Any] = {
entry: tuple(box) if isinstance(box, list) else list(map(tuple, box))
for entry, box in data.items()
}
return cls(**dimensions)

287
mkoldproxy/deck.py Normal file
View file

@ -0,0 +1,287 @@
import csv
import argparse
import concurrent.futures
from dataclasses import dataclass
import os
from typing import Literal, Optional, cast
from PIL import Image
from .style import Style
from .mkpdf import mkpdf # Import the mkpdf function
from .scryfall_api import get_card # Import the makecard function
from .datatypes import ArtInfo
from functools import partial
from .cache_url import get_cache
@dataclass
class GenerationResult:
rownr: int
copies: int
card: list[str] | list[Image.Image]
@dataclass
class XMLCard:
id: str
slots: list[int]
def to_xml(self) -> str:
return f""" <card>
<id>{os.path.abspath(self.id)}</id>
<slots>{",".join([str(slot) for slot in self.slots])}</slots>
</card>"""
def generate_card_images(
style: Style,
output_path: str,
mode: Literal["pdf", "folder", "xml"],
cache: Optional[str],
firstprint: bool,
input: tuple[int, list[str]],
) -> GenerationResult:
"""Helper function to generate images for a single row using makecard."""
get_cache(cache, True)
index, row = input
amount = int(row[0]) # Number of copies of the card
query = row[1] + (" is:firstprint" if firstprint else "")
art1_url = row[2] if row[2] else None # URL for first artwork, if provided
art2_url = row[3] if row[3] else None # URL for second artwork, if provided
art1_xoffset = float(row[6]) if row[6] else None
art1_yoffset = float(row[7]) if row[7] else None
art1_zoom = float(row[8]) if row[8] else None
art2_xoffset = float(row[9]) if row[9] else None
art2_yoffset = float(row[10]) if row[10] else None
art2_zoom = float(row[11]) if row[11] else None
art1 = ArtInfo(
url=art1_url,
x_perc_offset=art1_xoffset,
y_perc_offset=art1_yoffset,
zoom=art1_zoom,
)
art2 = ArtInfo(
url=art2_url,
x_perc_offset=art2_xoffset,
y_perc_offset=art2_yoffset,
zoom=art2_zoom,
)
style = (
Style.load(row[4], style.add_bleed) if row[4] else style
) # Resource pack, default if blank
# Call makecard once to generate the card images
# print(f"Generating images for: {query}")
try:
print(f"Generating images for: {query}")
try:
card = get_card(query, art1, art2)
print("Generated")
except KeyError:
from traceback import format_exc
from sys import stderr
print(format_exc(), file=stderr)
print(f"Error: Card '{query}' not found.")
exit(1)
# if mode == "folder":
# filename = f"{output_path}/{card.set}{card.cn_int:03d}{card.cn_add}.png"
# if os.path.exists(filename):
# print(f"Skipping {card.set}{card.cn_int:03d}{card.cn_add}")
# return GenerationResult(index, amount, [filename])
try:
generated_images = style.render_card(card)
except ValueError:
from traceback import format_exc
from sys import stderr
print(format_exc(), file=stderr)
print(f"Error: Card '{query}' could not be rendered.")
exit(1)
except Exception as e:
print(f"Error generating images for '{query}': {e}")
exit(1)
# Duplicate images based on the amount specified
# print(f"Generated {len(generated_images)} images for '{query}'")
if mode == "pdf":
return GenerationResult(index, amount, generated_images)
else:
print(f"Saving {card.faces[0].name} to {output_path}")
files = []
if len(generated_images) > 1:
for i, image in enumerate(generated_images):
image.save(
f"{output_path}/{card.set}{card.cn_int:03d}{card.cn_add}_{i}.png"
)
files.append(
f"{output_path}/{card.set}{card.cn_int:03d}{card.cn_add}_{i}.png"
)
else:
generated_images[0].save(
f"{output_path}/{card.set}{card.cn_int:03d}{card.cn_add}.png"
)
files.append(f"{output_path}/{card.set}{card.cn_int:03d}{card.cn_add}.png")
return GenerationResult(index, amount, files)
def process_csv_and_generate_output(
csv_file_path: str,
style: Style,
mode: Literal["pdf", "folder", "xml"],
output_path: str = "output",
num_processes: Optional[int] = None,
cache: Optional[str] = None,
firstprint: bool = True,
) -> None:
"""Reads the CSV file, generates card images in parallel, and saves them as a PDF."""
MAX_COLS = 12
all_images = []
# Read the CSV file and prepare rows for processing
with open(csv_file_path, mode="r", newline="", encoding="utf-8") as csvfile:
reader = csv.reader(csvfile, delimiter=";")
rows = list(reader) # Collect rows for processing
for row in rows:
if len(row) < MAX_COLS:
row.extend(
[""] * (MAX_COLS - len(row))
) # Fill missing columns with empty strings
# Use ProcessPoolExecutor to parallelize makecard calls with configurable max_workers
if mode == "folder":
os.makedirs(output_path, exist_ok=True)
with concurrent.futures.ThreadPoolExecutor(max_workers=num_processes) as executor:
# Map each row to generate_card_images function in parallel
results = list(
executor.map(
partial(
generate_card_images,
style,
output_path,
mode,
cache,
firstprint,
),
enumerate(rows),
)
)
# for row in rows:
# results.append(generate_card_images(style, row))
# Flatten the list of lists of images
for result in results:
if len(result.card) > 0 and isinstance(result.card[0], Image.Image):
all_images.extend(result.card * result.copies)
# print(f"Generated {len(all_images)} card images.")
if mode == "pdf":
# Generate the PDF from the collected images
print("Generating PDF file.")
mkpdf(all_images, output_path)
elif mode == "folder":
print("Generating XML file.")
quantity = sum([result.copies for result in results])
all_bracket = [
18,
36,
55,
72,
90,
108,
126,
144,
162,
180,
198,
216,
234,
396,
504,
612,
]
best_bracket = [i for i in all_bracket if i >= quantity][0]
start = f"""<order>
<details>
<quantity>{quantity}</quantity>
<bracket>{best_bracket}</bracket>
<stock>(S30) Standard Smooth</stock>
<foil>false</foil>
</details>
"""
front_cards = []
back_cards = []
next_slot = 0
for card in results:
slots = list(range(next_slot, next_slot + card.copies))
next_slot += card.copies
card.card = cast(list[str], card.card)
front_cards.append(XMLCard(card.card[0], slots))
if len(card.card) > 1:
back_cards.append(XMLCard(card.card[1], slots))
fronts = (
" <fronts>\n"
+ "\n".join([card.to_xml() for card in front_cards])
+ "\n </fronts>"
)
if len(back_cards) > 0:
backs = (
" <backs>\n"
+ "\n".join([card.to_xml() for card in back_cards])
+ "\n </backs>"
)
else:
backs = ""
end = "\n <cardback>1LrVX0pUcye9n_0RtaDNVl2xPrQgn7CYf</cardback>\n</order>"
xml = start + fronts + backs + end
with open(output_path + "/deck.xml", "w") as f:
f.write(xml)
def main():
# Set up argument parser for command-line arguments
parser = argparse.ArgumentParser(
description="Generate a PDF of card images from a CSV file."
)
parser.add_argument("csv_file", help="Path to the input CSV file.")
parser.add_argument(
"--pdf", action="store_true", help="Generate PDF file.", default=False
)
parser.add_argument(
"-o",
"--output",
default="output",
help="Path to the output PDF file or folder (default: output).",
)
parser.add_argument(
"-p",
"--processes",
type=int,
default=None,
help="Number of parallel processes to use (default: number of CPU cores).",
)
parser.add_argument("-c", "--cache", default=None)
# Parse the arguments
args = parser.parse_args()
# Call the main processing function with parsed arguments
process_csv_and_generate_output(
args.csv_file, args.pdf, args.output, args.processes, args.cache
)
if __name__ == "__main__":
main()

118
mkoldproxy/main.py Normal file
View file

@ -0,0 +1,118 @@
from __future__ import annotations
from argparse import ArgumentParser
import json
from .style import Style
from .datatypes import ArtInfo
from .scryfall_api import get_card
from .cache_url import get_cache
from .deck import process_csv_and_generate_output
def main():
# card = get_card("Murktide Regent")
parser = ArgumentParser()
parser.add_argument("--resource-pack", "-R", default="resource_pack.zip")
parser.add_argument("--cache", "-c", default=None)
parser.add_argument("--add_bleed", "-b", action="store_true")
modeparser = parser.add_subparsers(dest="mode", required=True)
cardparser = modeparser.add_parser("card")
cardparser.add_argument("--art1-url")
cardparser.add_argument("--art2-url")
cardparser.add_argument("--art1-x", type=float, default=None)
cardparser.add_argument("--art1-y", type=float, default=None)
cardparser.add_argument("--art1-zoom", type=float, default=None)
cardparser.add_argument("--art2-x", type=float, default=None)
cardparser.add_argument("--art2-y", type=float, default=None)
cardparser.add_argument("--art2-zoom", type=float, default=None)
output_group = cardparser.add_mutually_exclusive_group(required=True)
output_group.add_argument("--save", "-s", action="store_true")
output_group.add_argument("--display", "-d", action="store_true")
input_group = cardparser.add_mutually_exclusive_group(required=True)
input_group.add_argument("--query", "-q")
input_group.add_argument("--json", "-j")
deckparser = modeparser.add_parser("deck")
deckparser.add_argument("--firstprint", "-f", action="store_true")
deckparser.add_argument("--process", "-p", type=int, default=None)
deckparser.add_argument(
"--type", "-t", type=str, choices=["pdf", "folder"], default="folder"
)
deckparser.add_argument("--output", "-o", type=str, required=True)
deckparser.add_argument("csv_file")
args = parser.parse_args()
style = Style.load(args.resource_pack, add_bleed=args.add_bleed)
if args.mode == "card":
querystr = args.query
query = args.query
if args.json:
querystr = args.json
with open(args.json) as f:
query = json.load(f)
cache = get_cache(args.cache)
art1 = ArtInfo(
args.art1_url,
x_perc_offset=args.art1_x,
y_perc_offset=args.art1_y,
zoom=args.art1_zoom,
)
art2 = ArtInfo(
args.art2_url,
x_perc_offset=args.art2_x,
y_perc_offset=args.art2_y,
zoom=args.art2_zoom,
)
try:
card = get_card(query, art1=art1, art2=art2)
except KeyError:
# import traceback
from traceback import format_exc
from sys import stderr
print(format_exc(), file=stderr)
print(f"Could not render card {querystr}", file=stderr)
exit(1)
images = style.render_card(card)
for n, image in enumerate(images):
if args.display:
image.show()
else:
suffix = f"_{n}" if len(images) > 1 else ""
filename = f"{card.set}{card.cn_int:03d}{card.cn_add}{suffix}.png"
image.save(filename)
elif args.mode == "deck":
process_csv_and_generate_output(
args.csv_file,
style,
args.type,
args.output,
args.process,
args.cache,
args.firstprint,
)
# old_frame = Style.load(args.resource_pack)
#
# cards = [
# get_card(query, art1=args.art1_url, art2=args.art2_url) for query in queries
# ]
# for card in cards:
# images = old_frame.render_card(card, args.resource_pack)
# for n, image in enumerate(images):
# if args.folder is not None:
# image.save(
# f"{args.folder}/{card.faces[n].name}-{card.set}-{card.cn}.png"
# )
# else:
# image.show()
if __name__ == "__main__":
main()

439
mkoldproxy/makeborders.py Normal file
View file

@ -0,0 +1,439 @@
from __future__ import annotations
from dataclasses import dataclass
from json import load
import sys
from typing import Any, Literal, Optional
from zipfile import ZipFile
from PIL import Image, ImageOps
from .scryfall_api import get_card
from .datatypes import ArtInfo, BBox, Card, Face
from .merge import merge, overlay
@dataclass
class Borders:
lands: dict[str, Image.Image]
saga: dict[str, Image.Image]
default: dict[str, Image.Image]
token: dict[str, Image.Image]
token_textless: dict[str, Image.Image]
backs: dict[str, Image.Image]
@classmethod
def load(cls, archive: ZipFile, stylefile: dict[str, Any]) -> Borders:
card_styles = stylefile["dimensions"]
borders = {card_style: {} for card_style in card_styles}
lands = {}
# saga = {}
# default = {}
backs = {}
l_colors = ["w", "u", "b", "r", "g", "l"]
l_files = ["box", "lines"]
for color in l_colors:
for file in l_files:
with archive.open(f"borders/land/{color}_{file}.png") as imgdata:
image = Image.open(imgdata)
image.load()
lands[f"{color}_{file}"] = image
with archive.open("borders/land/l_back.png") as l_back:
lands["l_back"] = Image.open(l_back)
lands["l_back"].load()
s_colors = ["w", "u", "b", "r", "g", "l"]
for color in s_colors:
with archive.open(f"borders/saga/{color}_saga.png") as imgdata:
borders["saga"][color] = Image.open(imgdata)
borders["saga"][color].load()
f_colors = ["w", "u", "b", "r", "g", "a", "c", "m"]
with archive.open("borders/default/outline.png") as imgdata:
borders["default"]["outline"] = Image.open(imgdata)
borders["default"]["outline"].load()
with archive.open("borders/default/leveler_shadow.png") as imgdata:
borders["default"]["leveler_shadow"] = Image.open(imgdata)
borders["default"]["leveler_shadow"].load()
with archive.open("borders/token/l.png") as imgdata:
borders["token"]["l"] = Image.open(imgdata)
borders["token"]["l"].load()
with archive.open("borders/token/l_textless.png") as imgdata:
borders["token_textless"]["l"] = Image.open(imgdata)
borders["token_textless"]["l"].load()
for color in f_colors:
try:
with archive.open(f"borders/token/{color}_textless.png") as imgdata:
borders["token_textless"][color] = Image.open(imgdata)
borders["token_textless"][color].load()
except KeyError:
print(f"Token border for {color} not found")
with archive.open(f"borders/token/{color}.png") as imgdata:
borders["token"][color] = Image.open(imgdata)
borders["token"][color].load()
with archive.open(f"borders/{color}.png") as imgdata:
backs[color] = Image.open(imgdata)
backs[color].load()
with archive.open(f"borders/default/{color}_box.png") as imgdata:
borders["default"][f"{color}_box"] = Image.open(imgdata)
borders["default"][f"{color}_box"].load()
with archive.open(f"borders/default/{color}_mdfc.png") as imgdata:
borders["default"][f"{color}_mdfc"] = Image.open(imgdata)
borders["default"][f"{color}_mdfc"].load()
with archive.open(f"borders/default/{color}_adv_left.png") as imgdata:
borders["default"][f"{color}_adv_left"] = Image.open(imgdata)
borders["default"][f"{color}_adv_left"].load()
with archive.open(f"borders/default/{color}_adv_right.png") as imgdata:
borders["default"][f"{color}_adv_right"] = Image.open(imgdata)
borders["default"][f"{color}_adv_right"].load()
return cls(
lands=lands,
saga=borders["saga"],
default=borders["default"],
token=borders["token"],
token_textless=borders["token_textless"],
backs=backs,
)
# def multi_land(self, colors: str) -> Image.Image:
# print(f"Multi colored land ({len(colors)})")
# return Image.open(get_border_resource("l.png"))
#
#
# def default_land(style: Style) -> Image.Image:
# print("Default land")
# return Image.open(get_border_resource("l.png"))
def merge_border_colors(self, colors: str) -> Image.Image:
print(f"Dual colored land ({colors})")
left_box = self.lands[f"{colors[0].lower()}_box"]
right_box = self.lands[f"{colors[1].lower()}_box"]
box = merge(left_box, right_box)
bg = self.lands["l_back"]
lines = self.lands["l_lines"]
bg.alpha_composite(lines)
bg.alpha_composite(box)
return bg
def adjust_crop(self, bbox: BBox, border_size: int) -> BBox:
return (
bbox[0] + border_size,
bbox[1] + border_size,
bbox[2] - border_size,
bbox[3] - border_size,
)
def merge_border_colors_dual(self, colors: str) -> Image.Image:
print(f"Dual colored land ({colors}) OG Dual")
left_box = self.lands[f"{colors[0].lower()}_box"]
right_box = self.lands[f"{colors[1].lower()}_box"]
left_bbox = left_box.getbbox(alpha_only=True)
if left_bbox is None:
left_bbox = (0, 0, left_box.width, left_box.height)
box = merge(left_box, right_box)
border_size = 20
slice_size = 34
boxes = [right_box, left_box]
iterations = 8
for i in range(iterations):
box.alpha_composite(
boxes[i % 2].crop(self.adjust_crop(left_bbox, border_size)),
(
left_bbox[0] + border_size,
left_bbox[1] + border_size,
),
)
border_size += slice_size
bg = self.lands["l_back"]
lines = self.lands["l_lines"]
bg.alpha_composite(lines)
bg.alpha_composite(box)
return bg
def single_color_land(self, color: str) -> Image.Image:
print(f"Sinlgle colored land ({color})")
box = self.lands[f"{color.lower()}_box"]
bg = self.lands["l_back"]
lines = self.lands["l_lines"]
bg.alpha_composite(lines)
bg.alpha_composite(box)
return bg
def get_land_border(self, face: Face) -> Image.Image:
colors = face.border_color
if colors is None or len(colors) > 2 or colors.lower() == "c":
return self.single_color_land("l")
elif len(colors) == 2:
if face.name in [
"Badlands",
"Bayou",
"Plateau",
"Savannah",
"Scrubland",
"Taiga",
"Tropical Island",
"Tundra",
"Underground Sea",
"Volcanic Island",
]:
if face.name in ["Bayou", "Plateau", "Savannah", "Taiga", "Thundra"]:
colors = colors[::-1]
return self.merge_border_colors_dual(colors)
return self.merge_border_colors(colors)
elif len(colors) == 1:
return self.single_color_land(colors)
return self.single_color_land("l")
# def get_artifact_border(self, face: Face) -> Image.Image:
# if face.border_color.lower() == "c":
# return self.default["a"]
# else:
# color_border = self.get_default_border(face)
# artifact_back = self.default["a"]
# artifact_box = self.default["a_box"]
#
# back = overlay(artifact_back, color_border)
# back.alpha_composite(artifact_box)
# return back
def merge_hybrid_saga(self, colors: str) -> Image.Image:
print(f"Dual colored hybrid card ({colors})")
left = self.saga[colors[0].lower()]
right = self.saga[colors[1].lower()]
return merge(left, right)
def merge_hybrid(self, colors: list[str]) -> Image.Image:
left = self.get_back(colors[0], False)
right = self.get_back(colors[1], False)
return merge(left, right)
def get_plain_border(self, face: Face) -> Image.Image:
colors = "".join(face.border_color)
if len(colors) == 0:
return self.default["c_back"]
if len(colors) == 1:
return self.default[f"{colors.lower()}_back"]
if len(colors) == 2 and "/" in face.mana_cost or face.mana_cost == "":
return self.merge_hybrid([f"{color}_back" for color in colors])
else:
return self.default["m_back"]
def get_single_color(self, face: Face) -> str:
colors = "".join(face.border_color)
if len(colors) == 0:
return "c"
if len(colors) == 1:
return colors.lower()
if len(colors) == 2 and "/" in face.mana_cost or face.mana_cost == "":
return f"h{colors.lower()}"
else:
return "m"
def get_back(self, color: str, is_artifact: bool) -> Image.Image:
if color[0] == "h":
left = self.get_back(color[1], False)
right = self.get_back(color[2], False)
back = merge(left, right)
else:
back = self.backs[color]
if is_artifact:
if color == "c":
back = self.backs["a"]
else:
back = overlay(self.backs["a"], back)
return back
def get_default_box(
self, color: str, is_artifact: bool, is_leveler: bool
) -> Image.Image:
if is_artifact:
box = self.default["a_box"].copy()
elif color[0] == "h":
left = self.get_default_box(color[1], is_artifact, is_leveler)
right = self.get_default_box(color[2], is_artifact, is_leveler)
box = merge(left, right)
else:
box = self.default[f"{color}_box"].copy()
if is_leveler:
box_as_mask = ImageOps.invert(box.getchannel("A"))
empty_image = Image.new("RGBA", box.size, (0, 0, 0, 0))
shadow_image = self.default["leveler_shadow"]
shadow = Image.composite(empty_image, shadow_image, box_as_mask)
box.alpha_composite(shadow)
return box
def get_adventure_box(
self, color_left: str, color_right: str, is_artifact: bool
) -> Image.Image:
left_box = self.get_adventure_side(color_left, "left", False).copy()
right_box = self.get_adventure_side(color_right, "right", is_artifact)
left_box.alpha_composite(right_box)
return left_box
def get_default_border(self, face: Face) -> Image.Image:
color = self.get_single_color(face)
is_artifact = "Artifact" in face.types
is_leveler = "leveler" == face.layout
back = self.get_back(color, is_artifact).copy()
if is_artifact:
color = "a"
box = self.get_default_box(color, is_artifact, is_leveler)
outline = self.default["outline"]
back.alpha_composite(outline)
back.alpha_composite(box)
return back
def get_color_token_border(
self, color: str, is_artifact: bool, is_textless: bool
) -> Image.Image:
borders = self.token_textless if is_textless else self.token
if color[0] == "h":
left = self.get_color_token_border(color[1], False, is_textless)
right = self.get_color_token_border(color[2], False, is_textless)
border = merge(left, right)
else:
border = borders[color]
if is_artifact:
if color == "c":
border = borders["a"]
else:
border = overlay(borders["a"], border)
return border
def get_token_border(self, face: Face) -> Image.Image:
if "Land" in face.types:
color = "l"
else:
color = self.get_single_color(face)
is_artifact = "Artifact" in face.types
return self.get_color_token_border(color, is_artifact, face.textless)
def get_mdfc_badge(self, back: Face) -> Image.Image:
if "Land" in back.types:
colors = back.produces if back.produces is not None else []
else:
colors = back.colors
if len(colors) > 1:
color = "M"
else:
color = colors[0]
if "Artifact" in back.types:
if color == "C":
return self.default["a_mdfc"]
else:
color_mdfc = self.default[f"{color.lower()}_mdfc"]
artifact_mdfc = self.default["a_mdfc"]
return overlay(artifact_mdfc, color_mdfc)
return self.default[f"{color.lower()}_mdfc"]
def get_adventure_side(
self, color: str, side: Literal["left", "right"], is_artifact
) -> Image.Image:
if is_artifact:
return self.default[f"a_adv_{side}"]
if color[0] == "h":
left = self.get_adventure_side(color[1], side, is_artifact)
right = self.get_adventure_side(color[2], side, is_artifact)
return merge(left, right)
return self.default[f"{color.lower()}_adv_{side}"]
def get_saga_border(self, face: Face) -> Image.Image:
colors = "".join(face.border_color)
if "Land" in face.types:
colors = "l"
if len(colors) == 0:
colors = "a"
if len(colors) == 1:
return self.saga[colors.lower()]
if len(colors) == 2 and "/" in face.mana_cost or face.mana_cost == "":
return self.merge_hybrid_saga(colors)
else:
return self.saga["m"]
def get_adventure_border(self, face: Face, back: Face) -> Image.Image:
color_right = self.get_single_color(face)
color_left = self.get_single_color(back)
is_artifact = "Artifact" in face.types
background = self.get_back(color_right, is_artifact).copy()
if is_artifact:
color_right = "a"
box = self.get_adventure_box(color_left, color_right, is_artifact)
outline = self.default["outline"]
background.alpha_composite(outline)
background.alpha_composite(box)
return background
def get_border(
self, card: Card, face: Face, back: Optional[Face] = None
) -> Optional[Image.Image]:
if "Saga" in face.subtypes:
border = self.get_saga_border(face).copy()
elif card.layout == "adventure" and back is not None:
border = self.get_adventure_border(face, back).copy()
# elif card.layout == "leveler":
# border = self.get_leveler_border(face).copy()
elif card.layout in [
"token",
"emblem",
"double_faced_token",
] or face.layout in ["token", "emblem", "double_faced_token"]:
border = self.get_token_border(face).copy()
elif "Land" in face.types:
border = self.get_land_border(face).copy()
else:
border = self.get_default_border(face).copy()
if card.layout == "modal_dfc" and back is not None:
border.alpha_composite(self.get_mdfc_badge(back))
return border
def main() -> None:
art1 = ArtInfo(None)
art2 = ArtInfo(None)
card = get_card(sys.argv[1], art1, art2)
with ZipFile("resource_pack.zip") as archive:
with archive.open("style.json") as stylefile:
style = load(stylefile)
borders = Borders.load(archive, style)
back = card.faces[1] if len(card.faces) > 1 else None
img = borders.get_border(card, card.faces[0], back)
if img is not None:
img.show()
if __name__ == "__main__":
main()

124
mkoldproxy/merge.py Normal file
View file

@ -0,0 +1,124 @@
from PIL import Image, ImageEnhance
import sys
import math
def mergepixel(
p1: tuple[int, int, int, int], p2: tuple[int, int, int, int]
) -> tuple[int, int, int, int]:
new_alpha = p1[3] + p2[3] * (1 - p1[3])
new_r = (p1[0] * p1[3] + p2[0] * p2[3] * (1 - p1[3])) // new_alpha
new_g = (p1[1] * p1[3] + p2[1] * p2[3] * (1 - p1[3])) // new_alpha
new_b = (p1[2] * p1[3] + p2[2] * p2[3] * (1 - p1[3])) // new_alpha
return (new_r, new_g, new_b, new_alpha)
def quad(x: float) -> float:
return x
def set_transp1(img: Image.Image) -> Image.Image:
new_img = Image.new("RGBA", (img.width, img.height))
for x in range(img.width):
alpha = 255 - int(quad(x / img.width) * 255)
for y in range(img.height):
r, g, b, a = img.getpixel((x, y))
new_alpha = int((a * alpha) / (255))
new_img.putpixel((x, y), (r, g, b, new_alpha))
return new_img
def set_transp(img: Image.Image) -> Image.Image:
new_img = Image.new("RGBA", (img.width, img.height))
for x in range(img.width):
alpha = int(quad(x / img.width) * 256)
for y in range(img.height):
r, g, b, a = img.getpixel((x, y))
new_alpha = int((a * alpha) / (256))
new_img.putpixel((x, y), (r, g, b, new_alpha))
return new_img
def fix_alpha(img: Image.Image) -> Image.Image:
new_img = Image.new("RGBA", (img.width, img.height))
for x in range(img.width):
for y in range(img.height):
r, g, b, a = img.getpixel((x, y))
if a != 0:
a = 255
new_img.putpixel((x, y), (r, g, b, a))
return new_img
def f(x: float) -> float:
e = math.e
k = 17
x = x - 0.5
return (((e ** (k * x) - e ** (-k * x)) / (e ** (k * x) + e ** (-k * x))) / 2) + 0.5
# def merge2(left: Image.Image, right: Image.Image) -> Image.Image:
# width = left.width
# height = left.height
# img = Image.new("RGBA", (width, height), (0, 0, 0, 0))
#
# for x in range(width):
# r_val = int(f(x / width) * 255)
# l_val = 255 - r_val
# for y in range(height):
# pixel_left = left.getpixel((x, y))
# pixel_right = right.getpixel((x, y))
# r = (pixel_left[0] * l_val + pixel_right[0] * r_val) // 255
# g = (pixel_left[1] * l_val + pixel_right[1] * r_val) // 255
# b = (pixel_left[2] * l_val + pixel_right[2] * r_val) // 255
# img.putpixel((x, y), (r, g, b, pixel_left[3]))
#
# return img
def merge(left: Image.Image, right: Image.Image) -> Image.Image:
width = left.width
height = left.height
mask = Image.new("L", (width, height), (0,))
for x in range(width):
val = 255 - int(f(x / width) * 255)
for y in range(height):
mask.putpixel((x, y), (val))
return Image.composite(left, right, mask)
# def overlay2(first: Image.Image, second: Image.Image, perc: float = 0.5) -> Image.Image:
# width = first.width
# height = first.height
# img = Image.new("RGBA", (width, height), (0, 0, 0, 0))
# img2 = Image.new("RGBA", (width, height), (0, 0, 0, 0))
#
# img.paste(first)
# img2.paste(second)
#
# a = img2.split()[3]
# alpha = ImageEnhance.Brightness(a).enhance(perc)
# img2.putalpha(alpha)
# img.alpha_composite(img2)
# return img
def overlay(first: Image.Image, second: Image.Image, perc: float = 0.5) -> Image.Image:
return Image.blend(first, second, perc)
def main() -> None:
left = Image.open(sys.argv[2])
# new_left = set_transp(left)
right = Image.open(sys.argv[1])
# new_right = set_transp1(right)
# new_right.alpha_composite(new_left)
# i = fix_alpha(new_right)
i = merge(left, right)
i.save(sys.argv[3])
if __name__ == "__main__":
main()

89
mkoldproxy/mkpdf.py Normal file
View file

@ -0,0 +1,89 @@
from collections.abc import Sequence
import sys
from reportlab.pdfgen import canvas
from reportlab.lib.pagesizes import A4
from PIL import Image
def mkpdf(image_paths: Sequence[str | Image.Image], output_path: str) -> None:
# A4 page size in points
page_width, page_height = A4
# Magic: The Gathering card dimensions in points (1 inch = 72 points)
card_width = 2.5 * 72 # 2.5 inches wide
card_height = 3.5 * 72 # 3.5 inches tall
# Small gap between cards
gap = 0.5 # Thin line between images in points
# Calculate grid layout to center on A4 page
rows, cols = 3, 3
total_width = cols * card_width + (cols - 1) * gap
total_height = rows * card_height + (rows - 1) * gap
# Offset to center the grid on the A4 page
x_offset = (page_width - total_width) / 2
y_offset = (page_height - total_height) / 2
# Set up the canvas for the PDF
pdf_canvas = canvas.Canvas(output_path, pagesize=A4)
# Process images in pages of 9 (3x3 grid per page)
for page_start in range(0, len(image_paths), rows * cols):
# Select the batch of images for the current page
page_images = image_paths[page_start : page_start + rows * cols]
for i, image_path in enumerate(page_images):
# Calculate grid position (row and column)
row = i // cols
col = i % cols
x = x_offset + col * (card_width + gap)
y = y_offset + (rows - row - 1) * (card_height + gap)
# Open the image
if isinstance(image_path, Image.Image):
img = image_path
else:
img = Image.open(image_path)
# Scale the image dimensions to fit the card size in the PDF
img_width, img_height = img.size
img_aspect_ratio = img_width / img_height
card_aspect_ratio = card_width / card_height
# Determine scaling to fit within the card dimensions
if img_aspect_ratio > card_aspect_ratio:
display_width = card_width
display_height = card_width / img_aspect_ratio
else:
display_height = card_height
display_width = card_height * img_aspect_ratio
# Center the image within the grid cell
x_centered = x + (card_width - display_width) / 2
y_centered = y + (card_height - display_height) / 2
# Draw the high-quality image directly onto the PDF canvas
pdf_canvas.drawInlineImage(
image_path,
x_centered,
y_centered,
width=display_width,
height=display_height,
)
# If we opened an image from a path, close it to free resources
if not isinstance(image_path, Image.Image):
img.close()
# Finalize the page and add a new one if more images are left
pdf_canvas.showPage()
# Save the PDF
pdf_canvas.save()
if __name__ == "__main__":
mkpdf(sys.argv[2:], sys.argv[1])

View file

@ -0,0 +1,548 @@
from .datatypes import ArtInfo
art_override: dict[tuple[str, int], tuple[ArtInfo, ArtInfo]] = {
("tcn2", 1): (
ArtInfo("https://www.mtgpics.com/pics/art/2cn/222.jpg", y_perc_offset=0.3),
ArtInfo(None)
),
("t40k", 8):
(ArtInfo("https://www.mtgpics.com/pics/art/40k/608.jpg", y_perc_offset=0.3), ArtInfo(None)),
("t40k", 14):
(ArtInfo("https://www.mtgpics.com/pics/art/40k/614.jpg", zoom=1.5, x_perc_offset=0.35, y_perc_offset=0.25), ArtInfo(None)),
("tlci", 17): (
ArtInfo("https://www.mtgpics.com/pics/art/lci/917.jpg", y_perc_offset=0.1),
ArtInfo(None)
),
("tclb", 20): (
ArtInfo("https://cards.scryfall.io/border_crop/front/2/c/2c65185b-6cf0-451d-985e-56aa45d9a57d.jpg"
, zoom=1.2, y_perc_offset=0.7 ), ArtInfo("https://www.mtgpics.com/pics/art/clb/957.jpg", y_perc_offset=0.2)
),
("tvow", 21): (
ArtInfo("https://www.hipstersofthecoast.com/wp-content/uploads/2021/09/day-night-token-johan-genier-preview.jpg", x_perc_offset=0, zoom=1.5),
ArtInfo("https://www.hipstersofthecoast.com/wp-content/uploads/2021/09/day-night-token-johan-genier-preview.jpg", x_perc_offset=1, zoom=1.5)
),
("rtr", 140): (ArtInfo(None, zoom=1.04, y_perc_offset=0), ArtInfo(None)),
("rtr", 141): (ArtInfo(None, zoom=1.04, y_perc_offset=0), ArtInfo(None)),
("rtr", 213): (ArtInfo(None, zoom=1.057), ArtInfo(None)),
("wwk", 123): (ArtInfo(None, zoom=1.07), ArtInfo(None)),
("leg", 65): (
ArtInfo(
"https://cards.scryfall.io/art_crop/front/e/6/e691adef-3027-4e6a-889f-9f4e2df36a7c.jpg?1562861377"
),
ArtInfo(None),
),
("ala", 60): (
ArtInfo(None, y_perc_offset=0.1),ArtInfo(None)
),
("war", 54): (ArtInfo(None, y_perc_offset=0.2), ArtInfo(None)),
("lrw", 56): (ArtInfo(None, y_perc_offset=0, zoom=1.04), ArtInfo(None)),
("lrw", 272): (ArtInfo(None, y_perc_offset=0, zoom=1.07), ArtInfo(None)),
("ltc", 56): (ArtInfo(None, y_perc_offset=0, zoom=1.057), ArtInfo(None)),
("ltr", 7): (ArtInfo(None, y_perc_offset=0, zoom=1.04), ArtInfo(None)),
("ltr", 169): (ArtInfo(None, y_perc_offset=0, zoom=1.12), ArtInfo(None)),
("ltr", 246): (ArtInfo(None, y_perc_offset=0, zoom=1.01), ArtInfo(None)),
("ltr", 247): (ArtInfo(None, y_perc_offset=0, zoom=1.04), ArtInfo(None)),
("m3c", 70): (ArtInfo(None, y_perc_offset=0, zoom=1.051), ArtInfo(None)),
("m14", 169): (ArtInfo(None, y_perc_offset=0, zoom=1.049), ArtInfo(None)),
("mbs", 8): (ArtInfo(None, y_perc_offset=0, zoom=1.12), ArtInfo(None)),
("mh1", 13): (ArtInfo(None, y_perc_offset=0, zoom=1.04), ArtInfo(None)),
("mh1", 37): (ArtInfo(None, y_perc_offset=0, zoom=1.05), ArtInfo(None)),
("mh1", 75): (ArtInfo(None, y_perc_offset=0, zoom=1.033), ArtInfo(None)),
("mh1", 168): (ArtInfo(None, y_perc_offset=0, zoom=1.045), ArtInfo(None)),
("mh1", 199): (ArtInfo(None, y_perc_offset=0, zoom=1.04), ArtInfo(None)),
("mh1", 202): (ArtInfo(None, y_perc_offset=0, zoom=1.031), ArtInfo(None)),
("mh1", 243): (ArtInfo(None, y_perc_offset=0, zoom=1.1), ArtInfo(None)),
("mh2", 67): (ArtInfo(None, y_perc_offset=0, zoom=1.04), ArtInfo(None)),
("mh2", 87): (ArtInfo(None, y_perc_offset=0, zoom=1.04), ArtInfo(None)),
("mh2", 96): (ArtInfo(None, y_perc_offset=0, zoom=1.04), ArtInfo(None)),
("mh2", 121): (ArtInfo(None, y_perc_offset=0, zoom=1.062), ArtInfo(None)),
("mh2", 227): (ArtInfo(None, y_perc_offset=0, zoom=1.05), ArtInfo(None)),
("mh2", 261): (ArtInfo(None, y_perc_offset=0, zoom=1.05), ArtInfo(None)),
("mh3", 29): (ArtInfo(None, y_perc_offset=0, zoom=1.02), ArtInfo(None)),
("mh3", 40): (ArtInfo(None, y_perc_offset=0, zoom=1.05), ArtInfo(None)),
("mh3", 85): (ArtInfo(None, y_perc_offset=0, zoom=1.07), ArtInfo(None)),
("mh3", 103): (ArtInfo(None, y_perc_offset=0, zoom=1.2), ArtInfo(None)),
("mh3", 122): (ArtInfo(None, y_perc_offset=0, zoom=1.04), ArtInfo(None)),
("mh3", 161): (
ArtInfo(
"https://cards.scryfall.io/art_crop/front/a/1/a178cfe8-f9fa-4255-88d0-54a0bed079f5.jpg?1717012517",
),
ArtInfo(None),
),
("mh3", 237): (
ArtInfo(
"https://cards.scryfall.io/art_crop/front/0/d/0d16e8e0-31b2-4389-afd6-783c501f6fa0.jpg?1718635371",
),
ArtInfo(None, zoom=1.04, y_perc_offset=0),
),
("dsc", 28): (
ArtInfo(None, x_perc_offset=0.1),
ArtInfo(None, x_perc_offset=0.9),
),
("dsk", 205): (
ArtInfo(None, x_perc_offset=0.1),
ArtInfo(None, x_perc_offset=0.9),
),
("dsk", 6): (ArtInfo(None, y_perc_offset=0, zoom=1.035), ArtInfo(None)),
("dsk", 35): (ArtInfo(None, y_perc_offset=0, zoom=1.04), ArtInfo(None)),
("dsk", 42): (ArtInfo(None, y_perc_offset=0, zoom=1.04), ArtInfo(None)),
("dsk", 59): (ArtInfo(None, y_perc_offset=0, zoom=1.035), ArtInfo(None)),
("dsk", 72): (ArtInfo(None, y_perc_offset=0, zoom=1.04), ArtInfo(None)),
("dsk", 120): (ArtInfo(None, y_perc_offset=0, zoom=1.04), ArtInfo(None)),
("dsk", 128): (ArtInfo(None, y_perc_offset=0, zoom=1.04), ArtInfo(None)),
("dsk", 204): (ArtInfo(None, y_perc_offset=0, zoom=1.04), ArtInfo(None)),
("dsk", 157): (ArtInfo(None, y_perc_offset=0, zoom=1.05), ArtInfo(None)),
("dsk", 30): (ArtInfo(None, y_perc_offset=0, zoom=1.067), ArtInfo(None)),
("dsk", 202): (ArtInfo(None, y_perc_offset=0, zoom=1.077), ArtInfo(None)),
("dsk", 248): (ArtInfo(None, y_perc_offset=0, zoom=1.067), ArtInfo(None)),
("c15", 14): (ArtInfo(None, zoom=1.05, y_perc_offset=0.2), ArtInfo(None)),
("c15", 26): (ArtInfo(None, zoom=1.05, y_perc_offset=0.2), ArtInfo(None)),
("c21", 65): (ArtInfo(None, zoom=1.05, y_perc_offset=0.45), ArtInfo(None)),
("clb", 180): (ArtInfo(None, zoom=1.1, y_perc_offset=0.45), ArtInfo(None)),
("iko", 248): (ArtInfo(None, zoom=1.058, y_perc_offset=0), ArtInfo(None)),
("iko", 250): (ArtInfo(None, zoom=1.04, y_perc_offset=0), ArtInfo(None)),
("aer", 57): (ArtInfo(None, zoom=1.1), ArtInfo(None)),
("40k", 82): (ArtInfo(None, x_perc_offset=0.55), ArtInfo(None)),
("40k", 42): (ArtInfo(None, y_perc_offset=0.0), ArtInfo(None)),
("dmu", 32): (ArtInfo(None, y_perc_offset=0, zoom=1.02), ArtInfo(None)),
("onc", 3): (ArtInfo(None, zoom=1.1, y_perc_offset=0.4), ArtInfo(None)),
("one", 196): (ArtInfo(None, zoom=1.1, y_perc_offset=0.4), ArtInfo(None)),
("otc", 16): (ArtInfo(None, zoom=1.15, y_perc_offset=0), ArtInfo(None)),
("mkm", 57): (ArtInfo(None, zoom=1.057, y_perc_offset=0), ArtInfo(None)),
("mkm", 170): (ArtInfo(None, zoom=1.09, y_perc_offset=0), ArtInfo(None)),
("mkm", 221): (ArtInfo(None, zoom=1.047, y_perc_offset=0), ArtInfo(None)),
("mkm", 259): (ArtInfo(None, zoom=1.07, y_perc_offset=0), ArtInfo(None)),
("mkm", 263): (ArtInfo(None, zoom=1.04, y_perc_offset=0), ArtInfo(None)),
("mkm", 264): (ArtInfo(None, zoom=1.04, y_perc_offset=0), ArtInfo(None)),
("moc", 447): (ArtInfo(None, zoom=1.04, y_perc_offset=0), ArtInfo(None)),
("mom", 40): (ArtInfo(None, zoom=1.05, y_perc_offset=0), ArtInfo(None)),
("mom", 58): (ArtInfo(None, zoom=1.04, y_perc_offset=0), ArtInfo(None)),
("mh2", 138): (ArtInfo(None, zoom=1.1), ArtInfo(None)),
("m3c", 59): (ArtInfo(None, zoom=1.15), ArtInfo(None)),
("ltr", 111): (
ArtInfo(
"https://cards.scryfall.io/art_crop/front/a/6/a6539e26-b63b-4725-9407-caaf451de084.jpg"
),
ArtInfo(None),
),
("lcc", 86): (
ArtInfo(
"https://cards.scryfall.io/art_crop/front/9/7/9721f8da-39ed-4ada-a571-61e08a86032b.jpg"
),
ArtInfo(None),
),
("gpt", 32): (
ArtInfo(
"https://cards.scryfall.io/art_crop/front/2/6/265b80cd-2e9c-4e4b-a065-eafb29b3e07a.jpg"
),
ArtInfo(None),
),
("big", 20): (
ArtInfo(
"https://cards.scryfall.io/art_crop/front/6/2/62b3f560-262b-4bc3-9aef-535fd7082c28.jpg"
),
ArtInfo(None),
),
("xln", 232): (ArtInfo(None, y_perc_offset=0.2), ArtInfo(None)),
("wwk", 108): (ArtInfo(None, zoom=1.07, y_perc_offset=0.55), ArtInfo(None)),
("wwk", 134): (ArtInfo(None, zoom=1.05, y_perc_offset=0), ArtInfo(None)),
("woe", 261): (ArtInfo(None, zoom=1.05, y_perc_offset=0), ArtInfo(None)),
("woe", 234): (
ArtInfo(
"https://cards.scryfall.io/art_crop/front/7/2/72c130e2-1e17-4996-a5ae-231155d68261.jpg"
),
ArtInfo(None),
),
("war", 79): (
ArtInfo(
"https://cards.scryfall.io/art_crop/front/5/a/5a16665a-2600-460a-a5ad-417930fda62c.jpg"
),
ArtInfo(None),
),
("war", 2): (ArtInfo(None, y_perc_offset=0.1), ArtInfo(None)),
("vow", 183): (
ArtInfo("https://www.mtgpics.com/pics/art/vow/183.jpg"),
ArtInfo("https://www.mtgpics.com/pics/art/vow/841.jpg"),
),
("unf", 166): (ArtInfo(None, y_perc_offset=0.2), ArtInfo(None)),
("thb", 208): (ArtInfo(None, y_perc_offset=0, zoom=1.37), ArtInfo(None)),
("stx", 177): (
ArtInfo(
"https://i0.wp.com/mtgazone.com/wp-content/uploads/2021/05/stx-382-decisive-denial.jpg"
),
ArtInfo(None),
),
("scg", 75): (ArtInfo(None, zoom=1.1), ArtInfo(None)),
("soi", 5): (
ArtInfo("https://www.mtgpics.com/pics/art/soi/005.jpg"),
ArtInfo("https://www.mtgpics.com/pics/art/soi/354.jpg"),
),
("soi", 44): (ArtInfo(None, y_perc_offset=0, zoom=1.02), ArtInfo(None)),
("som", 94): (ArtInfo(None, y_perc_offset=0.1), ArtInfo(None)),
("som", 180): (ArtInfo(None, y_perc_offset=0, zoom=1.04), ArtInfo(None)),
("som", 224): (ArtInfo(None, y_perc_offset=0, zoom=1.055), ArtInfo(None)),
("unf", 107): (ArtInfo(None, y_perc_offset=0, zoom=1.052), ArtInfo(None)),
("roe", 6): (ArtInfo(None, y_perc_offset=0.2), ArtInfo(None)),
("roe", 115): (ArtInfo(None, zoom=1.04, y_perc_offset=1), ArtInfo(None)),
("nph", 1): (ArtInfo(None, y_perc_offset=0.2), ArtInfo(None)),
("mid", 7): (
ArtInfo("https://www.mtgpics.com/pics/art/mid/007.jpg"),
ArtInfo("https://www.mtgpics.com/pics/art/mid/707.jpg"),
),
("mh3", 242): (
ArtInfo(None, y_perc_offset=0, zoom=1.04),
ArtInfo(None, y_perc_offset=0.1),
),
("blb", 54): (ArtInfo(None, zoom=1.1), ArtInfo(None)),
("frf", 1): (ArtInfo(None, y_perc_offset=0.2), ArtInfo(None)),
("emn", 6): (ArtInfo(None, y_perc_offset=0.2), ArtInfo(None)),
("emn", 85): (ArtInfo(None, y_perc_offset=0, zoom=1.04), ArtInfo(None)),
("emn", 46): (ArtInfo(None, y_perc_offset=0.2), ArtInfo(None)),
("neo", 40): (ArtInfo(None, zoom=1.043, y_perc_offset=0), ArtInfo(None)),
("neo", 42): (ArtInfo(None, y_perc_offset=0.2), ArtInfo(None)),
("neo", 255): (ArtInfo(None, zoom=1.04, y_perc_offset=0), ArtInfo(None)),
("neo", 266): (ArtInfo(None, zoom=1.022, y_perc_offset=0), ArtInfo(None)),
("neo", 271): (ArtInfo(None, zoom=1.03, y_perc_offset=0), ArtInfo(None)),
("lea", 265): (ArtInfo(None, zoom=1.015), ArtInfo(None)),
("khm", 260): (
ArtInfo(
"https://cards.scryfall.io/art_crop/front/3/7/375e4697-674a-4d60-b6ae-4bf11393562c.jpg"
),
ArtInfo(None),
),
("big", 9): (ArtInfo(None, zoom=1.15, y_perc_offset=0.4), ArtInfo(None)),
("ori", 60): (
ArtInfo("https://www.mtgpics.com/pics/art/ori/060.jpg"),
ArtInfo("https://www.mtgpics.com/pics/art/ori/291.jpg"),
),
("war", 61): (ArtInfo(None, y_perc_offset=0.2), ArtInfo(None)),
("jou", 163): (ArtInfo(None, zoom=1.04, y_perc_offset=0), ArtInfo(None)),
("avr", 106): (ArtInfo(None, zoom=1.02, y_perc_offset=0.1), ArtInfo(None)),
("isd", 170): (ArtInfo(None, zoom=1.031, y_perc_offset=0), ArtInfo(None)),
("isd", 105): (
ArtInfo(None, y_perc_offset=0.15),
ArtInfo(None),
),
("isd", 181): (ArtInfo(None, y_perc_offset=0.0), ArtInfo(None, y_perc_offset=0.1)),
("apc", 130): (
ArtInfo("https://www.mtgpics.com/pics/art/apo/132.jpg"),
ArtInfo(
"https://cards.scryfall.io/art_crop/front/d/5/d5fb283d-ef80-4f2b-a8be-8859a9be04d3.jpg?1562548367",
x_perc_offset=1,
),
),
("vis", 64): (
ArtInfo("https://www.mtgnexus.com/img/gallery/1689731076/3606-necromancy.jpg"),
ArtInfo(None),
),
("mid", 157): (
ArtInfo(
"https://www.mtgpics.com/pics/art/mid/157.jpg", y_perc_offset=0, zoom=1.03
),
ArtInfo(
"https://www.mtgpics.com/pics/art/mid/754.jpg", y_perc_offset=0, zoom=1.03
),
),
("mh1", 145): (
ArtInfo(
"https://media.wizards.com/2023/images/daily/art_seasoned_pyromancer.jpg"
),
ArtInfo(None),
),
("mom", 137): (
ArtInfo("https://www.mtgpics.com/pics/art/mom/137.jpg"),
ArtInfo("https://www.mtgpics.com/pics/art/mom/987.jpg"),
),
("lci", 156): (ArtInfo(None, zoom=1.045, y_perc_offset=0), ArtInfo(None)),
("lci", 171): (ArtInfo(None, zoom=1.052, y_perc_offset=0), ArtInfo(None)),
("kld", 110): (ArtInfo(None, y_perc_offset=0.2), ArtInfo(None)),
("kld", 235): (ArtInfo(None, zoom=1.04, y_perc_offset=0), ArtInfo(None)),
("kld", 243): (ArtInfo(None, zoom=1.04, y_perc_offset=0), ArtInfo(None)),
("kld", 244): (ArtInfo(None, zoom=1.04, y_perc_offset=0), ArtInfo(None)),
("kld", 245): (ArtInfo(None, zoom=1.04, y_perc_offset=0), ArtInfo(None)),
("kld", 246): (ArtInfo(None, zoom=1.04, y_perc_offset=0), ArtInfo(None)),
("hou", 83): (
ArtInfo(
"https://cards.scryfall.io/art_crop/front/5/4/548947dc-a5ca-43b5-9531-bcef20fa4ae5.jpg?1730489293"
),
ArtInfo(None),
),
("chk", 193): (
ArtInfo("https://www.mtgpics.com/pics/art/chk/193_1.jpg"),
ArtInfo(None),
),
("inv", 176): (
ArtInfo("https://www.mtgpics.com/pics/art/inv/310.jpg"),
ArtInfo(None),
),
("neo", 141): (
ArtInfo("https://www.mtgpics.com/pics/art/neo/141.jpg"),
ArtInfo("https://www.mtgpics.com/pics/art/neo/919.jpg"),
),
("mid", 190): (
ArtInfo(
"https://www.mtgpics.com/pics/art/mid/190.jpg", y_perc_offset=0, zoom=1.02
),
ArtInfo(
"https://www.mtgpics.com/pics/art/mid/750.jpg", y_perc_offset=0, zoom=1.02
),
),
("mid", 80): (
ArtInfo(
None, y_perc_offset=0, zoom=1.04
),
ArtInfo(
None, y_perc_offset=0, zoom=1.04
),
),
("ice", 121): (
ArtInfo(None, zoom=1.1),
ArtInfo(None),
),
("5dn", 86): (
ArtInfo(
"https://cards.scryfall.io/art_crop/front/0/a/0a520b45-77fa-4b9f-b395-06c58939578d.jpg?1592672949"
),
ArtInfo(None),
),
("hou", 129): (
ArtInfo(
"https://cards.scryfall.io/art_crop/front/7/e/7e098506-b69d-4ab0-8ee9-af0d8c7efb8d.jpg?1717190566"
),
ArtInfo(None),
),
("dsc", 36): (
ArtInfo(
"https://cards.scryfall.io/art_crop/front/7/3/73cc6df4-3564-4ace-bf8a-eac3e62d725a.jpg?1726284230"
),
ArtInfo(None),
),
("dka", 24): (
ArtInfo(None, zoom=1.03, y_perc_offset=0.0),
ArtInfo(None),
),
("vow", 225): (
ArtInfo("https://www.mtgpics.com/pics/art/vow/225.jpg"),
ArtInfo(
"https://www.mtgpics.com/pics/art/vow/823.jpg", y_perc_offset=0, zoom=1.03
),
),
("war", 169): (
ArtInfo(None, y_perc_offset=0.1),
ArtInfo(None),
),
("one", 175): (
ArtInfo(None, y_perc_offset=0.2),
ArtInfo(None),
),
("roe", 4): (ArtInfo(None, y_perc_offset=0.2), ArtInfo(None)),
("roe", 12): (ArtInfo(None, y_perc_offset=0.3), ArtInfo(None)),
("akh", 211): (
ArtInfo(None),
ArtInfo(
"https://cards.scryfall.io/art_crop/front/0/6/06c9e2e8-2b4c-4087-9141-6aa25a506626.jpg?1549941334",
x_perc_offset=0.95,
),
),
("clu", 4): (ArtInfo(None, y_perc_offset=0.5, zoom=1.05), ArtInfo(None)),
("cn2", 77): (ArtInfo(None, zoom=1.05, y_perc_offset=0.2), ArtInfo(None)),
("akh", 223): (
ArtInfo("https://www.mtgpics.com/pics/art/akh/223.jpg", x_perc_offset=0.25),
ArtInfo("https://www.mtgpics.com/pics/art/akh/312.jpg"),
),
("bfz", 15): (ArtInfo(None, y_perc_offset=0.2), ArtInfo(None)),
("bfz", 29): (ArtInfo(None, y_perc_offset=0.4), ArtInfo(None)),
("dft", 14): (ArtInfo(None, zoom=1.055, y_perc_offset=0.0), ArtInfo(None)),
("dft", 67): (ArtInfo("https://cards.scryfall.io/art_crop/front/0/a/0a786855-6eb4-42c0-a528-4842db46809d.jpg"), ArtInfo(None)),
("dft", 212): (ArtInfo(None, zoom=1.055, y_perc_offset=0.0), ArtInfo(None)),
("dft", 221): (ArtInfo(None, zoom=1.055, y_perc_offset=0.39), ArtInfo(None)),
("c13", 63): (ArtInfo(None, zoom=1.03, y_perc_offset=0.0), ArtInfo(None)),
("c13", 96): (ArtInfo(None, zoom=1.02, y_perc_offset=0.0), ArtInfo(None)),
("c13", 84): (
ArtInfo(
"https://cards.scryfall.io/art_crop/front/a/4/a402cff8-be7f-4473-b880-a6a2eedfda86.jpg"
),
ArtInfo(None),
),
("lea", 232): (
ArtInfo(
"https://candb.com/site/candb/images/artwork/black-lotus_christopher-rush1920.jpg"
),
ArtInfo(None),
),
("tmp", 294): (
ArtInfo("https://www.mtgpics.com/pics/art/tem/165_1.jpg"),
ArtInfo(None),
),
("bok", 163): (
ArtInfo(
"https://cards.scryfall.io/art_crop/front/3/1/31304ee9-5b0a-49f5-86ba-bbfc7fe60658.jpg?1562904998"
),
ArtInfo(None),
),
("bro", 238): (
ArtInfo("https://www.mtgpics.com/pics/art/tbw/238.jpg"),
ArtInfo(None),
),
("war", 221): (ArtInfo(None, y_perc_offset=0.1), ArtInfo(None)),
("dom", 207): (ArtInfo(None, y_perc_offset=0.1), ArtInfo(None)),
("neo", 226): (ArtInfo(None, y_perc_offset=0.3), ArtInfo(None)),
("mh1", 217): (ArtInfo(None, y_perc_offset=0.2), ArtInfo(None)),
("clb", 285): (ArtInfo(None, y_perc_offset=0.2), ArtInfo(None)),
("cns", 42): (ArtInfo(None, y_perc_offset=0.2), ArtInfo(None)),
("war", 234): (ArtInfo(None, y_perc_offset=0.2), ArtInfo(None)),
("mh2", 202): (ArtInfo(None, y_perc_offset=0.2), ArtInfo(None)),
("mh2", 49): (ArtInfo(None, zoom=1.06, y_perc_offset=0), ArtInfo(None)),
("eld", 197): (ArtInfo(None, y_perc_offset=0.1), ArtInfo(None)),
("eld", 115): (ArtInfo(None, y_perc_offset=0, zoom=1.04), ArtInfo(None)),
("eld", 122): (ArtInfo(None, y_perc_offset=0, zoom=1.03), ArtInfo(None)),
("eld", 244): (ArtInfo(None, y_perc_offset=0, zoom=1.04), ArtInfo(None)),
("dft", 231): (ArtInfo(None, y_perc_offset=0, zoom=1.035), ArtInfo(None)),
("bro", 38): (ArtInfo(None, y_perc_offset=0, zoom=1.035), ArtInfo(None)),
("bro", 127): (ArtInfo(None, y_perc_offset=0, zoom=1.04), ArtInfo(None)),
("bro", 223): (ArtInfo(None, y_perc_offset=0, zoom=1.04), ArtInfo(None)),
("war", 220): (ArtInfo(None, y_perc_offset=0.3), ArtInfo(None)),
("vow", 101): (
ArtInfo("https://www.mtgpics.com/pics/art/vow/101_1.jpg"),
ArtInfo("https://www.mtgpics.com/pics/art/vow/814_1.jpg"),
),
("lea", 279): (
ArtInfo(
"https://images.squarespace-cdn.com/content/v1/5fc6d74a8c9e503d27a5ecf0/1606872619561-F9UJYWM1OHYX244XLEH3/Plateau.jpg?format=2500w"
),
ArtInfo(None),
),
("cn2", 74): (ArtInfo(None, y_perc_offset=0.1), ArtInfo(None)),
("plc", 122): (ArtInfo(None, zoom=1.04), ArtInfo(None)),
("snc", 261): (ArtInfo(None, zoom=1.032, y_perc_offset=0), ArtInfo(None)),
}
cn_set_override: dict[tuple[str, int], tuple[str, int]] = {("phpr", 5): ("pmo", 3)}
set_override: dict[str, str] = {
"m10": "10m",
"m13": "13m",
"lea": "alp",
"leb": "abu",
"2ed": "abu",
"c14": "14c",
"c13": "13c",
"bro": "tbw",
"cn2": "2cn",
"ala": "soa",
"m12": "12m",
"5dn": "fda",
"wth": "wea",
"sth": "str",
"hml": "hom",
"ulg": "url",
"lrw": "lor",
"c15": "15c",
"m11": "11m",
"usg": "urs",
"scg": "sco",
"tmp": "tem",
"bok": "bek",
"mmq": "mer",
"fem": "fal",
"m15": "15m",
"csp": "col",
"m14": "14m",
"shm": "sha",
"atq": "ant",
"c17": "17c",
"pc2": "2pd",
"apc": "apo",
"arb": "alr",
"gpt": "gui",
"arn": "ara",
"uds": "urd",
"dst": "drs",
"p02": "psa",
"lgn": "lgi",
}
# fmt: off
cn_override: dict[str, dict[int, int]] = {
"lgi": {2: 1, 1: 2},
"dom": {4: 3, 3: 4, 6: 5, 5: 6, 10: 7, 7: 8, 14: 9, 8: 10, 15: 11, 16: 13, 11: 14, 18: 15, 9: 16, 20: 17, 21: 18, 22: 19, 13: 20, 23: 21, 25: 22, 17: 23, 26: 24, 19: 25, 28: 26, 24: 27, 31: 28, 27: 30, 36: 31, 38: 32, 34: 33, 39: 34, 41: 36, 30: 37, 45: 38, 46: 39, 49: 41, 63: 42, 50: 43, 33: 44, 53: 45, 44: 46, 54: 47, 32: 48, 55: 49, 43: 50, 56: 51, 58: 53, 59: 54, 60: 55, 61: 56, 64: 57, 65: 58, 47: 59, 68: 60, 69: 61, 51: 62, 42: 63, 57: 64, 66: 65, 70: 66, 75: 68, 37: 69, 73: 70, 48: 71, 62: 72, 82: 73, 76: 75, 83: 76, 85: 77, 86: 78, 89: 79, 71: 80, 72: 82, 94: 83, 78: 84, 79: 85, 96: 86, 97: 87, 87: 88, 98: 89, 84: 90, 88: 91, 100: 92, 80: 93, 101: 94, 93: 95, 103: 96, 91: 97, 107: 98, 90: 99, 108: 100, 109: 101, 111: 102, 99: 103, 115: 105, 92: 106, 119: 107, 121: 108, 110: 109, 126: 110, 127: 111, 128: 112, 129: 113, 130: 114, 95: 115, 131: 116, 132: 118, 133: 119, 134: 120, 136: 121, 118: 122, 120: 123, 125: 124, 138: 125, 139: 126, 77: 127, 143: 128, 145: 129, 146: 130, 122: 131, 123: 132, 148: 133, 149: 134, 150: 135, 151: 136, 152: 137, 154: 138, 112: 139, 156: 140, 157: 141, 114: 142, 158: 143, 142: 144, 161: 145, 162: 146, 163: 147, 165: 148, 135: 149, 166: 150, 102: 151, 168: 152, 170: 153, 113: 154, 172: 155, 147: 156, 174: 157, 155: 158, 179: 159, 105: 160, 181: 161, 106: 162, 182: 163, 183: 165, 137: 166, 184: 167, 185: 168, 141: 169, 187: 170, 116: 171, 190: 172, 191: 173, 192: 174, 193: 177, 280: 179, 194: 180, 195: 181, 196: 182, 159: 183, 197: 184, 198: 185, 169: 186, 186: 187, 199: 188, 153: 189, 200: 190, 160: 191, 201: 192, 177: 193, 203: 194, 180: 195, 204: 196, 167: 197, 205: 198, 202: 199, 207: 200, 173: 201, 208: 202, 124: 203, 211: 204, 140: 205, 213: 206, 171: 207, 214: 208, 217: 210, 218: 211, 219: 212, 212: 213, 220: 214, 222: 215, 223: 217, 189: 218, 224: 219, 188: 220, 225: 221, 206: 222, 227: 223, 215: 224, 228: 225, 230: 226, 231: 227, 210: 228, 232: 229, 221: 230, 235: 231, 226: 232, 236: 233, 229: 234, 233: 235, 239: 236, 234: 238, 240: 239, 241: 240, 244: 241, 245: 244, 247: 245, 238: 247, 249: 248, 248: 249, 275: 270, 270: 275, 144: 280},
"ths": {42: 40, 40: 41, 41: 42, 66: 65, 70: 66, 65: 69, 69: 70, 84: 83, 83: 84, 89: 88, 88: 89, 94: 93, 93: 94, 98: 97, 107: 98, 111: 105, 97: 107, 105: 111, 123: 121, 121: 122, 124: 123, 122: 124, 130: 128, 135: 130, 128: 131, 131: 135, 142: 141, 146: 142, 141: 145, 145: 146, 159: 158, 158: 159, 163: 161, 161: 162, 162: 163, 169: 166, 166: 169, 175: 173, 180: 174, 173: 175, 174: 180, 189: 187, 187: 189, 193: 192, 192: 193, 201: 196, 196: 201},
"jud": {7: 1, 31: 2, 25: 3, 24: 4, 26: 5, 29: 6, 10: 7, 13: 8, 14: 9, 20: 10, 2: 11, 18: 12, 8: 13, 3: 14, 12: 15, 5: 16, 27: 17, 28: 18, 17: 19, 30: 20, 15: 21, 19: 22, 22: 23, 33: 24, 4: 25, 32: 26, 9: 27, 6: 28, 11: 29, 16: 30, 21: 31, 1: 32, 23: 33, 45: 34, 53: 35, 48: 36, 52: 37, 46: 40, 44: 42, 37: 43, 43: 44, 51: 45, 40: 46, 49: 47, 42: 48, 59: 49, 36: 50, 57: 51, 60: 52, 35: 53, 34: 54, 47: 55, 54: 56, 56: 57, 50: 58, 55: 59, 58: 60, 67: 61, 74: 62, 62: 63, 72: 64, 64: 65, 70: 66, 71: 67, 63: 68, 76: 69, 65: 70, 66: 71, 61: 72, 69: 73, 75: 74, 68: 75, 73: 76, 92: 77, 97: 79, 94: 80, 89: 81, 98: 82, 87: 83, 80: 84, 83: 85, 82: 86, 81: 87, 101: 88, 102: 89, 96: 90, 88: 91, 86: 92, 95: 93, 79: 94, 84: 95, 77: 96, 85: 97, 100: 98, 90: 99, 93: 100, 99: 101, 91: 102, 114: 104, 111: 105, 112: 106, 108: 107, 122: 108, 130: 109, 115: 110, 132: 111, 131: 112, 124: 113, 136: 114, 119: 115, 110: 116, 123: 117, 133: 118, 116: 119, 125: 122, 105: 123, 126: 124, 128: 125, 129: 126, 104: 127, 107: 128, 109: 129, 113: 130, 127: 131, 117: 132, 106: 133, 118: 134, 134: 135, 135: 136, 138: 137, 139: 138, 137: 139},
"dka": {68: 64, 69: 67, 64: 68, 67: 69, 85: 83, 83: 85, 99: 87, 87: 90, 95: 93, 93: 95, 90: 99, 109: 100, 105: 104, 104: 105, 100: 108, 108: 109, 136: 133, 133: 135, 135: 136, 155: 154, 156: 155, 157: 156, 154: 157, 13: 159, 50: 160, 55: 161, 71: 162},
"exo": {27: 1, 1: 2, 79: 3, 2: 4, 105: 5, 106: 6, 53: 7, 107: 8, 54: 9, 3: 10, 4: 11, 80: 12, 143: 13, 131: 14, 5: 15, 108: 16, 55: 17, 28: 18, 29: 19, 56: 20, 57: 21, 58: 22, 59: 23, 60: 24, 81: 25, 30: 26, 109: 27, 110: 28, 61: 29, 31: 30, 32: 31, 132: 32, 6: 34, 34: 35, 82: 36, 83: 37, 35: 38, 62: 39, 84: 40, 63: 41, 64: 42, 7: 43, 111: 44, 112: 45, 65: 46, 85: 47, 8: 48, 36: 49, 37: 50, 9: 51, 10: 52, 86: 53, 38: 54, 113: 55, 87: 56, 133: 57, 134: 58, 39: 59, 66: 60, 40: 61, 135: 62, 41: 63, 114: 64, 88: 65, 89: 66, 136: 69, 115: 70, 69: 71, 11: 72, 90: 73, 42: 74, 91: 75, 92: 76, 12: 77, 93: 78, 94: 79, 13: 80, 14: 81, 15: 82, 70: 83, 71: 84, 116: 85, 117: 86, 95: 87, 118: 88, 119: 89, 96: 90, 97: 91, 16: 92, 98: 93, 120: 94, 17: 95, 72: 96, 121: 97, 43: 98, 122: 99, 44: 100, 99: 101, 100: 102, 73: 103, 45: 104, 46: 105, 101: 106, 18: 107, 102: 108, 19: 109, 137: 110, 123: 111, 124: 112, 74: 113, 20: 114, 125: 115, 103: 116, 21: 117, 138: 118, 104: 119, 139: 120, 75: 121, 126: 122, 127: 123, 128: 124, 22: 125, 129: 126, 47: 127, 48: 128, 49: 129, 140: 130, 76: 131, 141: 132, 23: 133, 50: 134, 77: 135, 78: 136, 24: 137, 51: 138, 25: 139, 52: 140, 130: 141, 26: 143},
"wea": {30: 1, 1: 2, 31: 3, 117: 4, 59: 5, 88: 6, 60: 7, 2: 8, 3: 9, 32: 10, 4: 11, 33: 12, 118: 13, 5: 14, 6: 15, 34: 16, 7: 17, 35: 18, 119: 19, 61: 20, 8: 21, 9: 22, 10: 23, 89: 24, 90: 25, 120: 26, 91: 27, 92: 28, 62: 29, 146: 30, 121: 31, 147: 32, 63: 33, 122: 34, 148: 35, 123: 36, 93: 37, 94: 38, 64: 39, 36: 40, 65: 41, 95: 42, 11: 43, 124: 44, 96: 45, 149: 46, 37: 47, 66: 48, 125: 49, 12: 50, 97: 51, 98: 52, 13: 53, 38: 54, 126: 55, 127: 56, 67: 57, 99: 58, 68: 59, 100: 60, 101: 61, 102: 62, 69: 63, 39: 64, 40: 65, 14: 66, 128: 67, 129: 68, 70: 69, 164: 70, 15: 71, 103: 72, 104: 73, 105: 74, 16: 75, 130: 76, 71: 77, 106: 78, 107: 79, 17: 80, 72: 81, 108: 82, 73: 83, 18: 84, 150: 85, 151: 86, 19: 87, 109: 88, 110: 89, 131: 90, 132: 91, 133: 92, 134: 93, 165: 94, 41: 95, 152: 96, 42: 97, 111: 98, 20: 99, 43: 100, 153: 101, 74: 102, 21: 103, 75: 104, 135: 105, 136: 106, 137: 107, 76: 108, 44: 109, 154: 110, 77: 111, 45: 112, 112: 113, 46: 114, 22: 115, 47: 116, 48: 117, 49: 118, 155: 119, 50: 120, 78: 121, 138: 122, 51: 123, 23: 124, 113: 125, 139: 126, 52: 127, 114: 128, 166: 129, 24: 130, 25: 131, 156: 132, 79: 133, 80: 134, 26: 135, 27: 136, 81: 137, 157: 138, 82: 139, 158: 140, 140: 141, 141: 142, 28: 143, 53: 144, 83: 145, 159: 146, 160: 147, 115: 148, 116: 149, 54: 150, 55: 151, 56: 152, 57: 153, 161: 154, 142: 155, 143: 156, 84: 157, 85: 158, 144: 159, 145: 160, 58: 161, 29: 162, 86: 163, 162: 164, 167: 165, 163: 166, 87: 167},
"vis": {51: 1, 141: 2, 1: 3, 126: 4, 26: 5, 52: 6, 76: 7, 142: 8, 127: 9, 27: 10, 53: 11, 101: 12, 28: 13, 102: 14, 29: 15, 54: 16, 160: 17, 128: 18, 103: 19, 55: 20, 2: 21, 56: 22, 57: 23, 30: 24, 58: 25, 143: 26, 161: 27, 144: 28, 31: 29, 77: 30, 104: 31, 78: 32, 105: 33, 106: 34, 3: 35, 162: 36, 4: 37, 59: 38, 129: 39, 107: 40, 79: 41, 130: 42, 32: 43, 60: 44, 33: 45, 5: 46, 61: 47, 108: 48, 80: 49, 81: 50, 6: 51, 163: 52, 131: 53, 82: 54, 83: 55, 145: 56, 7: 57, 8: 58, 84: 59, 34: 60, 9: 61, 35: 63, 146: 64, 10: 65, 147: 66, 164: 67, 63: 68, 165: 69, 109: 70, 85: 71, 110: 72, 36: 73, 11: 74, 86: 75, 111: 76, 148: 77, 112: 78, 87: 79, 12: 80, 149: 81, 37: 82, 150: 83, 13: 84, 88: 85, 113: 86, 132: 87, 38: 88, 114: 89, 64: 90, 65: 91, 66: 92, 89: 93, 39: 94, 115: 95, 14: 96, 15: 97, 151: 98, 152: 99, 67: 100, 40: 101, 133: 102, 68: 103, 166: 104, 116: 105, 117: 106, 90: 107, 41: 108, 91: 109, 16: 110, 17: 111, 18: 112, 19: 113, 20: 114, 134: 115, 118: 116, 92: 117, 119: 118, 153: 119, 135: 120, 42: 121, 43: 122, 136: 123, 154: 124, 155: 125, 93: 126, 94: 127, 120: 128, 95: 129, 137: 130, 121: 131, 138: 132, 122: 133, 21: 134, 69: 135, 96: 136, 97: 137, 98: 138, 70: 139, 22: 140, 156: 141, 44: 142, 139: 143, 45: 144, 46: 145, 157: 146, 23: 147, 99: 148, 158: 149, 123: 150, 167: 151, 47: 152, 71: 153, 72: 154, 73: 155, 48: 156, 100: 157, 140: 158, 49: 159, 74: 160, 159: 161, 24: 162, 124: 163, 50: 164, 75: 165, 125: 166, 25: 167},
"urs": {229: 3, 115: 4, 58: 5, 172: 6, 230: 7, 231: 8, 232: 9, 3: 10, 4: 11, 59: 12, 173: 13, 174: 14, 60: 15, 233: 16, 234: 17, 235: 18, 236: 19, 61: 20, 62: 21, 63: 22, 286: 23, 175: 24, 116: 25, 117: 26, 237: 27, 238: 28, 319: 29, 118: 30, 119: 31, 176: 32, 177: 33, 120: 34, 5: 35, 239: 36, 178: 37, 121: 38, 240: 39, 122: 40, 64: 41, 6: 42, 287: 43, 241: 44, 242: 45, 288: 46, 243: 47, 289: 48, 244: 49, 290: 50, 7: 51, 65: 52, 66: 53, 8: 54, 123: 55, 291: 56, 67: 57, 124: 58, 245: 59, 179: 60, 125: 61, 246: 62, 292: 63, 68: 64, 126: 65, 127: 66, 128: 67, 9: 68, 129: 69, 180: 70, 130: 71, 10: 72, 11: 73, 131: 74, 12: 75, 181: 76, 69: 77, 70: 78, 293: 79, 71: 80, 320: 81, 182: 82, 132: 83, 133: 84, 183: 85, 13: 86, 247: 87, 248: 88, 72: 89, 249: 90, 294: 91, 73: 92, 74: 93, 134: 94, 250: 95, 135: 96, 14: 97, 184: 98, 185: 99, 251: 100, 252: 101, 186: 102, 187: 103, 136: 104, 295: 105, 75: 106, 347: 107, 348: 108, 349: 109, 350: 110, 253: 111, 254: 112, 321: 113, 255: 114, 188: 115, 76: 116, 15: 117, 189: 118, 190: 119, 191: 120, 192: 121, 193: 122, 194: 123, 195: 124, 196: 125, 256: 126, 296: 127, 77: 128, 257: 129, 258: 130, 197: 131, 259: 132, 198: 133, 16: 134, 199: 135, 17: 136, 78: 137, 79: 138, 260: 139, 261: 140, 262: 141, 263: 142, 264: 143, 265: 144, 137: 145, 297: 146, 80: 147, 18: 148, 266: 149, 138: 150, 81: 151, 19: 152, 335: 153, 336: 154, 337: 155, 338: 156, 200: 157, 298: 158, 82: 159, 201: 160, 299: 161, 202: 162, 83: 163, 84: 164, 139: 165, 300: 166, 267: 167, 140: 168, 141: 169, 203: 170, 301: 171, 268: 172, 302: 173, 303: 174, 20: 175, 21: 176, 85: 177, 343: 178, 344: 179, 345: 180, 346: 181, 142: 182, 304: 183, 204: 184, 22: 185, 23: 186, 24: 187, 25: 188, 26: 189, 143: 190, 144: 191, 205: 192, 27: 193, 145: 194, 28: 195, 29: 196, 30: 197, 86: 198, 87: 199, 88: 200, 146: 201, 147: 202, 305: 203, 148: 204, 306: 205, 322: 206, 307: 207, 331: 208, 332: 209, 333: 210, 334: 211, 31: 212, 149: 213, 323: 214, 269: 215, 89: 216, 90: 217, 32: 218, 150: 219, 270: 220, 308: 221, 151: 222, 206: 223, 152: 224, 207: 225, 91: 226, 153: 227, 33: 228, 208: 229, 271: 230, 34: 231, 324: 232, 154: 233, 92: 234, 272: 235, 209: 236, 93: 237, 210: 238, 35: 239, 36: 240, 37: 241, 38: 242, 39: 243, 40: 244, 41: 245, 42: 246, 43: 247, 94: 248, 95: 249, 155: 250, 211: 251, 212: 252, 213: 253, 44: 254, 45: 255, 46: 256, 47: 257, 48: 258, 49: 259, 325: 260, 50: 261, 216: 262, 326: 263, 214: 264, 215: 265, 96: 266, 217: 267, 156: 268, 51: 269, 157: 270, 158: 271, 159: 272, 327: 273, 309: 274, 328: 275, 218: 276, 97: 277, 52: 278, 53: 279, 160: 280, 98: 281, 273: 282, 274: 283, 219: 284, 99: 285, 100: 286, 220: 287, 101: 288, 339: 289, 340: 290, 341: 291, 342: 292, 275: 293, 161: 294, 102: 295, 310: 296, 329: 297, 311: 298, 221: 299, 103: 300, 276: 301, 277: 302, 330: 303, 104: 304, 222: 305, 278: 306, 279: 307, 105: 308, 312: 309, 162: 310, 163: 311, 313: 312, 164: 313, 165: 314, 106: 315, 107: 316, 108: 317, 109: 318, 110: 319, 280: 320, 281: 321, 223: 322, 224: 323, 225: 324, 226: 325, 166: 326, 167: 327, 54: 328, 55: 329, 314: 330, 227: 331, 315: 332, 282: 333, 56: 334, 168: 335, 316: 336, 283: 337, 284: 338, 228: 339, 111: 340, 285: 341, 317: 342, 169: 343, 112: 344, 318: 345, 57: 346, 170: 347, 171: 348, 113: 349, 114: 350},
"ara": {34: 2, 56: 3, 57: 4, 35: 5, 36: 6, 2: 7, 70: 9, 37: 10, 58: 12, 59: 13, 3: 14, 60: 15, 71: 16, 23: 17, 45: 18, 61: 19, 12: 20, 72: 21, 38: 22, 46: 23, 73: 24, 47: 25, 62: 26, 24: 27, 74: 28, 25: 29, 48: 31, 4: 32, 13: 33, 63: 35, 14: 36, 49: 37, 15: 38, 26: 40, 27: 41, 39: 43, 50: 44, 16: 45, 75: 46, 64: 47, 65: 48, 66: 49, 5: 50, 28: 51, 29: 52, 30: 53, 6: 54, 40: 55, 76: 56, 41: 57, 17: 58, 51: 59, 42: 60, 7: 61, 77: 63, 52: 64, 78: 66, 18: 67, 31: 68, 8: 70, 67: 72, 9: 73, 68: 74, 43: 75, 69: 77, 53: 78, 19: 79, 20: 80, 10: 81, 21: 82, 54: 83, 32: 84, 33: 85, 22: 87, 11: 88, 55: 90, 44: 92},
"gui": {23: 22, 24: 23, 25: 24, 26: 25, 27: 26, 28: 27, 29: 28, 30: 29, 31: 30, 32: 31, 33: 32, 34: 33, 35: 34, 36: 35, 37: 36, 38: 37, 39: 38, 40: 39, 41: 40, 42: 41, 22: 42, 157: 144, 144: 145, 150: 146, 158: 147, 151: 148, 159: 149, 145: 150, 152: 151, 153: 152, 154: 153, 146: 154, 160: 155, 161: 156, 147: 157, 155: 158, 162: 159, 148: 160, 163: 161, 164: 162, 165: 163, 156: 164, 149: 165},
"ant": {36: 1, 1: 2, 2: 3, 29: 4, 30: 5, 37: 6, 22: 7, 15: 8, 3: 9, 38: 10, 39: 11, 40: 12, 23: 13, 41: 14, 42: 15, 43: 16, 4: 17, 31: 18, 44: 19, 45: 20, 46: 21, 47: 22, 32: 23, 48: 24, 5: 25, 24: 26, 8: 27, 49: 28, 25: 29, 9: 30, 50: 31, 33: 32, 16: 33, 26: 34, 51: 35, 52: 36, 17: 37, 10: 38, 53: 39, 54: 40, 6: 41, 55: 42, 56: 43, 57: 48, 58: 50, 59: 51, 27: 52, 60: 53, 18: 54, 11: 55, 34: 56, 19: 57, 61: 58, 72: 59, 62: 60, 12: 61, 7: 62, 13: 64, 64: 65, 28: 66, 65: 67, 66: 71, 67: 72, 68: 73, 69: 74, 70: 75, 71: 76, 35: 77, 14: 78, 73: 79, 74: 80, 75: 81, 76: 86, 77: 95, 78: 96, 20: 97, 21: 98, 79: 99, 80: 44, 81: 49, 82: 68, 83: 82, 84: 87, 85: 91},
"14m": {3: 2, 2: 3, 8: 6, 9: 8, 6: 9, 13: 12, 12: 13, 17: 16, 16: 17, 20: 18, 18: 19, 19: 20, 26: 24, 28: 25, 24: 26, 25: 28, 33: 31, 31: 33, 44: 42, 42: 43, 43: 44, 47: 45, 45: 46, 46: 47, 53: 51, 58: 52, 52: 53, 55: 54, 61: 55, 57: 56, 59: 57, 56: 58, 51: 59, 62: 60, 60: 61, 65: 62, 54: 63, 63: 65, 68: 67, 67: 68, 71: 69, 72: 70, 69: 71, 76: 72, 77: 74, 74: 76, 70: 77, 81: 78, 78: 80, 80: 81, 86: 85, 85: 86, 96: 87, 89: 88, 88: 89, 100: 90, 103: 92, 92: 93, 87: 95, 95: 96, 90: 97, 107: 98, 97: 99, 102: 100, 93: 101, 99: 102, 105: 103, 106: 104, 98: 105, 111: 106, 101: 107, 110: 108, 114: 109, 115: 110, 113: 111, 104: 112, 112: 113, 108: 114, 109: 115, 120: 119, 119: 120, 122: 121, 121: 122, 125: 124, 124: 125, 132: 131, 134: 132, 135: 133, 133: 134, 131: 135, 138: 136, 145: 138, 136: 139, 147: 140, 148: 142, 150: 144, 146: 145, 139: 146, 140: 147, 153: 148, 154: 149, 142: 150, 149: 151, 144: 152, 152: 153, 151: 154, 161: 159, 163: 160, 164: 161, 159: 163, 160: 164, 167: 166, 169: 167, 166: 169, 172: 170, 170: 171, 171: 172, 175: 173, 173: 174, 176: 175, 182: 176, 179: 178, 180: 179, 174: 180, 178: 181, 181: 182, 189: 186, 190: 187, 193: 188, 194: 189, 195: 190, 192: 191, 186: 192, 196: 193, 187: 194, 188: 195, 191: 196, 199: 197, 203: 199, 197: 203, 211: 205, 209: 206, 205: 207, 207: 208, 215: 209, 216: 210, 218: 211, 222: 212, 219: 213, 220: 214, 206: 215, 223: 216, 221: 217, 212: 218, 208: 219, 210: 220, 217: 221, 214: 222, 226: 223, 213: 224, 224: 225, 225: 226, 257: 255, 258: 257, 255: 258},
"15m": {8: 6, 9: 7, 10: 8, 7: 9, 6: 10, 14: 13, 13: 14, 16: 15, 15: 16, 21: 17, 24: 18, 20: 19, 25: 20, 18: 21, 30: 22, 17: 23, 36: 24, 27: 25, 19: 26, 31: 27, 29: 28, 22: 29, 37: 30, 23: 31, 28: 34, 26: 35, 35: 36, 39: 37, 34: 38, 40: 39, 38: 40, 47: 45, 48: 46, 46: 47, 49: 48, 45: 49, 52: 50, 53: 51, 50: 52, 51: 53, 57: 55, 58: 56, 62: 57, 59: 58, 61: 59, 55: 60, 56: 61, 60: 62, 64: 63, 63: 64, 70: 68, 68: 69, 69: 70, 74: 73, 73: 74, 77: 75, 75: 77, 79: 78, 78: 79, 83: 82, 82: 83, 89: 86, 90: 87, 91: 88, 93: 89, 92: 90, 88: 91, 87: 92, 86: 93, 97: 95, 98: 96, 95: 97, 99: 98, 101: 99, 96: 101, 105: 104, 104: 105, 108: 107, 107: 108, 120: 112, 112: 113, 117: 114, 113: 116, 114: 117, 116: 119, 119: 120, 125: 124, 124: 125, 127: 126, 131: 127, 132: 128, 133: 129, 126: 130, 136: 131, 137: 132, 130: 133, 128: 136, 129: 137, 141: 139, 139: 140, 142: 141, 140: 142, 145: 143, 146: 144, 150: 145, 143: 146, 154: 147, 155: 148, 148: 149, 144: 150, 149: 152, 147: 153, 152: 154, 156: 155, 158: 156, 159: 158, 153: 159, 165: 164, 166: 165, 164: 166, 174: 173, 173: 174, 178: 177, 179: 178, 180: 179, 177: 180, 185: 184, 184: 185, 189: 188, 204: 189, 193: 190, 198: 191, 188: 192, 190: 193, 192: 195, 191: 196, 195: 197, 196: 198, 197: 199, 199: 200, 200: 202, 202: 204, 208: 207, 207: 208, 229: 212, 214: 213, 213: 214, 218: 216, 216: 218, 212: 229, 245: 232, 246: 233, 247: 234, 248: 235, 249: 236, 232: 245, 233: 246, 234: 247, 235: 248, 236: 249},
"fal": {1: 17, 2: 49, 3: 50, 4: 53, 5: 69, 6: 71, 7: 89, 8: 93, 9: 96, 10: 97, 11: 100, 12: 101, 13: 102, 14: 106, 15: 108, 16: 134, 17: 22, 18: 72, 19: 76, 20: 80, 21: 81, 22: 82, 23: 113, 24: 51, 25: 52, 26: 53, 27: 172, 28: 175, 29: 178, 30: 179, 31: 182, 32: 186, 33: 2, 34: 7, 35: 16, 36: 25, 37: 35, 38: 85, 39: 110, 40: 117, 41: 120, 42: 137, 43: 94, 44: 169, 45: 170, 46: 171, 47: 176, 48: 177, 49: 12, 50: 27, 51: 28, 52: 30, 53: 32, 54: 56, 55: 59, 56: 60, 57: 63, 58: 64, 59: 68, 60: 126, 61: 127, 62: 130, 63: 140, 64: 132, 65: 37, 66: 42, 67: 43, 68: 46, 69: 54, 70: 55, 71: 123, 72: 149, 73: 152, 74: 153, 75: 157, 76: 158, 77: 159, 78: 160, 79: 161, 80: 165, 81: 1, 82: 6, 83: 21, 84: 23, 85: 24, 86: 26, 87: 41, 88: 109, 89: 174, 90: 175, 91: 187, 92: 11, 93: 29, 94: 31, 95: 36, 96: 70, 97: 75, 98: 107, 99: 184, 100: 185, 101: 186, 102: 187},
"bek": {91: 1, 92: 2, 93: 3, 94: 4, 152: 5, 61: 6, 95: 7, 96: 8, 62: 9, 153: 10, 121: 11, 122: 12, 63: 13, 31: 14, 123: 15, 32: 16, 97: 17, 98: 18, 64: 19, 99: 20, 1: 21, 33: 22, 2: 23, 124: 24, 65: 25, 3: 26, 4: 27, 100: 28, 101: 29, 34: 30, 125: 31, 102: 32, 103: 33, 104: 34, 126: 35, 35: 36, 66: 37, 5: 38, 151: 39, 105: 40, 127: 41, 106: 42, 164: 43, 67: 44, 128: 45, 6: 46, 107: 47, 36: 48, 68: 49, 37: 50, 69: 51, 7: 52, 70: 53, 8: 54, 108: 55, 9: 56, 71: 57, 109: 58, 129: 59, 110: 60, 130: 61, 38: 62, 39: 63, 10: 64, 11: 65, 12: 66, 13: 67, 40: 68, 14: 69, 131: 70, 111: 71, 132: 73, 133: 74, 134: 75, 112: 76, 135: 77, 73: 78, 136: 79, 15: 80, 41: 81, 42: 82, 154: 83, 43: 84, 16: 85, 155: 86, 74: 87, 44: 88, 137: 89, 75: 90, 113: 91, 76: 92, 17: 93, 156: 94, 157: 95, 114: 96, 18: 97, 115: 98, 19: 99, 45: 100, 77: 101, 138: 102, 139: 103, 46: 104, 78: 105, 79: 106, 47: 107, 48: 108, 49: 109, 50: 110, 140: 111, 116: 112, 158: 113, 141: 114, 142: 115, 143: 116, 20: 117, 80: 118, 51: 119, 21: 120, 117: 121, 81: 122, 144: 123, 159: 124, 160: 125, 82: 126, 22: 127, 83: 128, 84: 129, 161: 130, 52: 131, 145: 132, 118: 133, 146: 134, 23: 135, 85: 136, 53: 137, 54: 138, 24: 139, 86: 140, 25: 141, 55: 142, 165: 143, 26: 144, 27: 145, 162: 146, 56: 147, 87: 148, 88: 149, 57: 150, 58: 151, 119: 152, 89: 153, 147: 154, 120: 155, 163: 156, 148: 157, 149: 158, 59: 159, 150: 160, 60: 161, 28: 162, 29: 163, 30: 164, 90: 165},
"tem": {107: 1, 1: 2, 160: 3, 276: 4, 213: 5, 161: 6, 315: 7, 2: 8, 3: 9, 214: 10, 162: 11, 4: 12, 5: 13, 6: 14, 7: 15, 163: 16, 215: 17, 108: 18, 54: 19, 164: 20, 109: 21, 165: 22, 277: 23, 278: 24, 110: 25, 216: 26, 316: 27, 217: 28, 166: 29, 167: 30, 55: 31, 111: 32, 168: 33, 218: 34, 56: 35, 219: 36, 317: 37, 9: 38, 10: 39, 11: 40, 12: 41, 8: 42, 13: 43, 14: 44, 112: 45, 15: 46, 113: 47, 114: 48, 279: 49, 280: 50, 115: 51, 116: 52, 57: 53, 220: 54, 169: 55, 281: 56, 117: 57, 118: 58, 119: 59, 120: 60, 121: 61, 122: 62, 123: 63, 124: 64, 125: 65, 126: 66, 170: 67, 127: 68, 128: 69, 221: 70, 16: 71, 58: 72, 129: 73, 266: 74, 130: 75, 59: 76, 131: 77, 60: 78, 222: 79, 282: 80, 223: 81, 224: 82, 17: 83, 225: 84, 226: 85, 283: 86, 284: 87, 132: 88, 285: 89, 133: 90, 171: 91, 61: 92, 62: 93, 286: 94, 134: 95, 287: 96, 135: 97, 136: 98, 18: 99, 63: 100, 172: 101, 173: 102, 227: 103, 19: 104, 174: 105, 175: 106, 288: 107, 176: 108, 289: 109, 347: 110, 348: 111, 349: 112, 350: 113, 228: 114, 229: 115, 177: 116, 64: 117, 20: 118, 65: 119, 21: 120, 318: 121, 66: 122, 178: 123, 179: 124, 137: 125, 290: 126, 180: 127, 22: 128, 230: 129, 181: 130, 182: 131, 231: 132, 232: 133, 233: 134, 291: 135, 23: 136, 234: 137, 67: 138, 24: 139, 138: 140, 68: 141, 69: 142, 70: 143, 25: 144, 335: 145, 336: 146, 337: 147, 338: 148, 183: 149, 292: 150, 293: 151, 139: 152, 184: 153, 26: 154, 140: 155, 235: 156, 141: 157, 71: 158, 72: 159, 27: 160, 185: 161, 186: 162, 142: 163, 267: 164, 294: 165, 187: 166, 143: 167, 188: 168, 295: 169, 73: 170, 296: 171, 74: 172, 28: 173, 144: 174, 29: 175, 75: 176, 319: 177, 76: 178, 297: 179, 145: 180, 146: 181, 236: 182, 77: 183, 298: 184, 189: 185, 190: 186, 320: 187, 191: 188, 192: 189, 237: 190, 343: 191, 344: 192, 345: 193, 346: 194, 30: 195, 238: 196, 239: 197, 240: 198, 241: 199, 193: 200, 242: 201, 194: 202, 31: 203, 32: 204, 33: 205, 243: 206, 34: 207, 195: 208, 299: 209, 300: 210, 35: 211, 147: 212, 301: 213, 302: 214, 303: 215, 244: 216, 321: 217, 148: 218, 331: 219, 332: 220, 333: 221, 334: 222, 78: 223, 79: 224, 80: 225, 304: 226, 36: 227, 149: 228, 245: 229, 268: 230, 196: 231, 150: 232, 246: 233, 151: 234, 247: 235, 152: 236, 248: 237, 322: 238, 197: 239, 37: 240, 249: 241, 198: 242, 250: 243, 251: 244, 252: 245, 323: 246, 81: 247, 82: 248, 83: 249, 84: 250, 305: 251, 38: 252, 153: 253, 39: 254, 324: 255, 199: 256, 306: 257, 154: 258, 325: 259, 307: 260, 200: 261, 253: 262, 155: 263, 308: 264, 85: 265, 201: 266, 254: 267, 269: 268, 270: 269, 40: 270, 156: 271, 86: 272, 202: 273, 203: 274, 87: 275, 204: 276, 271: 277, 88: 278, 255: 279, 326: 280, 256: 281, 257: 282, 157: 283, 41: 284, 42: 285, 43: 286, 272: 287, 44: 288, 45: 289, 46: 290, 47: 291, 158: 292, 89: 293, 258: 294, 159: 295, 48: 296, 273: 297, 309: 298, 327: 299, 205: 300, 310: 301, 49: 302, 90: 303, 91: 304, 206: 305, 259: 306, 207: 307, 208: 308, 339: 309, 340: 310, 341: 311, 342: 312, 209: 313, 50: 314, 311: 315, 92: 316, 328: 317, 93: 318, 94: 319, 95: 320, 312: 321, 96: 322, 97: 323, 210: 324, 313: 325, 98: 326, 260: 327, 261: 328, 262: 329, 99: 330, 100: 331, 329: 332, 263: 333, 264: 334, 274: 335, 101: 336, 211: 337, 51: 338, 330: 339, 314: 340, 102: 341, 103: 342, 212: 343, 104: 344, 105: 345, 52: 346, 106: 347, 265: 348, 275: 349, 53: 350},
"all": {1: 24, 2: 43, 3: 45, 4: 76, 5: 79, 6: 80, 7: 83, 8: 85, 9: 87, 10: 101, 11: 110, 12: 126, 13: 128, 14: 132, 15: 133, 16: 136, 17: 138, 18: 168, 19: 171, 20: 180, 21: 194, 22: 5, 23: 10, 24: 17, 25: 22, 26: 33, 27: 46, 28: 54, 29: 55, 30: 92, 31: 94, 32: 115, 33: 146, 34: 148, 35: 155, 36: 160, 37: 162, 38: 166, 39: 175, 40: 176, 41: 187, 42: 189, 43: 12, 44: 26, 45: 29, 46: 34, 47: 35, 48: 48, 49: 49, 50: 51, 51: 77, 52: 82, 53: 89, 54: 90, 55: 95, 56: 105, 57: 113, 58: 117, 59: 130, 60: 142, 61: 157, 62: 165, 63: 169, 64: 3, 65: 13, 66: 15, 67: 19, 68: 23, 69: 28, 70: 32, 71: 41, 72: 66, 73: 68, 74: 70, 75: 112, 76: 123, 77: 124, 78: 125, 79: 131, 80: 154, 81: 163, 82: 182, 83: 184, 84: 185, 85: 21, 86: 30, 87: 36, 88: 37, 89: 39, 90: 57, 91: 59, 92: 60, 93: 62, 94: 64, 95: 73, 96: 81, 97: 108, 98: 109, 99: 156, 100: 172, 101: 177, 102: 178, 103: 191, 104: 197, 105: 199, 106: 40, 107: 98, 108: 97, 109: 100, 110: 103, 111: 107, 112: 116, 113: 167, 114: 190, 115: 196, 116: 1, 117: 7, 118: 8, 119: 53, 120: 72, 121: 75, 122: 99, 123: 104, 124: 106, 125: 119, 126: 120, 127: 121, 128: 135, 129: 140, 130: 141, 131: 144, 132: 150, 133: 152, 134: 159, 135: 181, 136: 193, 137: 14, 138: 74, 139: 86, 140: 91, 141: 137, 142: 139, 143: 145, 144: 174},
"hom": {3: 23, 4: 25, 5: 26, 6: 29, 7: 46, 8: 72, 9: 89, 10: 95, 11: 101, 12: 102, 13: 112, 14: 119, 15: 120, 16: 121, 17: 122, 18: 126, 19: 131, 20: 133, 21: 4, 22: 27, 23: 37, 24: 42, 25: 43, 26: 64, 27: 67, 28: 69, 29: 80, 30: 86, 31: 91, 32: 92, 33: 94, 34: 97, 35: 98, 36: 103, 37: 107, 38: 114, 39: 115, 40: 135, 41: 28, 42: 30, 43: 31, 44: 35, 45: 48, 46: 49, 47: 59, 48: 65, 49: 66, 50: 70, 51: 71, 52: 73, 53: 77, 54: 78, 55: 84, 56: 116, 57: 117, 58: 128, 59: 129, 60: 134, 61: 5, 62: 7, 63: 8, 64: 13, 65: 14, 66: 15, 67: 17, 68: 19, 69: 38, 70: 51, 71: 52, 72: 53, 73: 56, 74: 57, 75: 74, 76: 79, 77: 81, 78: 99, 79: 106, 80: 139, 81: 10, 82: 11, 83: 21, 84: 32, 85: 45, 86: 58, 87: 62, 88: 75, 89: 82, 90: 88, 91: 90, 92: 100, 93: 105, 94: 108, 95: 109, 96: 111, 97: 124, 98: 127, 99: 136, 100: 138, 101: 20, 102: 39, 103: 40, 104: 41, 105: 47, 106: 55, 107: 61, 108: 83, 109: 110, 110: 123, 111: 12, 112: 22, 113: 34, 114: 85, 115: 140},
"str": {126: 1, 76: 2, 101: 3, 1: 4, 51: 5, 52: 6, 132: 7, 102: 8, 2: 9, 53: 10, 103: 11, 3: 12, 26: 13, 104: 14, 4: 15, 27: 16, 5: 17, 77: 18, 54: 19, 78: 20, 105: 21, 55: 22, 127: 23, 56: 24, 57: 25, 28: 26, 29: 27, 79: 28, 58: 29, 106: 30, 107: 31, 133: 32, 30: 33, 80: 34, 81: 35, 82: 36, 83: 37, 84: 38, 85: 39, 86: 40, 59: 41, 87: 42, 31: 43, 60: 44, 32: 45, 134: 46, 88: 47, 108: 48, 33: 49, 128: 50, 6: 51, 7: 52, 135: 53, 136: 54, 34: 55, 89: 56, 137: 57, 61: 58, 8: 59, 35: 60, 109: 61, 36: 62, 37: 63, 62: 64, 38: 65, 63: 66, 64: 67, 90: 68, 91: 69, 92: 70, 93: 71, 94: 72, 65: 73, 66: 74, 138: 75, 110: 76, 9: 77, 111: 78, 139: 79, 112: 80, 113: 81, 10: 82, 67: 83, 39: 84, 40: 85, 41: 86, 68: 87, 11: 88, 95: 89, 12: 90, 13: 91, 14: 92, 96: 93, 69: 94, 15: 95, 97: 96, 140: 97, 42: 99, 43: 100, 70: 101, 114: 102, 16: 103, 115: 104, 129: 105, 17: 106, 18: 107, 116: 108, 117: 109, 118: 110, 119: 111, 120: 112, 44: 113, 130: 114, 121: 115, 19: 116, 99: 117, 71: 118, 72: 119, 141: 120, 20: 121, 45: 123, 46: 124, 47: 125, 73: 126, 74: 127, 21: 128, 123: 129, 131: 130, 124: 131, 142: 132, 48: 133, 143: 134, 49: 135, 125: 136, 22: 137, 100: 138, 75: 139, 50: 140, 23: 141, 24: 142, 25: 143},
"mir": {103: 1, 291: 2, 205: 3, 1: 4, 154: 5, 2: 6, 155: 7, 292: 8, 293: 9, 52: 10, 206: 11, 156: 12, 104: 13, 256: 14, 3: 15, 53: 16, 324: 17, 207: 18, 105: 19, 157: 20, 294: 21, 54: 22, 55: 23, 4: 24, 257: 25, 106: 26, 107: 27, 158: 28, 5: 29, 159: 30, 108: 31, 295: 32, 56: 33, 109: 34, 208: 35, 160: 36, 161: 37, 162: 38, 258: 39, 110: 40, 209: 41, 111: 42, 112: 43, 6: 44, 57: 45, 163: 46, 164: 47, 296: 48, 297: 49, 113: 50, 165: 51, 259: 52, 7: 53, 58: 54, 166: 55, 59: 56, 210: 57, 167: 58, 168: 59, 114: 60, 298: 61, 325: 62, 299: 63, 211: 64, 60: 65, 115: 66, 116: 67, 8: 68, 212: 69, 260: 70, 117: 71, 261: 72, 9: 73, 10: 74, 61: 75, 11: 76, 12: 77, 118: 78, 119: 79, 62: 80, 63: 81, 169: 82, 170: 83, 213: 84, 120: 85, 171: 86, 13: 87, 300: 88, 262: 89, 172: 90, 263: 91, 64: 92, 121: 93, 14: 94, 301: 95, 65: 96, 15: 97, 214: 98, 16: 99, 215: 100, 17: 101, 18: 102, 19: 103, 122: 104, 123: 105, 173: 106, 174: 107, 302: 108, 175: 109, 176: 110, 66: 111, 326: 112, 67: 113, 216: 114, 217: 115, 124: 116, 347: 117, 348: 118, 349: 119, 350: 120, 125: 121, 264: 122, 218: 123, 219: 124, 177: 125, 178: 126, 179: 127, 180: 128, 220: 129, 327: 130, 126: 131, 127: 132, 265: 133, 303: 134, 68: 135, 221: 136, 181: 137, 128: 138, 266: 139, 69: 140, 267: 141, 268: 142, 20: 143, 182: 144, 304: 145, 305: 146, 183: 147, 21: 148, 184: 149, 129: 150, 22: 151, 335: 152, 336: 153, 337: 154, 338: 155, 23: 156, 24: 157, 222: 158, 70: 159, 223: 160, 269: 161, 224: 162, 130: 163, 270: 164, 185: 165, 225: 166, 71: 167, 72: 168, 306: 169, 271: 170, 186: 171, 307: 172, 226: 173, 227: 174, 272: 175, 308: 176, 25: 177, 26: 178, 309: 179, 310: 180, 228: 181, 73: 182, 27: 183, 74: 184, 75: 185, 76: 186, 77: 187, 78: 188, 229: 189, 131: 190, 311: 191, 79: 192, 312: 193, 343: 194, 344: 195, 345: 196, 346: 197, 328: 198, 28: 199, 29: 200, 230: 201, 80: 202, 231: 203, 232: 204, 30: 205, 132: 206, 31: 207, 32: 208, 133: 209, 313: 210, 314: 211, 33: 212, 315: 213, 273: 214, 134: 215, 316: 216, 331: 217, 332: 218, 333: 219, 334: 220, 81: 221, 82: 222, 83: 223, 233: 224, 274: 225, 34: 226, 84: 227, 85: 228, 275: 229, 135: 230, 187: 231, 234: 232, 276: 233, 188: 234, 35: 236, 136: 237, 86: 238, 317: 239, 87: 240, 189: 241, 277: 242, 236: 243, 190: 244, 137: 245, 278: 246, 138: 247, 36: 248, 279: 249, 329: 250, 237: 251, 238: 252, 37: 253, 318: 254, 88: 255, 239: 256, 89: 257, 280: 258, 281: 259, 90: 260, 282: 261, 191: 262, 240: 263, 241: 264, 242: 265, 139: 266, 140: 267, 38: 268, 141: 269, 91: 270, 283: 271, 142: 272, 92: 273, 39: 274, 192: 275, 143: 276, 319: 277, 93: 278, 40: 279, 144: 280, 145: 281, 284: 282, 41: 283, 146: 284, 193: 285, 243: 286, 194: 287, 147: 288, 195: 289, 42: 290, 244: 291, 94: 292, 339: 293, 340: 294, 341: 295, 342: 296, 148: 297, 196: 298, 95: 299, 320: 300, 96: 301, 97: 302, 98: 303, 330: 304, 197: 305, 321: 306, 198: 307, 43: 308, 99: 309, 100: 310, 149: 311, 199: 312, 245: 313, 246: 314, 247: 315, 248: 316, 322: 317, 285: 318, 249: 319, 250: 320, 44: 321, 150: 322, 101: 323, 323: 324, 200: 325, 45: 326, 251: 327, 286: 328, 201: 329, 202: 330, 252: 331, 151: 332, 46: 333, 253: 334, 47: 335, 287: 336, 102: 337, 288: 338, 254: 339, 203: 340, 289: 341, 152: 342, 255: 343, 48: 344, 290: 345, 49: 346, 50: 347, 204: 348, 153: 349, 51: 350},
"leg": {1: 8, 2: 10, 3: 13, 4: 14, 5: 47, 6: 48, 7: 58, 8: 65, 9: 66, 10: 67, 11: 71, 12: 75, 13: 78, 14: 93, 15: 105, 16: 109, 17: 110, 18: 111, 19: 119, 20: 123, 21: 133, 22: 135, 23: 137, 24: 147, 25: 150, 26: 162, 27: 167, 28: 178, 29: 188, 30: 193, 31: 198, 32: 213, 33: 222, 34: 227, 35: 235, 36: 240, 37: 248, 38: 250, 39: 266, 40: 276, 41: 287, 42: 290, 43: 294, 44: 3, 45: 16, 46: 23, 47: 25, 48: 35, 49: 37, 50: 63, 51: 68, 52: 72, 53: 76, 54: 77, 55: 85, 56: 88, 57: 89, 58: 91, 59: 96, 60: 102, 61: 132, 62: 136, 63: 144, 64: 161, 65: 172, 66: 190, 67: 201, 68: 202, 69: 203, 70: 217, 71: 221, 72: 223, 73: 224, 74: 226, 75: 233, 76: 236, 77: 242, 78: 246, 79: 262, 80: 263, 81: 267, 82: 278, 83: 286, 84: 299, 85: 300, 86: 310, 87: 1, 88: 12, 89: 32, 90: 40, 91: 45, 92: 51, 93: 57, 94: 60, 95: 62, 96: 81, 97: 82, 100: 104, 101: 112, 102: 118, 103: 120, 104: 121, 105: 122, 106: 126, 107: 131, 108: 134, 109: 143, 110: 164, 111: 171, 112: 179, 113: 184, 114: 194, 115: 205, 116: 241, 117: 249, 118: 259, 119: 261, 120: 2, 121: 308, 122: 272, 123: 273, 124: 279, 125: 285, 126: 289, 127: 296, 128: 297, 129: 298, 130: 4, 131: 215, 132: 24, 133: 29, 134: 31, 135: 33, 136: 43, 137: 44, 138: 53, 139: 54, 140: 55, 141: 56, 142: 64, 143: 70, 144: 79, 145: 83, 146: 84, 147: 87, 148: 94, 149: 100, 150: 103, 151: 108, 152: 128, 153: 130, 154: 152, 155: 153, 156: 154, 157: 155, 158: 163, 159: 182, 160: 199, 161: 204, 162: 206, 163: 209, 164: 247, 165: 253, 166: 264, 167: 39, 168: 291, 169: 292, 170: 293, 171: 295, 172: 304, 173: 7, 174: 17, 175: 20, 176: 26, 177: 41, 178: 49, 179: 50, 180: 52, 181: 61, 182: 69, 183: 73, 184: 74, 185: 80, 186: 86, 187: 90, 188: 101, 189: 106, 190: 125, 191: 129, 192: 149, 193: 168, 194: 176, 195: 180, 196: 195, 198: 207, 199: 208, 200: 216, 201: 219, 202: 225, 203: 232, 204: 239, 205: 252, 206: 254, 207: 257, 208: 258, 209: 277, 210: 281, 211: 301, 212: 303, 213: 305, 214: 306, 215: 307, 216: 5, 217: 15, 218: 18, 219: 21, 220: 22, 221: 27, 222: 28, 223: 36, 224: 46, 225: 59, 226: 95, 227: 107, 228: 114, 229: 115, 230: 117, 231: 127, 232: 138, 233: 139, 234: 140, 235: 141, 236: 142, 237: 146, 238: 148, 239: 157, 240: 158, 241: 160, 242: 169, 243: 170, 244: 175, 245: 183, 246: 185, 247: 189, 248: 191, 249: 200, 250: 210, 251: 211, 252: 212, 253: 214, 254: 229, 255: 230, 256: 231, 257: 243, 258: 244, 259: 245, 260: 251, 261: 255, 262: 265, 263: 159, 264: 268, 265: 270, 266: 271, 267: 275, 268: 282, 269: 284, 270: 309, 271: 9, 272: 11, 273: 19, 274: 30, 275: 34, 276: 38, 277: 92, 278: 97, 279: 113, 280: 124, 281: 151, 282: 156, 283: 165, 284: 166, 285: 173, 286: 174, 287: 177, 288: 186, 289: 187, 290: 196, 291: 218, 292: 220, 293: 228, 294: 237, 295: 238, 296: 256, 297: 274, 298: 288, 299: 302, 300: 6, 301: 42, 302: 116, 303: 145, 304: 181, 305: 192, 306: 234, 307: 260, 308: 269, 309: 280, 310: 283},
"mma": {4: 1, 1: 2, 2: 3, 3: 4, 13: 7, 16: 13, 20: 14, 7: 16, 18: 17, 14: 18, 24: 20, 23: 22, 22: 23, 32: 24, 17: 25, 29: 26, 25: 29, 26: 30, 34: 32, 30: 33, 35: 34, 33: 35, 43: 41, 46: 42, 41: 43, 48: 44, 49: 45, 42: 46, 50: 48, 52: 49, 45: 50, 44: 51, 55: 52, 51: 53, 59: 55, 57: 56, 56: 57, 53: 58, 58: 59, 63: 62, 64: 63, 65: 64, 62: 65, 67: 66, 68: 67, 70: 68, 66: 70, 74: 71, 71: 73, 75: 74, 76: 75, 73: 76, 84: 77, 82: 78, 77: 80, 78: 81, 89: 82, 87: 83, 85: 84, 86: 85, 80: 86, 88: 87, 81: 88, 92: 89, 83: 92, 98: 96, 96: 98, 102: 100, 100: 102, 106: 103, 107: 105, 105: 106, 110: 107, 111: 108, 112: 109, 108: 110, 116: 111, 117: 112, 109: 114, 120: 116, 114: 117, 131: 120, 103: 121, 127: 123, 121: 124, 123: 125, 124: 126, 133: 127, 125: 128, 128: 129, 126: 130, 129: 131, 130: 132, 134: 133, 132: 134, 138: 136, 136: 137, 137: 138, 148: 141, 141: 143, 146: 144, 143: 145, 144: 146, 145: 148, 157: 149, 149: 150, 156: 153, 150: 154, 153: 156, 154: 157, 163: 158, 158: 159, 159: 160, 160: 162, 162: 163, 172: 167, 174: 168, 170: 169, 168: 170, 167: 171, 187: 172, 175: 173, 169: 174, 184: 175, 173: 176, 190: 178, 178: 179, 179: 180, 180: 181, 181: 182, 186: 183, 192: 184, 182: 186, 188: 187, 171: 188, 183: 190, 176: 191, 191: 192, 195: 194, 194: 195, 204: 201, 221: 203, 208: 204, 201: 205, 210: 208, 213: 210, 217: 213, 216: 214, 214: 216, 218: 217, 205: 218, 203: 221},
"alp": {46: 1, 47: 2, 48: 3, 92: 4, 1: 5, 230: 6, 2: 7, 184: 8, 93: 9, 277: 10, 3: 11, 231: 12, 278: 13, 4: 14, 185: 15, 186: 16, 94: 17, 232: 18, 233: 19, 5: 20, 6: 21, 7: 22, 49: 23, 8: 24, 95: 25, 50: 26, 138: 27, 187: 28, 9: 29, 234: 30, 188: 31, 235: 32, 139: 33, 10: 35, 11: 36, 12: 37, 13: 38, 236: 39, 51: 40, 189: 41, 14: 42, 237: 43, 96: 44, 52: 45, 15: 46, 238: 47, 53: 48, 54: 49, 190: 50, 55: 51, 16: 52, 239: 53, 97: 54, 240: 55, 98: 56, 99: 57, 17: 58, 100: 59, 101: 60, 102: 61, 103: 62, 104: 63, 241: 64, 18: 65, 140: 66, 242: 67, 141: 68, 105: 69, 56: 70, 106: 71, 142: 72, 143: 73, 144: 74, 145: 75, 146: 76, 191: 77, 107: 78, 147: 79, 19: 80, 192: 81, 108: 82, 57: 83, 148: 84, 149: 85, 150: 86, 151: 87, 58: 88, 193: 89, 194: 90, 243: 91, 294: 92, 295: 93, 152: 95, 109: 96, 195: 97, 196: 98, 244: 99, 197: 100, 198: 101, 245: 102, 110: 103, 153: 104, 154: 105, 155: 106, 156: 107, 20: 108, 199: 109, 21: 110, 22: 111, 246: 112, 157: 113, 272: 114, 23: 115, 24: 116, 111: 117, 247: 118, 158: 119, 200: 120, 112: 121, 201: 122, 248: 123, 249: 124, 202: 125, 59: 126, 250: 127, 159: 128, 203: 129, 288: 130, 289: 131, 25: 133, 251: 134, 252: 135, 253: 136, 254: 137, 255: 138, 60: 139, 26: 140, 160: 141, 256: 142, 204: 143, 27: 144, 205: 145, 257: 146, 113: 147, 206: 148, 207: 149, 61: 150, 161: 151, 208: 152, 209: 153, 258: 154, 210: 155, 62: 156, 114: 157, 211: 158, 63: 159, 64: 160, 162: 161, 65: 162, 259: 163, 163: 164, 260: 165, 66: 166, 28: 167, 115: 168, 164: 169, 292: 170, 293: 171, 261: 173, 262: 174, 263: 175, 264: 176, 265: 177, 212: 178, 116: 179, 117: 180, 266: 181, 118: 182, 29: 183, 267: 184, 165: 185, 166: 186, 119: 187, 30: 188, 31: 189, 120: 190, 67: 191, 68: 192, 69: 193, 70: 194, 121: 195, 286: 196, 287: 197, 279: 199, 71: 200, 72: 201, 167: 202, 73: 203, 74: 204, 75: 205, 32: 206, 168: 207, 122: 208, 169: 209, 33: 210, 213: 211, 214: 212, 34: 213, 35: 214, 36: 215, 170: 216, 171: 217, 268: 218, 123: 219, 124: 220, 37: 221, 280: 222, 38: 223, 125: 224, 126: 225, 281: 226, 215: 227, 76: 228, 172: 229, 127: 230, 39: 231, 216: 232, 173: 233, 174: 234, 128: 235, 129: 236, 77: 237, 78: 238, 175: 239, 269: 240, 270: 241, 79: 242, 80: 243, 81: 244, 176: 245, 177: 246, 217: 247, 271: 248, 290: 249, 291: 250, 40: 252, 282: 253, 130: 254, 218: 255, 82: 256, 273: 257, 219: 258, 274: 259, 83: 260, 84: 261, 220: 262, 283: 263, 221: 264, 284: 265, 178: 266, 85: 267, 179: 268, 285: 269, 131: 270, 86: 271, 180: 272, 222: 273, 87: 274, 41: 275, 88: 276, 89: 278, 132: 279, 223: 280, 181: 281, 224: 282, 182: 283, 42: 284, 90: 285, 225: 286, 226: 287, 227: 288, 133: 289, 91: 290, 134: 291, 228: 292, 183: 293, 43: 294, 44: 295, 229: 296, 135: 297, 298: 275, 276: 299, 136: 300, 45: 301, 137: 302, 275: 298},
"abu": {47: 1, 48: 2, 49: 3, 93: 4, 1: 5, 231: 6, 2: 7, 185: 8, 94: 9, 278: 10, 3: 11, 232: 12, 279: 13, 4: 14, 186: 15, 187: 16, 95: 17, 233: 18, 234: 19, 5: 20, 6: 21, 7: 22, 50: 23, 8: 24, 96: 25, 51: 26, 139: 27, 188: 28, 9: 29, 235: 30, 189: 31, 236: 32, 140: 33, 10: 34, 11: 35, 12: 36, 13: 37, 14: 38, 237: 39, 52: 40, 190: 41, 15: 42, 238: 43, 97: 44, 53: 45, 16: 46, 239: 47, 54: 48, 55: 49, 191: 50, 56: 51, 17: 52, 240: 53, 98: 54, 241: 55, 99: 56, 100: 57, 18: 58, 101: 59, 102: 60, 103: 61, 104: 62, 105: 63, 242: 64, 19: 65, 141: 66, 243: 67, 142: 68, 106: 69, 57: 70, 107: 71, 143: 72, 144: 73, 145: 74, 146: 75, 147: 76, 192: 77, 108: 78, 148: 79, 20: 80, 193: 81, 109: 82, 58: 83, 149: 84, 150: 85, 151: 86, 152: 87, 59: 88, 194: 89, 195: 90, 244: 91, 300: 92, 301: 93, 302: 94, 153: 95, 110: 96, 196: 97, 197: 98, 245: 99, 198: 100, 199: 101, 246: 102, 111: 103, 154: 104, 155: 105, 156: 106, 157: 107, 21: 108, 200: 109, 22: 110, 23: 111, 247: 112, 158: 113, 273: 114, 24: 115, 25: 116, 112: 117, 248: 118, 159: 119, 201: 120, 113: 121, 202: 122, 249: 123, 250: 124, 203: 125, 60: 126, 251: 127, 160: 128, 204: 129, 291: 130, 292: 131, 293: 132, 26: 133, 252: 134, 253: 135, 254: 136, 255: 137, 256: 138, 61: 139, 27: 140, 161: 141, 257: 142, 205: 143, 28: 144, 206: 145, 258: 146, 114: 147, 207: 148, 208: 149, 62: 150, 162: 151, 209: 152, 210: 153, 259: 154, 211: 155, 63: 156, 115: 157, 212: 158, 64: 159, 65: 160, 163: 161, 66: 162, 260: 163, 164: 164, 261: 165, 67: 166, 29: 167, 116: 168, 165: 169, 297: 170, 298: 171, 299: 172, 262: 173, 263: 174, 264: 175, 265: 176, 266: 177, 213: 178, 117: 179, 118: 180, 267: 181, 119: 182, 30: 183, 268: 184, 166: 185, 167: 186, 120: 187, 31: 188, 32: 189, 121: 190, 68: 191, 69: 192, 70: 193, 71: 194, 122: 195, 288: 196, 289: 197, 290: 198, 280: 199, 72: 200, 73: 201, 168: 202, 74: 203, 75: 204, 76: 205, 33: 206, 169: 207, 123: 208, 170: 209, 34: 210, 214: 211, 215: 212, 35: 213, 36: 214, 37: 215, 171: 216, 172: 217, 269: 218, 124: 219, 125: 220, 38: 221, 281: 222, 39: 223, 126: 224, 127: 225, 282: 226, 216: 227, 77: 228, 173: 229, 128: 230, 40: 231, 217: 232, 174: 233, 175: 234, 129: 235, 130: 236, 78: 237, 79: 238, 176: 239, 270: 240, 271: 241, 80: 242, 81: 243, 82: 244, 177: 245, 178: 246, 218: 247, 272: 248, 294: 249, 295: 250, 296: 251, 41: 252, 283: 253, 131: 254, 219: 255, 83: 256, 274: 257, 220: 258, 275: 259, 84: 260, 85: 261, 221: 262, 284: 263, 222: 264, 285: 265, 179: 266, 86: 267, 180: 268, 286: 269, 132: 270, 87: 271, 181: 272, 223: 273, 88: 274, 42: 275, 89: 276, 287: 277, 90: 278, 133: 279, 224: 280, 182: 281, 225: 282, 183: 283, 43: 284, 91: 285, 226: 286, 227: 287, 228: 288, 134: 289, 92: 290, 135: 291, 229: 292, 184: 293, 44: 294, 45: 295, 230: 296, 136: 297, 276: 298, 277: 299, 137: 300, 46: 301, 138: 302},
"ice": {113: 1, 306: 2, 1: 3, 351: 4, 307: 5, 169: 6, 281: 7, 308: 8, 170: 9, 2: 10, 309: 11, 310: 12, 311: 13, 3: 14, 4: 15, 57: 16, 114: 17, 225: 18, 171: 19, 172: 20, 226: 21, 58: 22, 173: 23, 59: 24, 174: 25, 312: 26, 313: 27, 5: 28, 175: 29, 60: 30, 6: 31, 7: 32, 8: 33, 227: 34, 9: 35, 176: 36, 61: 37, 177: 38, 62: 39, 115: 40, 228: 41, 352: 42, 116: 43, 10: 44, 11: 45, 314: 46, 282: 47, 178: 48, 179: 49, 283: 50, 229: 51, 12: 52, 13: 53, 14: 54, 15: 55, 16: 56, 63: 57, 117: 58, 17: 59, 180: 60, 18: 61, 64: 62, 315: 63, 181: 64, 118: 65, 119: 66, 120: 67, 19: 68, 65: 69, 121: 70, 316: 71, 284: 72, 230: 73, 20: 74, 122: 75, 66: 76, 123: 77, 21: 78, 182: 79, 285: 80, 231: 81, 232: 82, 286: 83, 317: 84, 22: 85, 23: 86, 24: 87, 67: 88, 68: 89, 183: 90, 233: 91, 69: 92, 287: 93, 234: 94, 124: 95, 288: 96, 289: 97, 184: 98, 185: 99, 290: 100, 125: 101, 235: 102, 236: 103, 70: 104, 381: 105, 382: 106, 383: 107, 237: 108, 25: 109, 126: 110, 238: 111, 239: 112, 240: 113, 241: 114, 291: 115, 26: 116, 318: 117, 242: 118, 243: 119, 244: 120, 245: 121, 186: 122, 127: 123, 128: 124, 27: 125, 292: 126, 246: 127, 293: 128, 353: 129, 187: 130, 71: 131, 294: 132, 319: 133, 188: 134, 189: 135, 190: 136, 191: 137, 247: 138, 129: 139, 28: 140, 192: 141, 29: 142, 354: 143, 30: 144, 130: 145, 320: 146, 31: 147, 131: 148, 248: 149, 132: 150, 249: 151, 133: 152, 72: 153, 295: 154, 321: 155, 355: 156, 73: 157, 134: 158, 322: 159, 74: 160, 75: 161, 76: 162, 77: 163, 78: 164, 79: 165, 193: 166, 194: 167, 135: 168, 136: 169, 323: 170, 80: 171, 369: 172, 370: 173, 371: 174, 324: 175, 325: 176, 326: 177, 250: 178, 195: 179, 251: 180, 32: 181, 356: 182, 196: 183, 197: 184, 33: 185, 137: 186, 34: 187, 296: 188, 35: 189, 36: 190, 37: 191, 38: 192, 39: 193, 40: 194, 41: 195, 138: 196, 139: 197, 140: 198, 81: 199, 141: 200, 357: 201, 327: 202, 198: 203, 358: 204, 142: 205, 143: 206, 144: 207, 252: 208, 42: 209, 145: 210, 146: 211, 43: 212, 253: 213, 254: 214, 82: 215, 328: 216, 199: 217, 200: 218, 201: 219, 44: 220, 297: 221, 83: 222, 202: 223, 147: 224, 148: 225, 149: 226, 150: 227, 151: 228, 84: 229, 152: 230, 298: 231, 153: 232, 377: 233, 378: 234, 379: 235, 203: 236, 299: 237, 204: 238, 85: 239, 86: 240, 87: 241, 329: 242, 330: 243, 255: 244, 154: 245, 155: 246, 156: 247, 331: 248, 205: 249, 206: 250, 207: 251, 208: 252, 209: 253, 210: 254, 211: 255, 45: 256, 46: 257, 256: 258, 212: 259, 332: 260, 157: 261, 88: 262, 333: 263, 365: 264, 366: 265, 367: 266, 89: 267, 90: 268, 91: 269, 158: 270, 47: 271, 257: 272, 258: 273, 213: 274, 214: 275, 48: 276, 92: 277, 93: 278, 94: 279, 300: 280, 49: 281, 259: 282, 260: 283, 261: 284, 359: 285, 334: 286, 215: 287, 50: 288, 262: 289, 95: 290, 159: 291, 51: 292, 263: 293, 216: 294, 52: 295, 335: 296, 96: 297, 97: 298, 98: 299, 301: 300, 336: 301, 99: 302, 100: 303, 337: 304, 53: 305, 380: 306, 368: 307, 376: 308, 364: 309, 372: 310, 264: 311, 101: 312, 338: 313, 102: 314, 339: 315, 160: 316, 103: 317, 161: 318, 162: 319, 302: 320, 163: 321, 164: 322, 340: 323, 265: 324, 165: 325, 217: 326, 218: 327, 219: 328, 303: 329, 304: 330, 166: 331, 266: 332, 360: 333, 341: 334, 373: 335, 374: 336, 375: 337, 54: 338, 267: 339, 268: 340, 269: 341, 104: 342, 361: 343, 342: 344, 270: 345, 220: 346, 221: 347, 167: 348, 271: 349, 272: 350, 362: 351, 105: 352, 343: 353, 363: 354, 273: 355, 222: 356, 344: 357, 345: 358, 346: 359, 223: 360, 274: 361, 347: 362, 348: 363, 55: 364, 349: 365, 56: 366, 275: 367, 276: 368, 277: 369, 106: 370, 305: 371, 107: 372, 168: 373, 278: 374, 279: 375, 224: 376, 108: 377, 109: 378, 280: 379, 110: 380, 111: 381, 350: 382, 112: 383},
"xln": {13: 7, 19: 11, 7: 13, 24: 14, 11: 19, 27: 21, 14: 24, 33: 25, 34: 26, 21: 27, 42: 31, 25: 33, 26: 34, 31: 42, 44: 43, 43: 44, 54: 50, 50: 54, 58: 57, 57: 58, 66: 59, 59: 61, 61: 66, 74: 302, 71: 74, 82: 78, 78: 82, 93: 92, 94: 93, 92: 94, 99: 97, 104: 98, 98: 99, 97: 100, 106: 101, 107: 102, 101: 104, 100: 106, 102: 107, 117: 113, 118: 115, 113: 117, 115: 118, 122: 121, 121: 122, 129: 125, 125: 129, 141: 136, 136: 141, 154: 153, 153: 154, 166: 161, 167: 165, 161: 166, 165: 167, 172: 170, 170: 172, 182: 179, 179: 181, 181: 182, 184: 183, 185: 184, 183: 185, 192: 189, 189: 190, 193: 191, 190: 192, 191: 301, 200: 199, 199: 200, 206: 204, 204: 206, 213: 209, 215: 212, 209: 213, 212: 215, 221: 217, 217: 221, 225: 222, 226: 223, 222: 225, 223: 226, 229: 227, 232: 229, 235: 304, 227: 232, 230: 235, 255: 254, 254: 255, 290: 280, 293: 281, 294: 282, 297: 283, 250: 284, 298: 285, 299: 286, 286: 287, 287: 288, 288: 289, 289: 290, 280: 291, 281: 292, 282: 293, 283: 294, 284: 295, 285: 296, 243: 297, 234: 298, 249: 299, 90: 300, 22: 303, 296: 305, 295: 306, 292: 307, 291: 308, 173: 309, 300: 310},
"rtr": {12: 11, 11: 12, 69: 68, 68: 69, 74: 73, 73: 74, 98: 90, 90: 98, 101: 99, 99: 101, 104: 103, 103: 104, 150: 105, 105: 106, 183: 120, 127: 126, 126: 127, 106: 150, 203: 158, 205: 163, 207: 172, 215: 174, 217: 176, 185: 183, 120: 185, 158: 203, 163: 205, 172: 207, 174: 215, 176: 217, 233: 231, 235: 233, 231: 235, 237: 236, 236: 237, 255: 251, 262: 252, 265: 253, 270: 254, 251: 255, 252: 256, 253: 257, 254: 258, 256: 259, 257: 260, 258: 261, 259: 262, 260: 265, 261: 266, 266: 270},
"eld": {141: 140, 140: 141, 147: 146, 146: 147, 189: 187, 187: 189},
"avr": {22: 9, 37: 11, 31: 14, 17: 15, 15: 17, 27: 18, 18: 22, 26: 23, 23: 25, 32: 26, 30: 27, 9: 28, 28: 30, 33: 31, 34: 32, 14: 33, 25: 34, 40: 36, 11: 37, 39: 38, 38: 39, 36: 40, 45: 42, 54: 43, 42: 45, 49: 46, 52: 47, 47: 48, 46: 49, 82: 50, 67: 51, 51: 52, 43: 54, 76: 56, 56: 58, 58: 59, 59: 60, 60: 62, 65: 63, 63: 65, 48: 67, 72: 71, 71: 72, 62: 75, 75: 76, 96: 82, 86: 85, 85: 86, 99: 87, 89: 88, 91: 89, 87: 90, 88: 91, 125: 93, 115: 94, 50: 96, 94: 98, 123: 99, 90: 100, 98: 103, 114: 108, 108: 114, 119: 115, 103: 116, 120: 117, 116: 119, 117: 120, 100: 123, 93: 124, 124: 125, 127: 126, 126: 127, 165: 131, 138: 135, 150: 136, 136: 137, 135: 138, 140: 139, 160: 140, 145: 142, 163: 143, 147: 144, 137: 145, 142: 147, 143: 149, 149: 150, 153: 152, 131: 153, 144: 154, 152: 155, 155: 156, 139: 160, 154: 162, 156: 163, 162: 165, 170: 168, 196: 169, 169: 170, 184: 174, 179: 178, 201: 179, 174: 180, 180: 181, 181: 184, 168: 186, 192: 188, 190: 189, 200: 190, 197: 192, 186: 195, 195: 196, 188: 197, 210: 200, 178: 201, 204: 202, 202: 204, 189: 210, 225: 213, 219: 214, 221: 215, 222: 219, 223: 220, 215: 221, 214: 222, 220: 223, 213: 225},
"cmd": {207: 1, 118: 2, 7: 3, 213: 4, 216: 5, 204: 6, 230: 7, 215: 8, 235: 9, 196: 11, 227: 12, 234: 13, 261: 14, 184: 15, 253: 16, 98: 17, 4: 18, 65: 19, 229: 20, 210: 21, 178: 22, 181: 23, 147: 24, 33: 32, 32: 33, 52: 46, 56: 51, 46: 52, 51: 56, 63: 62, 62: 63, 19: 65, 97: 91, 99: 92, 16: 93, 91: 97, 93: 98, 92: 99, 103: 101, 101: 103, 107: 105, 105: 107, 115: 114, 114: 115, 2: 118, 141: 128, 135: 129, 129: 135, 128: 138, 138: 141, 24: 147, 171: 170, 170: 171, 22: 178, 23: 181, 15: 184, 11: 196, 205: 204, 6: 205, 1: 207, 21: 210, 18: 213, 219: 215, 8: 216, 220: 219, 5: 220, 12: 225, 225: 227, 20: 229, 232: 230, 3: 232, 13: 234, 236: 235, 9: 236, 240: 238, 238: 240, 247: 244, 244: 247, 17: 253, 14: 261},
"cmm": {395: 295, 318: 316, 316: 318, 295: 395, 610: 563, 563: 610},
"13m": {3: 2, 2: 3, 15: 13, 13: 14, 14: 15, 21: 20, 20: 21, 29: 27, 27: 29, 31: 30, 35: 31, 30: 32, 32: 35, 43: 42, 42: 43, 53: 51, 51: 52, 55: 53, 52: 54, 57: 55, 54: 57, 61: 59, 59: 61, 68: 67, 69: 68, 67: 69, 73: 72, 72: 73, 77: 74, 74: 75, 78: 76, 75: 77, 76: 78, 87: 82, 89: 84, 88: 85, 82: 87, 85: 88, 84: 89, 94: 93, 95: 94, 93: 95, 98: 97, 97: 98, 117: 115, 115: 117, 126: 125, 125: 126, 134: 133, 139: 134, 133: 135, 146: 136, 147: 137, 135: 139, 149: 141, 136: 144, 144: 145, 145: 146, 137: 147, 141: 149, 151: 150, 150: 151, 156: 154, 157: 155, 154: 156, 155: 157, 160: 159, 159: 160, 194: 161, 161: 162, 166: 165, 168: 166, 165: 168, 172: 171, 171: 172, 174: 173, 175: 174, 173: 175, 191: 187, 190: 188, 187: 189, 193: 190, 162: 191, 188: 193, 189: 194, 198: 196, 196: 198, 213: 204, 208: 207, 207: 208, 216: 211, 204: 213, 217: 214, 214: 216, 211: 217},
"psa": {164: 12, 12: 13, 13: 14, 14: 15, 15: 16, 16: 17, 17: 18, 18: 19, 19: 20, 20: 21, 21: 22, 22: 23, 23: 24, 24: 25, 25: 26, 26: 27, 27: 28, 28: 29, 165: 30, 29: 31, 30: 32, 31: 33, 32: 34, 33: 35, 34: 36, 35: 37, 36: 38, 37: 39, 38: 40, 39: 41, 40: 42, 41: 43, 42: 44, 43: 45, 44: 46, 45: 47, 46: 48, 47: 49, 48: 50, 49: 51, 50: 52, 51: 53, 52: 54, 53: 55, 54: 56, 55: 57, 56: 58, 57: 59, 58: 60, 59: 61, 60: 62, 61: 63, 62: 64, 63: 65, 64: 66, 65: 67, 66: 68, 67: 69, 68: 70, 69: 71, 70: 72, 71: 73, 72: 74, 73: 75, 74: 76, 75: 77, 76: 78, 77: 79, 78: 80, 79: 81, 80: 82, 81: 83, 82: 84, 83: 85, 84: 86, 85: 87, 86: 88, 87: 89, 88: 90, 89: 91, 90: 92, 91: 93, 92: 94, 93: 95, 94: 96, 95: 97, 96: 98, 97: 99, 98: 100, 99: 101, 100: 102, 101: 103, 102: 104, 103: 105, 104: 106, 105: 107, 106: 108, 107: 109, 108: 110, 109: 111, 110: 112, 111: 113, 112: 114, 113: 115, 114: 116, 115: 117, 116: 118, 117: 119, 118: 120, 119: 121, 120: 122, 121: 123, 122: 124, 123: 125, 124: 126, 125: 127, 126: 128, 127: 129, 128: 130, 129: 131, 130: 132, 131: 133, 132: 134, 133: 135, 134: 136, 135: 137, 136: 138, 137: 139, 138: 140, 139: 141, 140: 142, 141: 143, 142: 144, 143: 145, 144: 146, 145: 147, 146: 148, 147: 149, 148: 150, 149: 151, 150: 152, 151: 153, 152: 154, 153: 155, 154: 156, 155: 157, 156: 158, 157: 159, 158: 160, 159: 161, 160: 162, 161: 163, 162: 164, 163: 165},
"por": {1:1, 2:2, 3:3, 4:4, 5:5, 6:6, 7:7, 8:8, 9:9, 10:10, 11:11, 12:12, 13:13, 14:14, 15:15, 16:16, 17:17, 18:18, 19:19, 20:20, 21:21, 22:22, 23:23, 24:24, 25:25, 26:26, 27:27, 28:28, 29:29, 30:30, 31:31, 32:32, 33:33, 34:34, 35:35, 36:36, 37:37, 38:38, 39:40, 40:41, 41:42, 42:43, 43:44, 44:45, 45:46, 46:47, 47:48, 48:49, 49:50, 50:51, 51:52, 52:54, 53:53, 54:55, 55:56, 56:57, 57:58, 58:59, 59:60, 60:61, 61:62, 62:63, 63:64, 64:65, 65:66, 66:67, 67:68, 68:69, 69:70, 70:71, 71:72, 72:73, 73:74, 74:75, 75:76, 76:77, 77:78, 78:79, 79:80, 80:81, 81:82, 82:83, 83:84, 84:85, 85:86, 86:87, 87:88, 88:89, 89:90, 90:91, 91:92, 92:93, 93:94, 94:95, 95:96, 96:97, 97:99, 98:100, 99:101, 100:102, 101:103, 102:104, 103:105, 104:106, 105:107, 106:108, 107:109, 108:110, 109:111, 110:112, 111:113, 112:114, 113:115, 114:116, 115:117, 116:118, 117:119, 118:120, 119:122, 120:123, 121:124, 122:125, 123:126, 124:127, 125:128, 126:129, 127:130, 128:131, 129:132, 130:133, 131:134, 132:135, 133:136, 134:137, 135:138, 136:139, 137:140, 138:141, 139:142, 140:143, 141:144, 142:145, 143:146, 144:147, 145:148, 146:150, 147:151, 148:152, 149:153, 150:154, 151:155, 152:156, 153:157, 154:158, 155:159, 156:160, 157:161, 158:162, 159:164, 160:165, 161:166, 162:167, 163:168, 164:170, 165:171, 166:172, 167:174, 168:175, 169:176, 170:177, 171:178, 172:179, 173:180, 174:181, 175:182, 176:183, 177:184, 178:185, 179:186, 180:187, 181:188, 182:189, 183:190, 184:191, 185:192, 186:193, 187:194, 188:195, 189:196, 190:197, 191:198, 192:199, 193:200, 194:201, 195:202},
}
# fmt: on
override_pic: dict[str, str] = {
"pics/art/isd/105_1.jpg": "pics/art/isd/105.jpg",
"pics/art/c19/005_1.jpg": "pics/art/c19/005.jpg",
"pics/art/isd/078_1.jpg": "pics/art/isd/078_2.jpg",
"pics/art/war/061.jpg": "pics/art/war/061_1.jpg",
"pics/art/war/002.jpg": "pics/art/war/002_1.jpg",
"pics/art/alp/002.jpg": "pics/art/alp/002_1.jpg",
"pics/art/leg/172_1.jpg": "pics/art/leg/172.jpg",
"pics/art/zen/119.jpg": "pics/art/zen/119_1.jpg",
"pics/art/war/171.jpg": "pics/art/war/171_1.jpg",
"pics/art/war/169.jpg": "pics/art/war/169_1.jpg",
"pics/art/woe/252_1.jpg": "pics/art/woe/252.jpg",
"pics/art/war/221.jpg": "pics/art/war/221_1.jpg",
"pics/art/war/234.jpg": "pics/art/war/234_1.jpg",
"pics/art/war/220.jpg": "pics/art/war/220_1.jpg",
"pics/art/mh2/075_1.jpg": "pics/art/mh2/075.jpg",
"pics/art/con/121_3.jpg": "pics/art/con/121_4.jpg",
"pics/art/dis/099_1.jpg": "pics/art/dis/099_2.jpg",
"pics/art/drs/148_1.jpg": "pics/art/drs/148_2.jpg",
"pics/art/mbs/099_1.jpg": "pics/art/mbs/099_2.jpg",
"pics/art/mid/707_1.jpg": "pics/art/mid/007.jpg",
"pics/art/nph/004.jpg": "pics/art/nph/004_1.jpg",
"pics/art/ivg/021.jpg": "pics/art/ivg/021_2.jpg",
"pics/art/tsp/262_1.jpg": "pics/art/tsp/262_2.jpg",
"pics/art/zen/211_3.jpg": "pics/art/zen/211_2.jpg",
"pics/art/zen/219_1.jpg": "pics/art/zen/219.jpg",
"pics/art/zen/220_1.jpg": "pics/art/zen/220.jpg",
"pics/art/zen/223_1.jpg": "pics/art/zen/223.jpg",
"pics/art/zen/229_2.jpg": "pics/art/zen/229.jpg",
"pics/art/znr/503.jpg": "pics/art/znr/260.jpg",
"pics/art/znr/260.jpg": "pics/art/znr/503.jpg",
"pics/art/znr/264.jpg": "pics/art/znr/506.jpg",
"pics/art/znr/506.jpg": "pics/art/znr/264.jpg",
"pics/art/nph/042_1.jpg": "pics/art/nph/042.jpg",
"pics/art/isd/282.jpg": "pics/art/isd/051.jpg",
"pics/art/isd/051.jpg": "pics/art/isd/282.jpg",
"pics/art/apo/128.jpg": "pics/art/apo/129.jpg",
"pics/art/apo/129.jpg": "pics/art/apo/128.jpg",
"pics/art/dom/001_1.jpg": "pics/art/dom/001_2.jpg",
"pics/art/alp/049_1.jpg": "pics/art/alp/049_2.jpg",
"pics/art/mh3/4004.jpg": "pics/art/mh3/242.jpg",
"pics/art/mh3/242.jpg": "pics/art/mh3/4004.jpg",
}

140
mkoldproxy/parser.py Normal file
View file

@ -0,0 +1,140 @@
from dataclasses import dataclass
from itertools import zip_longest
from typing import Literal, TypeAlias
from PIL.ImageFont import FreeTypeFont
from .render import Line, Word, Chunk, Formatting
Alignment: TypeAlias = Literal["left"] | Literal["center"] | Literal["right"]
@dataclass
class State:
is_italics: bool
is_image: bool
def get_next_state(char: str, next_char: str, state: State) -> State:
italics = (
state.is_italics and char != ")" and next_char != ""
) or next_char == "("
image = (state.is_image and char != "}") or next_char == "{"
if next_char == "*":
italics = not italics
return State(italics, image)
def make_chunk(
text: str,
state: State,
font: FreeTypeFont,
font_i: FreeTypeFont,
alignment: Alignment,
parskip: float,
phantom_indent: str,
color: tuple[int, int, int],
) -> Chunk:
return Chunk(
Formatting(
font_i if state.is_italics else font,
state.is_image,
scale=0.8 if state.is_image else 1.0,
color=color,
alignment=alignment,
parskip=parskip,
offset_perc=0.1 if state.is_image else 0.0,
phantom_indent=phantom_indent,
),
text,
)
def parse(
text: str,
font: FreeTypeFont,
font_i: FreeTypeFont,
parskip: float = 1.1,
alignment: Alignment = "left",
start_italics=False,
phantom_indent="",
color: tuple[int, int, int] = (0, 0, 0),
) -> Line:
state = State(start_italics or text[0] == "(", text[0] == "{")
next_state = State(False, False)
chunk_str: str = ""
word: list[Chunk] = []
line: list[Word] = []
if text[0] == "":
phantom_indent = ""
parskip = 1.0
if "" in text and text[0] != "":
state.is_italics = True
if (
"choose" in text
or "Choose" in text
or "Ward—" in text
or "Impending" in text
or "Escalate" in text
or "Companion" in text
or "Boast" in text
or "Escape" in text
or "Evoke" in text
or "Exhaust" in text
or "Prototype" in text
):
state.is_italics = False
for char, next_char in zip_longest(text, text[1:]):
next_state = get_next_state(char, next_char, state)
if char == " ":
word.append(
make_chunk(
chunk_str,
state,
font,
font_i,
alignment,
parskip,
phantom_indent,
color,
)
)
chunk_str = ""
line.append(word)
word = []
else:
chunk_str += char if char not in "{}*" else ""
if state != next_state or next_char == "{":
word.append(
make_chunk(
chunk_str,
state,
font,
font_i,
alignment,
parskip,
phantom_indent,
color,
)
)
chunk_str = ""
state = next_state
if chunk_str:
word.append(
make_chunk(
chunk_str,
next_state,
font,
font_i,
alignment,
parskip,
phantom_indent,
color,
)
)
if word:
line.append(word)
return line

499
mkoldproxy/render.py Normal file
View file

@ -0,0 +1,499 @@
from dataclasses import dataclass, field
from typing import Literal, Optional, TypeAlias
from PIL import Image, ImageDraw, ImageFont
import math
from .resources import get_symbol_resource
class BoundingBoxExceeded(Exception):
pass
@dataclass
class Formatting:
font: ImageFont.FreeTypeFont
is_image: bool = field(default=False)
scale: float = field(default=1.0)
color: tuple[int, int, int] = field(default=(0, 0, 0))
alignment: Literal["left"] | Literal["center"] | Literal["right"] = field(
default="center"
)
parskip: float = field(default=1.25)
offset_perc: float = 0.0
phantom_indent: str = ""
def get_font(self, font_offset: int) -> ImageFont.FreeTypeFont:
return self.font.font_variant(
size=int((self.font.size - font_offset) * self.scale)
)
@dataclass
class TypesetMeta:
top: int
bot: int
skip: float
font_size: int
space_length: int
alignment: Literal["left"] | Literal["center"] | Literal["right"]
parskip: float
indent: int
empty_space_perc: float = field(default=0)
@dataclass
class Chunk:
format: Formatting
text: str
Word: TypeAlias = list[Chunk]
Line: TypeAlias = list[Word]
def image_name_for_symbol(symbol: str) -> str:
stripped_name = symbol.replace("/", "").lower()
match stripped_name:
case "rb":
return "br"
return stripped_name
def render_chunk(
chunk: Chunk, font_offset: int, symbols: dict[str, Image.Image]
) -> tuple[Image.Image, TypesetMeta]:
font = chunk.format.get_font(font_offset)
space_length = math.ceil(font.getlength(" "))
indent = (
font.getlength(chunk.format.phantom_indent)
if chunk.format.phantom_indent
else 0
)
if chunk.format.is_image:
# symbol_full = Image.open(get_symbol_resource(f"{image_name_for_symbol(chunk.text)}.png"))
symbol_full = symbols[image_name_for_symbol(chunk.text)]
width = int(symbol_full.width / symbol_full.height * font.size)
symbol = symbol_full.resize((width, font.size))
image = Image.new(
"RGBA", (width + 2 * (space_length // 8), int(font.size)), (0, 0, 0, 0)
)
image.paste(symbol, (space_length // 8, 0))
return (
image,
TypesetMeta(
top=int(font.size * (1 - chunk.format.offset_perc)),
bot=int(font.size * chunk.format.offset_perc),
skip=image.width,
font_size=int(font.size),
space_length=space_length,
alignment=chunk.format.alignment,
parskip=chunk.format.parskip,
indent=int(indent),
),
)
else:
_, top_box, width, height = font.getbbox(chunk.text)
skip = font.getlength(chunk.text)
top, bot = font.getmetrics()
# print(top, bot)
if bot < 0:
bot = -bot
image = Image.new("RGBA", (width, top + bot), (0, 0, 0, 0))
canvas = ImageDraw.Draw(image)
canvas.text(
(0, top), chunk.text, anchor="ls", font=font, fill=chunk.format.color
)
return (
image,
TypesetMeta(
top=top,
bot=bot,
skip=skip,
font_size=font.size,
space_length=space_length,
alignment=chunk.format.alignment,
parskip=chunk.format.parskip,
indent=int(indent),
),
)
def render_word(
word: Word, font_offset: int, symbols: dict[str, Image.Image]
) -> tuple[Image.Image, TypesetMeta]:
rendered_chunks = [render_chunk(c, font_offset, symbols) for c in word]
max_top = max(meta.top for _, meta in rendered_chunks)
max_bot = max(meta.bot for _, meta in rendered_chunks)
max_font_size = max(meta.font_size for _, meta in rendered_chunks)
parskip = rendered_chunks[0][1].parskip
alignment = rendered_chunks[0][1].alignment
indent = rendered_chunks[0][1].indent
width = sum(img.width for img, _ in rendered_chunks)
height = max_top + max_bot
image = Image.new("RGBA", (width, height), (0, 0, 0, 0))
x = 0
for chunk_img, meta in rendered_chunks:
image.alpha_composite(chunk_img, (int(x), max_top - meta.top))
x += meta.skip
return (
image,
TypesetMeta(
top=max_top,
bot=max_bot,
skip=x,
font_size=max_font_size,
space_length=rendered_chunks[-1][1].space_length,
alignment=alignment,
parskip=parskip,
indent=indent,
),
)
def render_line(
line: Line,
font_offset: int,
max_width: int,
first_line: bool,
symbols: dict[str, Image.Image],
) -> tuple[Image.Image, Line, TypesetMeta]:
rendered_words: list[tuple[Image.Image, TypesetMeta]] = []
last_space_width = 0
width = 0
is_first_word = True
last_word = None
total_space_width = 0
for w in line:
w_img, meta = render_word(w, font_offset, symbols)
if is_first_word and not first_line:
width += meta.indent
is_first_word = False
if width + w_img.width >= max_width:
last_word = w_img, meta
break
else:
last_space_width = meta.space_length
width = width + meta.skip + meta.space_length
total_space_width += meta.space_length
rendered_words.append((w_img, meta))
micro_px = 0
if last_word is not None:
micro_max = int(last_word[1].font_size / 14)
overshoot = last_word[0].width
empty_space = max_width - width
diff = overshoot - empty_space
for micro_px in range(micro_max + 1):
if diff < micro_px * len(rendered_words):
# print(f"{micro_px=}")
rendered_words.append(last_word)
width = width + last_word[1].skip + last_space_width
break
width -= last_space_width
if width <= 0:
raise BoundingBoxExceeded
max_top = max(meta.top for _, meta in rendered_words)
max_bot = max(meta.bot for _, meta in rendered_words)
max_font_size = max(meta.font_size for _, meta in rendered_words)
alignment = rendered_words[0][1].alignment
parskip = rendered_words[0][1].parskip
indent = rendered_words[0][1].indent
height = max_top + max_bot
image = Image.new("RGBA", (int(width), height), (0, 0, 0, 0))
x = 0 if first_line else indent
for word_img, meta in rendered_words:
image.paste(word_img, (int(x), max_top - meta.top))
x += meta.skip + meta.space_length - micro_px
# x -= space_length
return (
image,
line[len(rendered_words) :],
TypesetMeta(
top=max_top,
bot=max_bot,
skip=x,
font_size=max_font_size,
space_length=last_space_width,
alignment=alignment,
parskip=parskip,
indent=indent,
empty_space_perc=(max_width - width) / max_width,
),
)
def render_line_wrapped(
line: Line,
font_offset: int,
max_width: int,
max_empty_space_perc: float,
symbols: dict[str, Image.Image],
) -> tuple[Image.Image, TypesetMeta]:
height = 0
lines: list[tuple[Image.Image, TypesetMeta]] = []
first_line = True
while line:
img, line, meta = render_line(line, font_offset, max_width, first_line, symbols)
lines.append((img, meta))
first_line = False
if line: # Check if this was not the last line
if meta.empty_space_perc > max_empty_space_perc:
raise BoundingBoxExceeded
height = sum(img.height for img, _ in lines)
_, first_meta = lines[0]
_, last_meta = lines[-1]
height = -first_meta.font_size + first_meta.top
for img, meta in lines:
height += meta.font_size
height += last_meta.bot
image = Image.new("RGBA", (max_width, height), (0, 0, 0, 0))
# canvas = ImageDraw.Draw(image)
y = -first_meta.font_size + first_meta.top
for rendered_line, meta in lines:
match first_meta.alignment:
case "left":
x = 0
case "right":
x = max_width - rendered_line.width
case "center":
x = (max_width - rendered_line.width) // 2
y += meta.font_size
image.alpha_composite(rendered_line, (x, y - meta.top))
# canvas.rectangle(
# (
# x,
# y - meta.top,
# x + rendered_line.width,
# y - meta.top + rendered_line.height,
# ),
# outline=(0, 0, 0),
# )
return image, first_meta
def render(
text: list[Line],
max_width: int,
max_height: int,
font_offset: int,
fill: bool,
symbols: dict[str, Image.Image],
) -> Image.Image:
image = Image.new("RGBA", (max_width, max_height), (0, 0, 0, 0))
max_empty_space_perc = 0.35 if fill else 0.2
paragraphs = [
render_line_wrapped(line, font_offset, max_width, max_empty_space_perc, symbols)
for line in text
]
space = int(
(max_height - sum(img.height for img, _ in paragraphs)) / (len(paragraphs))
)
_, first_meta = paragraphs[0]
y = (
-int(first_meta.font_size * first_meta.parskip - first_meta.top)
if not fill
else -space
)
for line, (p_img, meta) in zip(text, paragraphs):
y += int(meta.font_size * meta.parskip - meta.top) if not fill else space
image.alpha_composite(p_img, (0, y))
y += p_img.height
if y > max_height or space <= 0:
raise BoundingBoxExceeded
# canvas = ImageDraw.Draw(image)
# canvas.rectangle((0, 0, image.width - 1, y - 1), outline=(0, 255, 0))
cropped_image = image.crop((0, 0, image.width, y))
return cropped_image
def render_fit(
text: list[Line],
max_width: int,
max_height: int,
fill: bool,
symbols: dict[str, Image.Image],
) -> Image.Image:
offset = 0
while True:
try:
img = render(text, max_width, max_height, offset, fill, symbols)
break
except BoundingBoxExceeded:
offset += 1
# print(f"resize: {offset}")
return img
def render2(
text: list[list[tuple[Formatting, str]]],
max_width: int,
max_height: int,
parskip: float = 1.2,
font_offset: int = 0,
):
for paragraph in text:
x = 0
while paragraph:
format, group = paragraph.pop()
def render_old(
text: list[list[tuple[Formatting, str]]],
max_width: int,
max_height: int,
parskip: float = 1.2,
font_offset: int = 0,
):
image = Image.new("RGBA", (max_width, max_height), (0, 0, 0, 0))
canvas = ImageDraw.Draw(image)
font = text[0][0][0].font
last_text_fontsize = font.size
y, _ = font.getmetrics()
x = 0
max_x = 0
for paragraph in text:
x = 0
for format, group in paragraph:
fontsize = int((format.font.size - font_offset) * format.scale)
font = format.font.font_variant(size=fontsize)
if format.is_image:
spacing = font.getlength(" ") // 4
icons = [
Image.open("symbols/{symbol.lower()}.png").resize(
(fontsize, fontsize)
)
for symbol in group.split()
]
if x + fontsize * len(icons) + (len(icons) - 1) * spacing >= max_width:
max_x = max(max_x, x)
x = 0
y += last_text_fontsize
for icon in icons:
image.alpha_composite(icon, (int(x), int(y - 0.9 * fontsize)))
x += fontsize + spacing
x -= spacing
else:
last_text_fontsize = fontsize
fits_in_line = group.split(" ")
while fits_in_line:
does_not_fit = []
length = font.getlength(" ".join(fits_in_line))
while x + length >= max_width:
if not fits_in_line:
break
does_not_fit = [fits_in_line[-1]] + does_not_fit
fits_in_line = fits_in_line[:-1]
length = font.getlength(" ".join(fits_in_line))
canvas.text(
(x, y),
" ".join(fits_in_line),
anchor="ls",
font=font,
fill=format.color,
)
x += length
if does_not_fit:
max_x = max(max_x, x)
x = 0
y += fontsize
fits_in_line = does_not_fit
y += int((font.size - font_offset) * parskip)
_, bot = font.getmetrics()
max_y = y + bot - (font.size - font_offset) * parskip
if max_x > max_width or max_y > max_height:
raise BoundingBoxExceeded
return image, (max_x, max_y)
def test(mw: int):
font = ImageFont.truetype("./mplantin.ttf", size=40)
font2 = ImageFont.truetype("./mplantin-i.ttf", size=40)
l: Line = [
[Chunk(Formatting(font), "Test")],
[
Chunk(Formatting(font), "123"),
Chunk(Formatting(font2), "("),
Chunk(Formatting(font2, True, scale=0.8), "U"),
Chunk(Formatting(font2, True, scale=0.8), "G"),
Chunk(Formatting(font2, True, scale=0.8), "G"),
],
[Chunk(Formatting(font2), "is")],
[
Chunk(Formatting(font2), "both)"),
Chunk(Formatting(font, True, scale=0.8), "C"),
],
]
return render_line_wrapped(l, 0, mw)
def main(max_width, max_height=1200, parskip=1.2):
li = "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua."
li2 = "At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.XXXg"
fonti = ImageFont.truetype("./mplantin.ttf", size=28)
li_split = li.split(" ")
li2_split = li2.split(" ")
li_line: Line = [
[Chunk(Formatting(fonti, False, 1.0, (0, 0, 0)), w)] for w in li_split
]
li2_line: Line = [
[Chunk(Formatting(fonti, False, 1.0, (0, 0, 0)), w)] for w in li2_split
]
font = ImageFont.truetype("./mplantin.ttf", size=40)
font2 = ImageFont.truetype("./mplantin-i.ttf", size=40)
format = Formatting(font, False, 1.0, (0, 0, 0))
chunk = Chunk(format, "Test123")
format2 = Formatting(font, False, 2.0, (0, 0, 0))
chunk2 = Chunk(format2, "Test123")
word1 = [chunk, chunk2]
format3 = Formatting(font2, False, 1.4, (0, 255, 0))
word2: Word = [Chunk(format3, "Blubbl"), (Chunk(format2, "Dal"))]
# return render_line_wrapped([word1, word2], 0, max_width)
return render_fit([li_line, li2_line], max_width, max_height, parskip)

20
mkoldproxy/resources.py Normal file
View file

@ -0,0 +1,20 @@
import importlib.resources
from pathlib import Path
def get_font_resource(name, pack):
font_path = importlib.resources.files("oldproxy")
with importlib.resources.as_file(font_path / "fonts" / name) as font:
return font
def get_symbol_resource(name, pack):
symbol_path = importlib.resources.files("oldproxy")
with importlib.resources.as_file(symbol_path / "symbols" / name) as symbol:
return symbol
def get_border_resource(name, pack) -> Path:
border_path = importlib.resources.files("oldproxy")
with importlib.resources.as_file(border_path / "borders" / name) as border:
return border

309
mkoldproxy/scryfall_api.py Normal file
View file

@ -0,0 +1,309 @@
import re
from PIL import Image
from io import BytesIO
from typing import Any, Optional
from .datatypes import ArtInfo, Card, Face
from .mtgpics_overrides import art_override
from .art import find_artwork
from .cache_url import get
def get_card(
query_or_cardjson: str | dict[str, Any], art1: ArtInfo, art2: ArtInfo
) -> Card:
if isinstance(query_or_cardjson, dict):
card_json = query_or_cardjson
else:
response = get(f"https://api.scryfall.com/cards/search?q={query_or_cardjson}")
card_json = response.json()["data"][0]
mtg_set = card_json["set"]
cn = card_json["collector_number"]
cn_int = int("".join(c for c in cn if c in "0123456789"))
cn_add = "".join(c for c in cn if c not in "0123456789")
rarity = card_json["rarity"][0]
if rarity == "b":
rarity = "m"
layout = card_json["layout"]
#
# images: list[Optional[Image.Image]] = [None, None]
if art1.url is None:
if (mtg_set, cn_int) in art_override:
art1.merge(art_override[(mtg_set, cn_int)][0])
if art1.url is None:
try:
scryfall_art_url = card_json["image_uris"]["art_crop"]
except KeyError:
scryfall_art_url = card_json["card_faces"][0]["image_uris"]["art_crop"]
art1.url = find_artwork(mtg_set, cn, scryfall_art_url)
if art2.url is None:
if (mtg_set, cn_int) in art_override:
art2.merge(art_override[(mtg_set, cn_int)][1])
if art2.url is None:
try:
scryfall_art_url = card_json["image_uris"]["art_crop"]
except KeyError:
scryfall_art_url = card_json["card_faces"][1]["image_uris"]["art_crop"]
art2.url = find_artwork(mtg_set, cn, scryfall_art_url, True)
if art1.url is not None:
art1.image = Image.open(BytesIO(get(art1.url).content))
else:
raise RuntimeError(f"Could not find image for {mtg_set=} {cn=}")
if art2.url is not None:
art2.image = Image.open(BytesIO(get(art2.url).content))
if layout in ["split"]:
image_url = card_json["image_uris"]["art_crop"]
r = get(image_url)
image = Image.open(BytesIO(r.content))
if art1.image is None:
art1.image = image.crop((0, 0, image.width // 2, image.height))
if art2.image is None:
art2.image = image.crop((image.width // 2, 0, image.width, image.height))
faces = []
if "card_faces" in card_json:
if layout == "adventure":
produces = card_json.get("produced_mana")
for card in card_json["card_faces"]:
if "Land" in card["type_line"] and produces is not None:
card["produced_mana"] = produces[0]
produces = produces[1:]
card["set"] = card_json["set"]
card["collector_number"] = card_json["collector_number"]
card["image_uris"] = card_json["image_uris"]
faces.append(get_face(card, art1, layout))
else:
produces = card_json.get("produced_mana")
for art, card in zip([art1, art2], card_json["card_faces"]):
if "Land" in card["type_line"] and produces is not None:
card["produced_mana"] = guess_produces(card["oracle_text"])
# produces = produces[1:]
card["set"] = card_json["set"]
card["collector_number"] = card_json["collector_number"]
if art.image is None:
art.image = Image.open(
BytesIO(get(card["image_uris"]["art_crop"]).content)
)
faces.append(get_face(card, art, layout))
else:
faces = [get_face(card_json, art1, layout)]
return Card(
rarity=rarity,
layout=layout,
faces=faces,
cn=cn,
cn_int=cn_int,
cn_add=cn_add,
set=mtg_set,
)
def guess_produces(oracle_text: str) -> list[str]:
add_in_text = re.findall(r"[aA]dd ((?:{[WUBRGC]}\s?)*)", oracle_text)
colors_in_text = [char for char in add_in_text[0] if char in "WUBRGC"]
return colors_in_text
def get_super_type_sub(type_line: str) -> tuple[list[str], list[str], list[str]]:
available_super_types = ["Legendary", "Basic", "Snow", "Ongoing", "World"]
super_types: list[str] = []
types: list[str] = []
subtypes: list[str] = []
if "" in type_line:
type_line, snd = type_line.split("")
subtypes = snd.split(" ")
possible_types = type_line.split(" ")
super_types = [ty for ty in possible_types if ty in available_super_types]
types = [ty for ty in possible_types if ty not in available_super_types]
return sorted(super_types), sorted(types), sorted(subtypes)
def canonically_sort_dual_colors(colors: str) -> str:
colors = "".join(sorted(colors))
match colors:
case "BU":
return "UB"
case "BW":
return "WB"
case "GR":
return "RG"
case "RU":
return "UR"
case "UW":
return "WU"
return colors
def get_color(
colors: Optional[list[str]], mana_cost: str, is_hybrid=False
) -> tuple[str, list[str]]:
# print(colors, is_hybrid)
if colors is not None:
if len(colors) == 0:
return "C", []
if len(colors) == 1:
return colors[0], [colors[0]]
elif len(colors) == 2 and is_hybrid:
return canonically_sort_dual_colors("".join(colors)), colors
else:
return "M", colors
else:
return get_color(
list(set(m for m in mana_cost if m in "WUBRGC")), mana_cost, is_hybrid
)
def is_fetchland(oracle_text: str) -> bool:
return (
"Search your library for" in oracle_text
and "put it onto the battlefield" in oracle_text
)
def get_colors_of_fetch(oracle_text: str) -> list[str]:
basic_land_types = ["Plains", "Island", "Swamp", "Mountain", "Forest"]
used_basic_land_types = filter(lambda typ: typ in oracle_text, basic_land_types)
lands_to_colors = {
"Plains": "W",
"Island": "U",
"Swamp": "B",
"Mountain": "R",
"Forest": "G",
}
colors = "".join(map(lambda land: lands_to_colors[land], used_basic_land_types))
return list(canonically_sort_dual_colors(colors))
def get_face(card_json: dict, art: ArtInfo, layout: str) -> Face:
supertypes, types, subtypes = get_super_type_sub(card_json["type_line"])
produces: Optional[str] = (
"".join(sorted(c for c in card_json["produced_mana"] if c != "C"))
if "produced_mana" in card_json
else None
)
colors = card_json.get("colors")
if layout != "double_faced_token":
layout = card_json["layout"] if "layout" in card_json else "default"
else:
layout = "token"
if "Land" in types:
if is_fetchland(card_json["oracle_text"]):
colors = get_colors_of_fetch(card_json["oracle_text"])
# print(f"Fetchland {colors}")
else:
colors = [m for m in produces] if produces is not None else []
if len(colors) > 2:
colors = None
# print(f"{colors=}")
border_color, colors = get_color(
colors,
card_json["mana_cost"],
is_fetchland(card_json["oracle_text"])
or "/" in card_json["mana_cost"]
or card_json["mana_cost"] == "",
)
# print(f"{border_color=}")
# if card_json["name"] in self.color_overwrites:
# border_color = self.color_overwrites[card_json["name"]]
flavor = correct_quotes(card_json.get("flavor_text"))
oracletext = correct_quotes(card_json["oracle_text"])
color_indicator = (
"".join(sorted(card_json["color_indicator"]))
if "color_indicator" in card_json
else None
)
textless = not (bool(oracletext) or bool(flavor))
if oracletext is None:
oracletext = ""
if layout == "leveler":
oracle_lines = oracletext.split("\n")
oracletexts = [oracle_lines[0]]
for line in oracle_lines[1:]:
if line.startswith("LEVEL "):
oracletexts.append(line)
else:
oracletexts[-1] += f"\n{line}"
else:
oracletexts = [oracletext]
# Stupid font
artist = card_json["artist"].replace("ǵ", "g")
# Some special overrides
if "Dungeon" in types:
oracletexts = [""]
card_json["name"] = card_json["type_line"]
card_json["type_line"] = "Card"
textless = True
if card_json["name"] == "Energy Reserve":
textless = True
oracletexts = [""]
if card_json["name"] in ["Poison Counter", "Experience"]:
textless = True
layout = "token"
oracletexts = [""]
return Face(
name=(card_json["name"]),
mana_cost=card_json["mana_cost"],
colors=colors,
type_line=(
card_json["type_line"]
# if card_json["type_line"] != "Card"
# else f"{card_json["name"]}"
),
supertypes=supertypes,
types=types,
subtypes=subtypes,
oracle_text=oracletexts,
flavor_text=flavor,
img=art,
artist=artist,
border_color=border_color,
produces=produces,
power=card_json.get("power"),
toughness=card_json.get("toughness"),
loyalty=card_json.get("loyalty"),
color_indicator=color_indicator,
layout=layout,
textless=textless,
)
def correct_quotes(text: str | None) -> Optional[str]:
if text is None:
return None
quote = text
while '"' in quote:
quote = quote.replace('"', "", 1).replace('"', "", 1)
quote = re.sub(r"'({)", r"\1", quote)
quote = re.sub(r"'(\W)", r"\1", quote)
quote = re.sub(r"(\W)'", r"\1", quote)
quote = quote.replace("'", "")
quote = quote.replace("", "")
quote = quote.replace("ǵ", "g") # not available in font
return quote

1261
mkoldproxy/style.py Normal file

File diff suppressed because it is too large Load diff

6
mkresource Normal file
View file

@ -0,0 +1,6 @@
#!/usr/bin/env bash
cd "$1"
zip -r "$1.zip" *
cd ..
mv "$1/$1.zip" .

289
poetry.lock generated Normal file
View file

@ -0,0 +1,289 @@
# This file is automatically @generated by Poetry 1.8.3 and should not be changed by hand.
[[package]]
name = "certifi"
version = "2025.1.31"
description = "Python package for providing Mozilla's CA Bundle."
optional = false
python-versions = ">=3.6"
files = [
{file = "certifi-2025.1.31-py3-none-any.whl", hash = "sha256:ca78db4565a652026a4db2bcdf68f2fb589ea80d0be70e03929ed730746b84fe"},
{file = "certifi-2025.1.31.tar.gz", hash = "sha256:3d5da6925056f6f18f119200434a4780a94263f10d1c21d032a6f6b2baa20651"},
]
[[package]]
name = "chardet"
version = "5.2.0"
description = "Universal encoding detector for Python 3"
optional = false
python-versions = ">=3.7"
files = [
{file = "chardet-5.2.0-py3-none-any.whl", hash = "sha256:e1cf59446890a00105fe7b7912492ea04b6e6f06d4b742b2c788469e34c82970"},
{file = "chardet-5.2.0.tar.gz", hash = "sha256:1b3b6ff479a8c414bc3fa2c0852995695c4a026dcd6d0633b2dd092ca39c1cf7"},
]
[[package]]
name = "charset-normalizer"
version = "3.4.1"
description = "The Real First Universal Charset Detector. Open, modern and actively maintained alternative to Chardet."
optional = false
python-versions = ">=3.7"
files = [
{file = "charset_normalizer-3.4.1-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:91b36a978b5ae0ee86c394f5a54d6ef44db1de0815eb43de826d41d21e4af3de"},
{file = "charset_normalizer-3.4.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:7461baadb4dc00fd9e0acbe254e3d7d2112e7f92ced2adc96e54ef6501c5f176"},
{file = "charset_normalizer-3.4.1-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:e218488cd232553829be0664c2292d3af2eeeb94b32bea483cf79ac6a694e037"},
{file = "charset_normalizer-3.4.1-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:80ed5e856eb7f30115aaf94e4a08114ccc8813e6ed1b5efa74f9f82e8509858f"},
{file = "charset_normalizer-3.4.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b010a7a4fd316c3c484d482922d13044979e78d1861f0e0650423144c616a46a"},
{file = "charset_normalizer-3.4.1-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:4532bff1b8421fd0a320463030c7520f56a79c9024a4e88f01c537316019005a"},
{file = "charset_normalizer-3.4.1-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:d973f03c0cb71c5ed99037b870f2be986c3c05e63622c017ea9816881d2dd247"},
{file = "charset_normalizer-3.4.1-cp310-cp310-musllinux_1_2_i686.whl", hash = "sha256:3a3bd0dcd373514dcec91c411ddb9632c0d7d92aed7093b8c3bbb6d69ca74408"},
{file = "charset_normalizer-3.4.1-cp310-cp310-musllinux_1_2_ppc64le.whl", hash = "sha256:d9c3cdf5390dcd29aa8056d13e8e99526cda0305acc038b96b30352aff5ff2bb"},
{file = "charset_normalizer-3.4.1-cp310-cp310-musllinux_1_2_s390x.whl", hash = "sha256:2bdfe3ac2e1bbe5b59a1a63721eb3b95fc9b6817ae4a46debbb4e11f6232428d"},
{file = "charset_normalizer-3.4.1-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:eab677309cdb30d047996b36d34caeda1dc91149e4fdca0b1a039b3f79d9a807"},
{file = "charset_normalizer-3.4.1-cp310-cp310-win32.whl", hash = "sha256:c0429126cf75e16c4f0ad00ee0eae4242dc652290f940152ca8c75c3a4b6ee8f"},
{file = "charset_normalizer-3.4.1-cp310-cp310-win_amd64.whl", hash = "sha256:9f0b8b1c6d84c8034a44893aba5e767bf9c7a211e313a9605d9c617d7083829f"},
{file = "charset_normalizer-3.4.1-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:8bfa33f4f2672964266e940dd22a195989ba31669bd84629f05fab3ef4e2d125"},
{file = "charset_normalizer-3.4.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:28bf57629c75e810b6ae989f03c0828d64d6b26a5e205535585f96093e405ed1"},
{file = "charset_normalizer-3.4.1-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:f08ff5e948271dc7e18a35641d2f11a4cd8dfd5634f55228b691e62b37125eb3"},
{file = "charset_normalizer-3.4.1-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:234ac59ea147c59ee4da87a0c0f098e9c8d169f4dc2a159ef720f1a61bbe27cd"},
{file = "charset_normalizer-3.4.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:fd4ec41f914fa74ad1b8304bbc634b3de73d2a0889bd32076342a573e0779e00"},
{file = "charset_normalizer-3.4.1-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:eea6ee1db730b3483adf394ea72f808b6e18cf3cb6454b4d86e04fa8c4327a12"},
{file = "charset_normalizer-3.4.1-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:c96836c97b1238e9c9e3fe90844c947d5afbf4f4c92762679acfe19927d81d77"},
{file = "charset_normalizer-3.4.1-cp311-cp311-musllinux_1_2_i686.whl", hash = "sha256:4d86f7aff21ee58f26dcf5ae81a9addbd914115cdebcbb2217e4f0ed8982e146"},
{file = "charset_normalizer-3.4.1-cp311-cp311-musllinux_1_2_ppc64le.whl", hash = "sha256:09b5e6733cbd160dcc09589227187e242a30a49ca5cefa5a7edd3f9d19ed53fd"},
{file = "charset_normalizer-3.4.1-cp311-cp311-musllinux_1_2_s390x.whl", hash = "sha256:5777ee0881f9499ed0f71cc82cf873d9a0ca8af166dfa0af8ec4e675b7df48e6"},
{file = "charset_normalizer-3.4.1-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:237bdbe6159cff53b4f24f397d43c6336c6b0b42affbe857970cefbb620911c8"},
{file = "charset_normalizer-3.4.1-cp311-cp311-win32.whl", hash = "sha256:8417cb1f36cc0bc7eaba8ccb0e04d55f0ee52df06df3ad55259b9a323555fc8b"},
{file = "charset_normalizer-3.4.1-cp311-cp311-win_amd64.whl", hash = "sha256:d7f50a1f8c450f3925cb367d011448c39239bb3eb4117c36a6d354794de4ce76"},
{file = "charset_normalizer-3.4.1-cp312-cp312-macosx_10_13_universal2.whl", hash = "sha256:73d94b58ec7fecbc7366247d3b0b10a21681004153238750bb67bd9012414545"},
{file = "charset_normalizer-3.4.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:dad3e487649f498dd991eeb901125411559b22e8d7ab25d3aeb1af367df5efd7"},
{file = "charset_normalizer-3.4.1-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:c30197aa96e8eed02200a83fba2657b4c3acd0f0aa4bdc9f6c1af8e8962e0757"},
{file = "charset_normalizer-3.4.1-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:2369eea1ee4a7610a860d88f268eb39b95cb588acd7235e02fd5a5601773d4fa"},
{file = "charset_normalizer-3.4.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:bc2722592d8998c870fa4e290c2eec2c1569b87fe58618e67d38b4665dfa680d"},
{file = "charset_normalizer-3.4.1-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:ffc9202a29ab3920fa812879e95a9e78b2465fd10be7fcbd042899695d75e616"},
{file = "charset_normalizer-3.4.1-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:804a4d582ba6e5b747c625bf1255e6b1507465494a40a2130978bda7b932c90b"},
{file = "charset_normalizer-3.4.1-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:0f55e69f030f7163dffe9fd0752b32f070566451afe180f99dbeeb81f511ad8d"},
{file = "charset_normalizer-3.4.1-cp312-cp312-musllinux_1_2_ppc64le.whl", hash = "sha256:c4c3e6da02df6fa1410a7680bd3f63d4f710232d3139089536310d027950696a"},
{file = "charset_normalizer-3.4.1-cp312-cp312-musllinux_1_2_s390x.whl", hash = "sha256:5df196eb874dae23dcfb968c83d4f8fdccb333330fe1fc278ac5ceeb101003a9"},
{file = "charset_normalizer-3.4.1-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:e358e64305fe12299a08e08978f51fc21fac060dcfcddd95453eabe5b93ed0e1"},
{file = "charset_normalizer-3.4.1-cp312-cp312-win32.whl", hash = "sha256:9b23ca7ef998bc739bf6ffc077c2116917eabcc901f88da1b9856b210ef63f35"},
{file = "charset_normalizer-3.4.1-cp312-cp312-win_amd64.whl", hash = "sha256:6ff8a4a60c227ad87030d76e99cd1698345d4491638dfa6673027c48b3cd395f"},
{file = "charset_normalizer-3.4.1-cp313-cp313-macosx_10_13_universal2.whl", hash = "sha256:aabfa34badd18f1da5ec1bc2715cadc8dca465868a4e73a0173466b688f29dda"},
{file = "charset_normalizer-3.4.1-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:22e14b5d70560b8dd51ec22863f370d1e595ac3d024cb8ad7d308b4cd95f8313"},
{file = "charset_normalizer-3.4.1-cp313-cp313-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:8436c508b408b82d87dc5f62496973a1805cd46727c34440b0d29d8a2f50a6c9"},
{file = "charset_normalizer-3.4.1-cp313-cp313-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:2d074908e1aecee37a7635990b2c6d504cd4766c7bc9fc86d63f9c09af3fa11b"},
{file = "charset_normalizer-3.4.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:955f8851919303c92343d2f66165294848d57e9bba6cf6e3625485a70a038d11"},
{file = "charset_normalizer-3.4.1-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:44ecbf16649486d4aebafeaa7ec4c9fed8b88101f4dd612dcaf65d5e815f837f"},
{file = "charset_normalizer-3.4.1-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:0924e81d3d5e70f8126529951dac65c1010cdf117bb75eb02dd12339b57749dd"},
{file = "charset_normalizer-3.4.1-cp313-cp313-musllinux_1_2_i686.whl", hash = "sha256:2967f74ad52c3b98de4c3b32e1a44e32975e008a9cd2a8cc8966d6a5218c5cb2"},
{file = "charset_normalizer-3.4.1-cp313-cp313-musllinux_1_2_ppc64le.whl", hash = "sha256:c75cb2a3e389853835e84a2d8fb2b81a10645b503eca9bcb98df6b5a43eb8886"},
{file = "charset_normalizer-3.4.1-cp313-cp313-musllinux_1_2_s390x.whl", hash = "sha256:09b26ae6b1abf0d27570633b2b078a2a20419c99d66fb2823173d73f188ce601"},
{file = "charset_normalizer-3.4.1-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:fa88b843d6e211393a37219e6a1c1df99d35e8fd90446f1118f4216e307e48cd"},
{file = "charset_normalizer-3.4.1-cp313-cp313-win32.whl", hash = "sha256:eb8178fe3dba6450a3e024e95ac49ed3400e506fd4e9e5c32d30adda88cbd407"},
{file = "charset_normalizer-3.4.1-cp313-cp313-win_amd64.whl", hash = "sha256:b1ac5992a838106edb89654e0aebfc24f5848ae2547d22c2c3f66454daa11971"},
{file = "charset_normalizer-3.4.1-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:f30bf9fd9be89ecb2360c7d94a711f00c09b976258846efe40db3d05828e8089"},
{file = "charset_normalizer-3.4.1-cp37-cp37m-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:97f68b8d6831127e4787ad15e6757232e14e12060bec17091b85eb1486b91d8d"},
{file = "charset_normalizer-3.4.1-cp37-cp37m-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:7974a0b5ecd505609e3b19742b60cee7aa2aa2fb3151bc917e6e2646d7667dcf"},
{file = "charset_normalizer-3.4.1-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:fc54db6c8593ef7d4b2a331b58653356cf04f67c960f584edb7c3d8c97e8f39e"},
{file = "charset_normalizer-3.4.1-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:311f30128d7d333eebd7896965bfcfbd0065f1716ec92bd5638d7748eb6f936a"},
{file = "charset_normalizer-3.4.1-cp37-cp37m-musllinux_1_2_aarch64.whl", hash = "sha256:7d053096f67cd1241601111b698f5cad775f97ab25d81567d3f59219b5f1adbd"},
{file = "charset_normalizer-3.4.1-cp37-cp37m-musllinux_1_2_i686.whl", hash = "sha256:807f52c1f798eef6cf26beb819eeb8819b1622ddfeef9d0977a8502d4db6d534"},
{file = "charset_normalizer-3.4.1-cp37-cp37m-musllinux_1_2_ppc64le.whl", hash = "sha256:dccbe65bd2f7f7ec22c4ff99ed56faa1e9f785482b9bbd7c717e26fd723a1d1e"},
{file = "charset_normalizer-3.4.1-cp37-cp37m-musllinux_1_2_s390x.whl", hash = "sha256:2fb9bd477fdea8684f78791a6de97a953c51831ee2981f8e4f583ff3b9d9687e"},
{file = "charset_normalizer-3.4.1-cp37-cp37m-musllinux_1_2_x86_64.whl", hash = "sha256:01732659ba9b5b873fc117534143e4feefecf3b2078b0a6a2e925271bb6f4cfa"},
{file = "charset_normalizer-3.4.1-cp37-cp37m-win32.whl", hash = "sha256:7a4f97a081603d2050bfaffdefa5b02a9ec823f8348a572e39032caa8404a487"},
{file = "charset_normalizer-3.4.1-cp37-cp37m-win_amd64.whl", hash = "sha256:7b1bef6280950ee6c177b326508f86cad7ad4dff12454483b51d8b7d673a2c5d"},
{file = "charset_normalizer-3.4.1-cp38-cp38-macosx_10_9_universal2.whl", hash = "sha256:ecddf25bee22fe4fe3737a399d0d177d72bc22be6913acfab364b40bce1ba83c"},
{file = "charset_normalizer-3.4.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:8c60ca7339acd497a55b0ea5d506b2a2612afb2826560416f6894e8b5770d4a9"},
{file = "charset_normalizer-3.4.1-cp38-cp38-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:b7b2d86dd06bfc2ade3312a83a5c364c7ec2e3498f8734282c6c3d4b07b346b8"},
{file = "charset_normalizer-3.4.1-cp38-cp38-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:dd78cfcda14a1ef52584dbb008f7ac81c1328c0f58184bf9a84c49c605002da6"},
{file = "charset_normalizer-3.4.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6e27f48bcd0957c6d4cb9d6fa6b61d192d0b13d5ef563e5f2ae35feafc0d179c"},
{file = "charset_normalizer-3.4.1-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:01ad647cdd609225c5350561d084b42ddf732f4eeefe6e678765636791e78b9a"},
{file = "charset_normalizer-3.4.1-cp38-cp38-musllinux_1_2_aarch64.whl", hash = "sha256:619a609aa74ae43d90ed2e89bdd784765de0a25ca761b93e196d938b8fd1dbbd"},
{file = "charset_normalizer-3.4.1-cp38-cp38-musllinux_1_2_i686.whl", hash = "sha256:89149166622f4db9b4b6a449256291dc87a99ee53151c74cbd82a53c8c2f6ccd"},
{file = "charset_normalizer-3.4.1-cp38-cp38-musllinux_1_2_ppc64le.whl", hash = "sha256:7709f51f5f7c853f0fb938bcd3bc59cdfdc5203635ffd18bf354f6967ea0f824"},
{file = "charset_normalizer-3.4.1-cp38-cp38-musllinux_1_2_s390x.whl", hash = "sha256:345b0426edd4e18138d6528aed636de7a9ed169b4aaf9d61a8c19e39d26838ca"},
{file = "charset_normalizer-3.4.1-cp38-cp38-musllinux_1_2_x86_64.whl", hash = "sha256:0907f11d019260cdc3f94fbdb23ff9125f6b5d1039b76003b5b0ac9d6a6c9d5b"},
{file = "charset_normalizer-3.4.1-cp38-cp38-win32.whl", hash = "sha256:ea0d8d539afa5eb2728aa1932a988a9a7af94f18582ffae4bc10b3fbdad0626e"},
{file = "charset_normalizer-3.4.1-cp38-cp38-win_amd64.whl", hash = "sha256:329ce159e82018d646c7ac45b01a430369d526569ec08516081727a20e9e4af4"},
{file = "charset_normalizer-3.4.1-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:b97e690a2118911e39b4042088092771b4ae3fc3aa86518f84b8cf6888dbdb41"},
{file = "charset_normalizer-3.4.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:78baa6d91634dfb69ec52a463534bc0df05dbd546209b79a3880a34487f4b84f"},
{file = "charset_normalizer-3.4.1-cp39-cp39-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:1a2bc9f351a75ef49d664206d51f8e5ede9da246602dc2d2726837620ea034b2"},
{file = "charset_normalizer-3.4.1-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:75832c08354f595c760a804588b9357d34ec00ba1c940c15e31e96d902093770"},
{file = "charset_normalizer-3.4.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:0af291f4fe114be0280cdd29d533696a77b5b49cfde5467176ecab32353395c4"},
{file = "charset_normalizer-3.4.1-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:0167ddc8ab6508fe81860a57dd472b2ef4060e8d378f0cc555707126830f2537"},
{file = "charset_normalizer-3.4.1-cp39-cp39-musllinux_1_2_aarch64.whl", hash = "sha256:2a75d49014d118e4198bcee5ee0a6f25856b29b12dbf7cd012791f8a6cc5c496"},
{file = "charset_normalizer-3.4.1-cp39-cp39-musllinux_1_2_i686.whl", hash = "sha256:363e2f92b0f0174b2f8238240a1a30142e3db7b957a5dd5689b0e75fb717cc78"},
{file = "charset_normalizer-3.4.1-cp39-cp39-musllinux_1_2_ppc64le.whl", hash = "sha256:ab36c8eb7e454e34e60eb55ca5d241a5d18b2c6244f6827a30e451c42410b5f7"},
{file = "charset_normalizer-3.4.1-cp39-cp39-musllinux_1_2_s390x.whl", hash = "sha256:4c0907b1928a36d5a998d72d64d8eaa7244989f7aaaf947500d3a800c83a3fd6"},
{file = "charset_normalizer-3.4.1-cp39-cp39-musllinux_1_2_x86_64.whl", hash = "sha256:04432ad9479fa40ec0f387795ddad4437a2b50417c69fa275e212933519ff294"},
{file = "charset_normalizer-3.4.1-cp39-cp39-win32.whl", hash = "sha256:3bed14e9c89dcb10e8f3a29f9ccac4955aebe93c71ae803af79265c9ca5644c5"},
{file = "charset_normalizer-3.4.1-cp39-cp39-win_amd64.whl", hash = "sha256:49402233c892a461407c512a19435d1ce275543138294f7ef013f0b63d5d3765"},
{file = "charset_normalizer-3.4.1-py3-none-any.whl", hash = "sha256:d98b1668f06378c6dbefec3b92299716b931cd4e6061f3c875a71ced1780ab85"},
{file = "charset_normalizer-3.4.1.tar.gz", hash = "sha256:44251f18cd68a75b56585dd00dae26183e102cd5e0f9f1466e6df5da2ed64ea3"},
]
[[package]]
name = "idna"
version = "3.10"
description = "Internationalized Domain Names in Applications (IDNA)"
optional = false
python-versions = ">=3.6"
files = [
{file = "idna-3.10-py3-none-any.whl", hash = "sha256:946d195a0d259cbba61165e88e65941f16e9b36ea6ddb97f00452bae8b1287d3"},
{file = "idna-3.10.tar.gz", hash = "sha256:12f65c9b470abda6dc35cf8e63cc574b1c52b11df2c86030af0ac09b01b13ea9"},
]
[package.extras]
all = ["flake8 (>=7.1.1)", "mypy (>=1.11.2)", "pytest (>=8.3.2)", "ruff (>=0.6.2)"]
[[package]]
name = "pillow"
version = "11.1.0"
description = "Python Imaging Library (Fork)"
optional = false
python-versions = ">=3.9"
files = [
{file = "pillow-11.1.0-cp310-cp310-macosx_10_10_x86_64.whl", hash = "sha256:e1abe69aca89514737465752b4bcaf8016de61b3be1397a8fc260ba33321b3a8"},
{file = "pillow-11.1.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:c640e5a06869c75994624551f45e5506e4256562ead981cce820d5ab39ae2192"},
{file = "pillow-11.1.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a07dba04c5e22824816b2615ad7a7484432d7f540e6fa86af60d2de57b0fcee2"},
{file = "pillow-11.1.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e267b0ed063341f3e60acd25c05200df4193e15a4a5807075cd71225a2386e26"},
{file = "pillow-11.1.0-cp310-cp310-manylinux_2_28_aarch64.whl", hash = "sha256:bd165131fd51697e22421d0e467997ad31621b74bfc0b75956608cb2906dda07"},
{file = "pillow-11.1.0-cp310-cp310-manylinux_2_28_x86_64.whl", hash = "sha256:abc56501c3fd148d60659aae0af6ddc149660469082859fa7b066a298bde9482"},
{file = "pillow-11.1.0-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:54ce1c9a16a9561b6d6d8cb30089ab1e5eb66918cb47d457bd996ef34182922e"},
{file = "pillow-11.1.0-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:73ddde795ee9b06257dac5ad42fcb07f3b9b813f8c1f7f870f402f4dc54b5269"},
{file = "pillow-11.1.0-cp310-cp310-win32.whl", hash = "sha256:3a5fe20a7b66e8135d7fd617b13272626a28278d0e578c98720d9ba4b2439d49"},
{file = "pillow-11.1.0-cp310-cp310-win_amd64.whl", hash = "sha256:b6123aa4a59d75f06e9dd3dac5bf8bc9aa383121bb3dd9a7a612e05eabc9961a"},
{file = "pillow-11.1.0-cp310-cp310-win_arm64.whl", hash = "sha256:a76da0a31da6fcae4210aa94fd779c65c75786bc9af06289cd1c184451ef7a65"},
{file = "pillow-11.1.0-cp311-cp311-macosx_10_10_x86_64.whl", hash = "sha256:e06695e0326d05b06833b40b7ef477e475d0b1ba3a6d27da1bb48c23209bf457"},
{file = "pillow-11.1.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:96f82000e12f23e4f29346e42702b6ed9a2f2fea34a740dd5ffffcc8c539eb35"},
{file = "pillow-11.1.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a3cd561ded2cf2bbae44d4605837221b987c216cff94f49dfeed63488bb228d2"},
{file = "pillow-11.1.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:f189805c8be5ca5add39e6f899e6ce2ed824e65fb45f3c28cb2841911da19070"},
{file = "pillow-11.1.0-cp311-cp311-manylinux_2_28_aarch64.whl", hash = "sha256:dd0052e9db3474df30433f83a71b9b23bd9e4ef1de13d92df21a52c0303b8ab6"},
{file = "pillow-11.1.0-cp311-cp311-manylinux_2_28_x86_64.whl", hash = "sha256:837060a8599b8f5d402e97197d4924f05a2e0d68756998345c829c33186217b1"},
{file = "pillow-11.1.0-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:aa8dd43daa836b9a8128dbe7d923423e5ad86f50a7a14dc688194b7be5c0dea2"},
{file = "pillow-11.1.0-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:0a2f91f8a8b367e7a57c6e91cd25af510168091fb89ec5146003e424e1558a96"},
{file = "pillow-11.1.0-cp311-cp311-win32.whl", hash = "sha256:c12fc111ef090845de2bb15009372175d76ac99969bdf31e2ce9b42e4b8cd88f"},
{file = "pillow-11.1.0-cp311-cp311-win_amd64.whl", hash = "sha256:fbd43429d0d7ed6533b25fc993861b8fd512c42d04514a0dd6337fb3ccf22761"},
{file = "pillow-11.1.0-cp311-cp311-win_arm64.whl", hash = "sha256:f7955ecf5609dee9442cbface754f2c6e541d9e6eda87fad7f7a989b0bdb9d71"},
{file = "pillow-11.1.0-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:2062ffb1d36544d42fcaa277b069c88b01bb7298f4efa06731a7fd6cc290b81a"},
{file = "pillow-11.1.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:a85b653980faad27e88b141348707ceeef8a1186f75ecc600c395dcac19f385b"},
{file = "pillow-11.1.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:9409c080586d1f683df3f184f20e36fb647f2e0bc3988094d4fd8c9f4eb1b3b3"},
{file = "pillow-11.1.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:7fdadc077553621911f27ce206ffcbec7d3f8d7b50e0da39f10997e8e2bb7f6a"},
{file = "pillow-11.1.0-cp312-cp312-manylinux_2_28_aarch64.whl", hash = "sha256:93a18841d09bcdd774dcdc308e4537e1f867b3dec059c131fde0327899734aa1"},
{file = "pillow-11.1.0-cp312-cp312-manylinux_2_28_x86_64.whl", hash = "sha256:9aa9aeddeed452b2f616ff5507459e7bab436916ccb10961c4a382cd3e03f47f"},
{file = "pillow-11.1.0-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:3cdcdb0b896e981678eee140d882b70092dac83ac1cdf6b3a60e2216a73f2b91"},
{file = "pillow-11.1.0-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:36ba10b9cb413e7c7dfa3e189aba252deee0602c86c309799da5a74009ac7a1c"},
{file = "pillow-11.1.0-cp312-cp312-win32.whl", hash = "sha256:cfd5cd998c2e36a862d0e27b2df63237e67273f2fc78f47445b14e73a810e7e6"},
{file = "pillow-11.1.0-cp312-cp312-win_amd64.whl", hash = "sha256:a697cd8ba0383bba3d2d3ada02b34ed268cb548b369943cd349007730c92bddf"},
{file = "pillow-11.1.0-cp312-cp312-win_arm64.whl", hash = "sha256:4dd43a78897793f60766563969442020e90eb7847463eca901e41ba186a7d4a5"},
{file = "pillow-11.1.0-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:ae98e14432d458fc3de11a77ccb3ae65ddce70f730e7c76140653048c71bfcbc"},
{file = "pillow-11.1.0-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:cc1331b6d5a6e144aeb5e626f4375f5b7ae9934ba620c0ac6b3e43d5e683a0f0"},
{file = "pillow-11.1.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:758e9d4ef15d3560214cddbc97b8ef3ef86ce04d62ddac17ad39ba87e89bd3b1"},
{file = "pillow-11.1.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b523466b1a31d0dcef7c5be1f20b942919b62fd6e9a9be199d035509cbefc0ec"},
{file = "pillow-11.1.0-cp313-cp313-manylinux_2_28_aarch64.whl", hash = "sha256:9044b5e4f7083f209c4e35aa5dd54b1dd5b112b108648f5c902ad586d4f945c5"},
{file = "pillow-11.1.0-cp313-cp313-manylinux_2_28_x86_64.whl", hash = "sha256:3764d53e09cdedd91bee65c2527815d315c6b90d7b8b79759cc48d7bf5d4f114"},
{file = "pillow-11.1.0-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:31eba6bbdd27dde97b0174ddf0297d7a9c3a507a8a1480e1e60ef914fe23d352"},
{file = "pillow-11.1.0-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:b5d658fbd9f0d6eea113aea286b21d3cd4d3fd978157cbf2447a6035916506d3"},
{file = "pillow-11.1.0-cp313-cp313-win32.whl", hash = "sha256:f86d3a7a9af5d826744fabf4afd15b9dfef44fe69a98541f666f66fbb8d3fef9"},
{file = "pillow-11.1.0-cp313-cp313-win_amd64.whl", hash = "sha256:593c5fd6be85da83656b93ffcccc2312d2d149d251e98588b14fbc288fd8909c"},
{file = "pillow-11.1.0-cp313-cp313-win_arm64.whl", hash = "sha256:11633d58b6ee5733bde153a8dafd25e505ea3d32e261accd388827ee987baf65"},
{file = "pillow-11.1.0-cp313-cp313t-macosx_10_13_x86_64.whl", hash = "sha256:70ca5ef3b3b1c4a0812b5c63c57c23b63e53bc38e758b37a951e5bc466449861"},
{file = "pillow-11.1.0-cp313-cp313t-macosx_11_0_arm64.whl", hash = "sha256:8000376f139d4d38d6851eb149b321a52bb8893a88dae8ee7d95840431977081"},
{file = "pillow-11.1.0-cp313-cp313t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9ee85f0696a17dd28fbcfceb59f9510aa71934b483d1f5601d1030c3c8304f3c"},
{file = "pillow-11.1.0-cp313-cp313t-manylinux_2_28_x86_64.whl", hash = "sha256:dd0e081319328928531df7a0e63621caf67652c8464303fd102141b785ef9547"},
{file = "pillow-11.1.0-cp313-cp313t-musllinux_1_2_x86_64.whl", hash = "sha256:e63e4e5081de46517099dc30abe418122f54531a6ae2ebc8680bcd7096860eab"},
{file = "pillow-11.1.0-cp313-cp313t-win32.whl", hash = "sha256:dda60aa465b861324e65a78c9f5cf0f4bc713e4309f83bc387be158b077963d9"},
{file = "pillow-11.1.0-cp313-cp313t-win_amd64.whl", hash = "sha256:ad5db5781c774ab9a9b2c4302bbf0c1014960a0a7be63278d13ae6fdf88126fe"},
{file = "pillow-11.1.0-cp313-cp313t-win_arm64.whl", hash = "sha256:67cd427c68926108778a9005f2a04adbd5e67c442ed21d95389fe1d595458756"},
{file = "pillow-11.1.0-cp39-cp39-macosx_10_10_x86_64.whl", hash = "sha256:bf902d7413c82a1bfa08b06a070876132a5ae6b2388e2712aab3a7cbc02205c6"},
{file = "pillow-11.1.0-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:c1eec9d950b6fe688edee07138993e54ee4ae634c51443cfb7c1e7613322718e"},
{file = "pillow-11.1.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:8e275ee4cb11c262bd108ab2081f750db2a1c0b8c12c1897f27b160c8bd57bbc"},
{file = "pillow-11.1.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:4db853948ce4e718f2fc775b75c37ba2efb6aaea41a1a5fc57f0af59eee774b2"},
{file = "pillow-11.1.0-cp39-cp39-manylinux_2_28_aarch64.whl", hash = "sha256:ab8a209b8485d3db694fa97a896d96dd6533d63c22829043fd9de627060beade"},
{file = "pillow-11.1.0-cp39-cp39-manylinux_2_28_x86_64.whl", hash = "sha256:54251ef02a2309b5eec99d151ebf5c9904b77976c8abdcbce7891ed22df53884"},
{file = "pillow-11.1.0-cp39-cp39-musllinux_1_2_aarch64.whl", hash = "sha256:5bb94705aea800051a743aa4874bb1397d4695fb0583ba5e425ee0328757f196"},
{file = "pillow-11.1.0-cp39-cp39-musllinux_1_2_x86_64.whl", hash = "sha256:89dbdb3e6e9594d512780a5a1c42801879628b38e3efc7038094430844e271d8"},
{file = "pillow-11.1.0-cp39-cp39-win32.whl", hash = "sha256:e5449ca63da169a2e6068dd0e2fcc8d91f9558aba89ff6d02121ca8ab11e79e5"},
{file = "pillow-11.1.0-cp39-cp39-win_amd64.whl", hash = "sha256:3362c6ca227e65c54bf71a5f88b3d4565ff1bcbc63ae72c34b07bbb1cc59a43f"},
{file = "pillow-11.1.0-cp39-cp39-win_arm64.whl", hash = "sha256:b20be51b37a75cc54c2c55def3fa2c65bb94ba859dde241cd0a4fd302de5ae0a"},
{file = "pillow-11.1.0-pp310-pypy310_pp73-macosx_10_15_x86_64.whl", hash = "sha256:8c730dc3a83e5ac137fbc92dfcfe1511ce3b2b5d7578315b63dbbb76f7f51d90"},
{file = "pillow-11.1.0-pp310-pypy310_pp73-macosx_11_0_arm64.whl", hash = "sha256:7d33d2fae0e8b170b6a6c57400e077412240f6f5bb2a342cf1ee512a787942bb"},
{file = "pillow-11.1.0-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a8d65b38173085f24bc07f8b6c505cbb7418009fa1a1fcb111b1f4961814a442"},
{file = "pillow-11.1.0-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:015c6e863faa4779251436db398ae75051469f7c903b043a48f078e437656f83"},
{file = "pillow-11.1.0-pp310-pypy310_pp73-manylinux_2_28_aarch64.whl", hash = "sha256:d44ff19eea13ae4acdaaab0179fa68c0c6f2f45d66a4d8ec1eda7d6cecbcc15f"},
{file = "pillow-11.1.0-pp310-pypy310_pp73-manylinux_2_28_x86_64.whl", hash = "sha256:d3d8da4a631471dfaf94c10c85f5277b1f8e42ac42bade1ac67da4b4a7359b73"},
{file = "pillow-11.1.0-pp310-pypy310_pp73-win_amd64.whl", hash = "sha256:4637b88343166249fe8aa94e7c4a62a180c4b3898283bb5d3d2fd5fe10d8e4e0"},
{file = "pillow-11.1.0.tar.gz", hash = "sha256:368da70808b36d73b4b390a8ffac11069f8a5c85f29eff1f1b01bcf3ef5b2a20"},
]
[package.extras]
docs = ["furo", "olefile", "sphinx (>=8.1)", "sphinx-copybutton", "sphinx-inline-tabs", "sphinxext-opengraph"]
fpx = ["olefile"]
mic = ["olefile"]
tests = ["check-manifest", "coverage (>=7.4.2)", "defusedxml", "markdown2", "olefile", "packaging", "pyroma", "pytest", "pytest-cov", "pytest-timeout", "trove-classifiers (>=2024.10.12)"]
typing = ["typing-extensions"]
xmp = ["defusedxml"]
[[package]]
name = "reportlab"
version = "4.3.1"
description = "The Reportlab Toolkit"
optional = false
python-versions = "<4,>=3.7"
files = [
{file = "reportlab-4.3.1-py3-none-any.whl", hash = "sha256:0f37dd16652db3ef84363cf744632a28c38bd480d5bf94683466852d7bb678dd"},
{file = "reportlab-4.3.1.tar.gz", hash = "sha256:230f78b21667194d8490ac9d12958d5c14686352db7fbe03b95140fafdf5aa97"},
]
[package.dependencies]
chardet = "*"
pillow = ">=9.0.0"
[package.extras]
accel = ["rl_accel (>=0.9.0,<1.1)"]
pycairo = ["freetype-py (>=2.3.0,<2.4)", "rlPyCairo (>=0.2.0,<1)"]
renderpm = ["rl_renderPM (>=4.0.3,<4.1)"]
[[package]]
name = "requests"
version = "2.32.3"
description = "Python HTTP for Humans."
optional = false
python-versions = ">=3.8"
files = [
{file = "requests-2.32.3-py3-none-any.whl", hash = "sha256:70761cfe03c773ceb22aa2f671b4757976145175cdfca038c02654d061d6dcc6"},
{file = "requests-2.32.3.tar.gz", hash = "sha256:55365417734eb18255590a9ff9eb97e9e1da868d4ccd6402399eaf68af20a760"},
]
[package.dependencies]
certifi = ">=2017.4.17"
charset-normalizer = ">=2,<4"
idna = ">=2.5,<4"
urllib3 = ">=1.21.1,<3"
[package.extras]
socks = ["PySocks (>=1.5.6,!=1.5.7)"]
use-chardet-on-py3 = ["chardet (>=3.0.2,<6)"]
[[package]]
name = "urllib3"
version = "2.3.0"
description = "HTTP library with thread-safe connection pooling, file post, and more."
optional = false
python-versions = ">=3.9"
files = [
{file = "urllib3-2.3.0-py3-none-any.whl", hash = "sha256:1cee9ad369867bfdbbb48b7dd50374c0967a0bb7710050facf0dd6911440e3df"},
{file = "urllib3-2.3.0.tar.gz", hash = "sha256:f8c5449b3cf0861679ce7e0503c7b44b5ec981bec0d1d3795a07f1ba96f0204d"},
]
[package.extras]
brotli = ["brotli (>=1.0.9)", "brotlicffi (>=0.8.0)"]
h2 = ["h2 (>=4,<5)"]
socks = ["pysocks (>=1.5.6,!=1.5.7,<2.0)"]
zstd = ["zstandard (>=0.18.0)"]
[metadata]
lock-version = "2.0"
python-versions = "^3.10"
content-hash = "aab59108f6de1e6899c9fd50c69f110c537dfa2d71cd550a1a2b29bb998ea49a"

18
pyproject.toml Normal file
View file

@ -0,0 +1,18 @@
[tool.poetry]
name = "mkoldproxy"
version = "0.1.0"
description = ""
authors = ["Christoph Stahl <christoph.stahl@tu-dortmund.de>"]
readme = "README.md"
scripts = { "mkoldproxy" = "mkoldproxy.main:main" }
[tool.poetry.dependencies]
python = "^3.10"
requests = "^2.32.3"
pillow = "^11.1.0"
reportlab = "^4.2.5"
[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"