pax_global_header00006660000000000000000000000064134135033230014507gustar00rootroot0000000000000052 comment=20b3f3766ac1b4f6b26d587896a7cc4acdf2c22b ebooklib-0.17.1/000077500000000000000000000000001341350332300133635ustar00rootroot00000000000000ebooklib-0.17.1/.gitignore000066400000000000000000000024611341350332300153560ustar00rootroot00000000000000#ignore these in git listings *~ .emacs* .DS_Store .swp *.swp \#*# .#* \#* ### Python template # Byte-compiled / optimized / DLL files __pycache__/ *.py[cod] *$py.class # C extensions *.so # Distribution / packaging .Python build/ develop-eggs/ dist/ downloads/ eggs/ .eggs/ lib/ lib64/ parts/ sdist/ var/ wheels/ *.egg-info/ .installed.cfg *.egg MANIFEST # PyInstaller # Usually these files are written by a python script from a template # before PyInstaller builds the exe, so as to inject date/other infos into it. *.manifest *.spec # Installer logs pip-log.txt pip-delete-this-directory.txt # Unit test / coverage reports htmlcov/ .tox/ .coverage .coverage.* .cache nosetests.xml coverage.xml *.cover .hypothesis/ # Translations *.mo *.pot # Django stuff: *.log .static_storage/ .media/ local_settings.py # Flask stuff: instance/ .webassets-cache # Scrapy stuff: .scrapy # Sphinx documentation docs/_build/ # PyBuilder target/ # Jupyter Notebook .ipynb_checkpoints # pyenv .python-version # celery beat schedule file celerybeat-schedule # SageMath parsed files *.sage.py # Environments .env .venv env/ venv/ ENV/ env.bak/ venv.bak/ # Spyder project settings .spyderproject .spyproject # Rope project settings .ropeproject # mkdocs documentation /site # mypy .mypy_cache/ ### JetBrains template .idea/ ebooklib-0.17.1/AUTHORS.txt000066400000000000000000000016111341350332300152500ustar00rootroot00000000000000Listed in in chronological order: Aleksandar Erkalovic Borko Jandras the-happy-hippo Daniel James Mikhail Gusarov Raymond Yee Chris Grice Fernando Wime Andy Roberts Tom McLean Travis L Helmy Giacoman clach04 Edward Betts Kennyl Oleg Pshenichniy clach04 Olivier Le Thanh Duong Michael Storm Sergey Markelov Laurent Laporte Deborah Kaplan Willem van der Walt ebooklib-0.17.1/CHANGES.txt000066400000000000000000000000001341350332300151620ustar00rootroot00000000000000ebooklib-0.17.1/LICENSE.txt000066400000000000000000001033301341350332300152060ustar00rootroot00000000000000 GNU AFFERO GENERAL PUBLIC LICENSE Version 3, 19 November 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU Affero General Public License is a free, copyleft license for software and other kinds of works, specifically designed to ensure cooperation with the community in the case of network server software. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, our General Public Licenses are 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. 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. Developers that use our General Public Licenses protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License which gives you legal permission to copy, distribute and/or modify the software. A secondary benefit of defending all users' freedom is that improvements made in alternate versions of the program, if they receive widespread use, become available for other developers to incorporate. Many developers of free software are heartened and encouraged by the resulting cooperation. However, in the case of software used on network servers, this result may fail to come about. The GNU General Public License permits making a modified version and letting the public access it on a server without ever releasing its source code to the public. The GNU Affero General Public License is designed specifically to ensure that, in such cases, the modified source code becomes available to the community. It requires the operator of a network server to provide the source code of the modified version running there to the users of that server. Therefore, public use of a modified version, on a publicly accessible server, gives the public access to the source code of the modified version. An older license, called the Affero General Public License and published by Affero, was designed to accomplish similar goals. This is a different license, not a version of the Affero GPL, but Affero has released a new version of the Affero GPL which permits relicensing under this license. 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 Affero 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. Remote Network Interaction; Use with the GNU General Public License. Notwithstanding any other provision of this License, if you modify the Program, your modified version must prominently offer all users interacting with it remotely through a computer network (if your version supports such interaction) an opportunity to receive the Corresponding Source of your version by providing access to the Corresponding Source from a network server at no charge, through some standard or customary means of facilitating copying of software. This Corresponding Source shall include the Corresponding Source for any work covered by version 3 of the GNU General Public License that is incorporated pursuant to the following paragraph. 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 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 work with which it is combined will remain governed by version 3 of the GNU General Public License. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU Affero 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 Affero 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 Affero 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 Affero 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. Copyright (C) This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero 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 Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see . Also add information on how to contact you by electronic and paper mail. If your software can interact with users remotely through a computer network, you should also make sure that it provides a way for users to get its source. For example, if your program is a web application, its interface could display a "Source" link that leads users to an archive of the code. There are many ways you could offer source, and different solutions will be better for different programs; see section 13 for the specific requirements. 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 AGPL, see . ebooklib-0.17.1/MANIFEST.in000066400000000000000000000003221341350332300151160ustar00rootroot00000000000000include *.txt include *.md recursive-include docs *.py recursive-include docs *.rst recursive-include docs Makefile recursive-include samples *.jpg recursive-include samples *.md recursive-include samples *.py ebooklib-0.17.1/README.md000066400000000000000000000047611341350332300146520ustar00rootroot00000000000000About EbookLib ============== EbookLib is a Python library for managing EPUB2/EPUB3 and Kindle files. It's capable of reading and writing EPUB files programmatically (Kindle support is under development). The API is designed to be as simple as possible, while at the same time making complex things possible too. It has support for covers, table of contents, spine, guide, metadata and etc. EbookLib is used in [Booktype](https://github.com/sourcefabric/Booktype/) from Sourcefabric, as well as [sprits-it!](https://github.com/the-happy-hippo/sprits-it), [fanfiction2ebook](https://github.com/ltouroumov/fanfiction2ebook), [viserlalune](https://github.com/vjousse/viserlalune) and [Telemeta](https://github.com/Parisson/Telemeta). Packages of EbookLib for GNU/Linux are available in [Debian](https://packages.debian.org/python-ebooklib) and [Ubuntu](http://packages.ubuntu.com/python-ebooklib). Sphinx documentation is generated from the templates in the docs/ directory and made available at http://ebooklib.readthedocs.io Usage ===== Reading ------- :: import ebooklib from ebooklib import epub book = epub.read_epub('test.epub') for image in book.get_items_of_type(ebooklib.ITEM_IMAGE): print image Writing ------- :: from ebooklib import epub book = epub.EpubBook() # set metadata book.set_identifier('id123456') book.set_title('Sample book') book.set_language('en') book.add_author('Author Authorowski') book.add_author('Danko Bananko', file_as='Gospodin Danko Bananko', role='ill', uid='coauthor') # create chapter c1 = epub.EpubHtml(title='Intro', file_name='chap_01.xhtml', lang='hr') c1.content=u'

Intro heading

Zaba je skocila u baru.

' # add chapter book.add_item(c1) # define Table Of Contents book.toc = (epub.Link('chap_01.xhtml', 'Introduction', 'intro'), (epub.Section('Simple book'), (c1, )) ) # add default NCX and Nav file book.add_item(epub.EpubNcx()) book.add_item(epub.EpubNav()) # define CSS style style = 'BODY {color: white;}' nav_css = epub.EpubItem(uid="style_nav", file_name="style/nav.css", media_type="text/css", content=style) # add CSS file book.add_item(nav_css) # basic spine book.spine = ['nav', c1] # write to the file epub.write_epub('test.epub', book, {}) License ======= EbookLib is licensed under the AGPL license. Authors ======= Full list of authors is in AUTHORS.txt file. ebooklib-0.17.1/VERSION.txt000066400000000000000000000000161341350332300152460ustar00rootroot00000000000000EbookLib 0.17 ebooklib-0.17.1/docs/000077500000000000000000000000001341350332300143135ustar00rootroot00000000000000ebooklib-0.17.1/docs/Makefile000066400000000000000000000127041341350332300157570ustar00rootroot00000000000000# Makefile for Sphinx documentation # # You can set these variables from the command line. SPHINXOPTS = SPHINXBUILD = sphinx-build PAPER = BUILDDIR = _build # Internal variables. PAPEROPT_a4 = -D latex_paper_size=a4 PAPEROPT_letter = -D latex_paper_size=letter ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . # the i18n builder cannot share the environment and doctrees with the others I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . .PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext help: @echo "Please use \`make ' where is one of" @echo " html to make standalone HTML files" @echo " dirhtml to make HTML files named index.html in directories" @echo " singlehtml to make a single large HTML file" @echo " pickle to make pickle files" @echo " json to make JSON files" @echo " htmlhelp to make HTML files and a HTML help project" @echo " qthelp to make HTML files and a qthelp project" @echo " devhelp to make HTML files and a Devhelp project" @echo " epub to make an epub" @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" @echo " latexpdf to make LaTeX files and run them through pdflatex" @echo " text to make text files" @echo " man to make manual pages" @echo " texinfo to make Texinfo files" @echo " info to make Texinfo files and run them through makeinfo" @echo " gettext to make PO message catalogs" @echo " changes to make an overview of all changed/added/deprecated items" @echo " linkcheck to check all external links for integrity" @echo " doctest to run all doctests embedded in the documentation (if enabled)" clean: -rm -rf $(BUILDDIR)/* html: $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html @echo @echo "Build finished. The HTML pages are in $(BUILDDIR)/html." dirhtml: $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml @echo @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml." singlehtml: $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml @echo @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml." pickle: $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle @echo @echo "Build finished; now you can process the pickle files." json: $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json @echo @echo "Build finished; now you can process the JSON files." htmlhelp: $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp @echo @echo "Build finished; now you can run HTML Help Workshop with the" \ ".hhp project file in $(BUILDDIR)/htmlhelp." qthelp: $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp @echo @echo "Build finished; now you can run "qcollectiongenerator" with the" \ ".qhcp project file in $(BUILDDIR)/qthelp, like this:" @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/EbookLib.qhcp" @echo "To view the help file:" @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/EbookLib.qhc" devhelp: $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp @echo @echo "Build finished." @echo "To view the help file:" @echo "# mkdir -p $$HOME/.local/share/devhelp/EbookLib" @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/EbookLib" @echo "# devhelp" epub: $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub @echo @echo "Build finished. The epub file is in $(BUILDDIR)/epub." latex: $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex @echo @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex." @echo "Run \`make' in that directory to run these through (pdf)latex" \ "(use \`make latexpdf' here to do that automatically)." latexpdf: $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex @echo "Running LaTeX files through pdflatex..." $(MAKE) -C $(BUILDDIR)/latex all-pdf @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." text: $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text @echo @echo "Build finished. The text files are in $(BUILDDIR)/text." man: $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man @echo @echo "Build finished. The manual pages are in $(BUILDDIR)/man." texinfo: $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo @echo @echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo." @echo "Run \`make' in that directory to run these through makeinfo" \ "(use \`make info' here to do that automatically)." info: $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo @echo "Running Texinfo files through makeinfo..." make -C $(BUILDDIR)/texinfo info @echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo." gettext: $(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale @echo @echo "Build finished. The message catalogs are in $(BUILDDIR)/locale." changes: $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes @echo @echo "The overview file is in $(BUILDDIR)/changes." linkcheck: $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck @echo @echo "Link check complete; look for any errors in the above output " \ "or in $(BUILDDIR)/linkcheck/output.txt." doctest: $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest @echo "Testing of doctests in the sources finished, look at the " \ "results in $(BUILDDIR)/doctest/output.txt." ebooklib-0.17.1/docs/_static/000077500000000000000000000000001341350332300157415ustar00rootroot00000000000000ebooklib-0.17.1/docs/_static/README000066400000000000000000000001151341350332300166160ustar00rootroot00000000000000For some reason, readthedocs.org expects a docs/_static/ directory to exist. ebooklib-0.17.1/docs/_static/ebooklib1.gif000066400000000000000000000304541341350332300203050ustar00rootroot00000000000000GIF89a,,;]][11/YYWNNM//-zzy??>ttsKKIյ==;lljDDffe""33UUffwwLLJ--+YYX%%#RRPUUT##!))'hhgJJH886"" ! NETSCAPE2.0! XMP DataXMP ~}|{zyxwvutsrqponmlkjihgfedcba`_^]\[ZYXWVUTSRQPONMLKJIHGFEDCBA@?>=<;:9876543210/.-,+*)('&%$#"!  !;,,,@pH,Ȥrl:ШtJZجvzxL.zn|N~ H*\ȰÇ#JHŋ3jdC Ird ,pܳ %cu |ɳ8lQTUљ@uˢ#(]Zfӧ$Pdr+ 2@0 va` bQ ~l IvRadY ZEd7@`fϐdCdB彧*Q[4ǁo Y*2$ge2w|dlX1X^u' |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0=/Ae!^ze/uu|~~'DܥCW] H\q mZo~)rCā%n5 0-za bRiXHZ$)Evq׎~@XJ:[&Ya_ ԤweN; pƘe酚ia y[YQ7'\B(V:碚2"iU~ RQMJrJa/ji]ȕ˫1$)EZjl6lzR9 [D98.lyj $>kmߒr_9hEXȼ*W!;,*AOs@pH,Ȥrl:ШtJZجvzp1(ˠ`ȹ tk0jBz8e@a1카1Z`6bC٢ ]lX` \ , ݇o[i+`Q.),Ξu |)J(jlt2֬BK9Dٶ-Z EmLli" eN[ PP.tDz\w#/WUV+7q3FjJ˙ƣbF$6hGqV-FV>@ǝb *; O;IXer9iD4gowoa5gMu79Ze mH%M׷gw8[mc;98vG^y&ZM\K/Z)Zbo%= ׊Y&0.&ax`5.f@qJtn;Oj @87`/ HI`<Ept"̟7Їi~]!H"/iJ/bt.wc5\ҖCM!r @CRJF\H#PBRU UƈW@D'슔@1ډJi8Sx_J< (;ebooklib-0.17.1/docs/conf.py000066400000000000000000000221411341350332300156120ustar00rootroot00000000000000# -*- coding: utf-8 -*- # # EbookLib documentation build configuration file, created by # sphinx-quickstart on Fri Apr 25 11:49:49 2014. # # This file is execfile()d with the current directory set to its containing dir. # # Note that not all possible configuration values are present in this # autogenerated file. # # All configuration values have a default; values that are commented out # serve to show the default. import sys, os # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. sys.path.insert(0, os.path.abspath('..')) # -- General configuration ----------------------------------------------------- # If your documentation needs a minimal Sphinx version, state it here. #needs_sphinx = '1.0' # Add any Sphinx extension module names here, as strings. They can be extensions # coming with Sphinx (named 'sphinx.ext.*') or your custom ones. extensions = ['sphinx.ext.autodoc', 'sphinx.ext.doctest', 'sphinx.ext.intersphinx', 'sphinx.ext.todo', 'sphinx.ext.coverage', 'sphinx.ext.viewcode'] # Add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] # The suffix of source filenames. source_suffix = '.rst' # The encoding of source files. #source_encoding = 'utf-8-sig' # The master toctree document. master_doc = 'index' # General information about the project. project = u'EbookLib' copyright = u'2014, Aleksandar Erkalovic' # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the # built documents. # # The short X.Y version. version = '0.17' # The full version, including alpha/beta/rc tags. release = '0.17' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. #language = None # There are two options for replacing |today|: either, you set today to some # non-false value, then it is used: #today = '' # Else, today_fmt is used as the format for a strftime call. #today_fmt = '%B %d, %Y' # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. exclude_patterns = ['_build'] # The reST default role (used for this markup: `text`) to use for all documents. #default_role = None # If true, '()' will be appended to :func: etc. cross-reference text. #add_function_parentheses = True # If true, the current module name will be prepended to all description # unit titles (such as .. function::). #add_module_names = True # If true, sectionauthor and moduleauthor directives will be shown in the # output. They are ignored by default. #show_authors = False # The name of the Pygments (syntax highlighting) style to use. pygments_style = 'sphinx' # A list of ignored prefixes for module index sorting. #modindex_common_prefix = [] # -- Options for HTML output --------------------------------------------------- # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. html_theme = 'default' # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the # documentation. #html_theme_options = {} # Add any paths that contain custom themes here, relative to this directory. #html_theme_path = [] # The name for this set of Sphinx documents. If None, it defaults to # " v documentation". #html_title = None # A shorter title for the navigation bar. Default is the same as html_title. #html_short_title = None # The name of an image file (relative to this directory) to place at the top # of the sidebar. #html_logo = None # The name of an image file (within the static path) to use as favicon of the # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 # pixels large. #html_favicon = None # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". html_static_path = ['_static'] # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, # using the given strftime format. #html_last_updated_fmt = '%b %d, %Y' # If true, SmartyPants will be used to convert quotes and dashes to # typographically correct entities. #html_use_smartypants = True # Custom sidebar templates, maps document names to template names. #html_sidebars = {} # Additional templates that should be rendered to pages, maps page names to # template names. #html_additional_pages = {} # If false, no module index is generated. #html_domain_indices = True # If false, no index is generated. #html_use_index = True # If true, the index is split into individual pages for each letter. #html_split_index = False # If true, links to the reST sources are added to the pages. #html_show_sourcelink = True # If true, "Created using Sphinx" is shown in the HTML footer. Default is True. #html_show_sphinx = True # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. #html_show_copyright = True # If true, an OpenSearch description file will be output, and all pages will # contain a tag referring to it. The value of this option must be the # base URL from which the finished HTML is served. #html_use_opensearch = '' # This is the file name suffix for HTML files (e.g. ".xhtml"). #html_file_suffix = None # Output file base name for HTML help builder. htmlhelp_basename = 'EbookLibdoc' # -- Options for LaTeX output -------------------------------------------------- latex_elements = { # The paper size ('letterpaper' or 'a4paper'). #'papersize': 'letterpaper', # The font size ('10pt', '11pt' or '12pt'). #'pointsize': '10pt', # Additional stuff for the LaTeX preamble. #'preamble': '', } # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, author, documentclass [howto/manual]). latex_documents = [ ('index', 'EbookLib.tex', u'EbookLib Documentation', u'Aleksandar Erkalovic', 'manual'), ] # The name of an image file (relative to this directory) to place at the top of # the title page. #latex_logo = None # For "manual" documents, if this is true, then toplevel headings are parts, # not chapters. #latex_use_parts = False # If true, show page references after internal links. #latex_show_pagerefs = False # If true, show URL addresses after external links. #latex_show_urls = False # Documents to append as an appendix to all manuals. #latex_appendices = [] # If false, no module index is generated. #latex_domain_indices = True # -- Options for manual page output -------------------------------------------- # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). man_pages = [ ('index', 'ebooklib', u'EbookLib Documentation', [u'Aleksandar Erkalovic'], 1) ] # If true, show URL addresses after external links. #man_show_urls = False # -- Options for Texinfo output ------------------------------------------------ # Grouping the document tree into Texinfo files. List of tuples # (source start file, target name, title, author, # dir menu entry, description, category) texinfo_documents = [ ('index', 'EbookLib', u'EbookLib Documentation', u'Aleksandar Erkalovic', 'EbookLib', 'Python library for EPUB and Kindle formats.', 'Miscellaneous'), ] # Documents to append as an appendix to all manuals. #texinfo_appendices = [] # If false, no module index is generated. #texinfo_domain_indices = True # How to display URL addresses: 'footnote', 'no', or 'inline'. #texinfo_show_urls = 'footnote' # -- Options for Epub output --------------------------------------------------- # Bibliographic Dublin Core info. epub_title = u'EbookLib' epub_author = u'Aleksandar Erkalovic' epub_publisher = u'Aleksandar Erkalovic' epub_copyright = u'2014, Aleksandar Erkalovic' # The language of the text. It defaults to the language option # or en if the language is not set. #epub_language = '' # The scheme of the identifier. Typical schemes are ISBN or URL. #epub_scheme = '' # The unique identifier of the text. This can be a ISBN number # or the project homepage. #epub_identifier = '' # A unique identification for the text. #epub_uid = '' # A tuple containing the cover image and cover page html template filenames. #epub_cover = () # HTML files that should be inserted before the pages created by sphinx. # The format is a list of tuples containing the path and title. #epub_pre_files = [] # HTML files shat should be inserted after the pages created by sphinx. # The format is a list of tuples containing the path and title. #epub_post_files = [] # A list of files that should not be packed into the epub file. #epub_exclude_files = [] # The depth of the table of contents in toc.ncx. #epub_tocdepth = 3 # Allow duplicate toc entries. #epub_tocdup = True # Example configuration for intersphinx: refer to the Python standard library. intersphinx_mapping = {'http://docs.python.org/': None} ebooklib-0.17.1/docs/ebooklib.plugins.rst000066400000000000000000000013721341350332300203160ustar00rootroot00000000000000plugins Package =============== :mod:`base` Module ------------------ .. automodule:: ebooklib.plugins.base :members: :undoc-members: :show-inheritance: :mod:`booktype` Module ---------------------- .. automodule:: ebooklib.plugins.booktype :members: :undoc-members: :show-inheritance: :mod:`sourcecode` Module ------------------------ .. automodule:: ebooklib.plugins.sourcecode :members: :undoc-members: :show-inheritance: :mod:`standard` Module ---------------------- .. automodule:: ebooklib.plugins.standard :members: :undoc-members: :show-inheritance: :mod:`tidyhtml` Module ---------------------- .. automodule:: ebooklib.plugins.tidyhtml :members: :undoc-members: :show-inheritance: ebooklib-0.17.1/docs/ebooklib.rst000066400000000000000000000007451341350332300166410ustar00rootroot00000000000000ebooklib Package ================ :mod:`ebooklib` Package ----------------------- .. automodule:: ebooklib :members: :undoc-members: :show-inheritance: :mod:`epub` Module ------------------ .. automodule:: ebooklib.epub :members: :undoc-members: :show-inheritance: :mod:`utils` Module ------------------- .. automodule:: ebooklib.utils :members: :undoc-members: :show-inheritance: Subpackages ----------- .. toctree:: ebooklib.plugins ebooklib-0.17.1/docs/faq.rst000066400000000000000000000031371341350332300156200ustar00rootroot00000000000000Frequently asked questions ========================== How can I contribute? --------------------- Easily! We don't have any special procedure for contributions. Just send us bug reports, suggestions or Pull Requests! * Find bugs and report them here - https://github.com/aerkalov/ebooklib/issues * Have a suggestions or idea for a feature? Write it here - https://github.com/aerkalov/ebooklib/issues * Clone and send us Pull Requests - https://github.com/aerkalov/ebooklib/ Read and save does not work --------------------------- At the moment you can not use ebooklib to read EPUB file, write it down using ebooklib and expect to get file identical to the original. This is because ebooklib is opinionated when it comes to directory names, content it saves and etc. Different EPUB files will place style sheet files, images, fonts and html files to different directories than ebooklib. Ebooklib is also trying to produce valid EPUB3 output files, which is not always the case with all input files. A lot of times input files will not pass epubcheck validation. Because of that we we suggest that you read EPUB file using ebooklib, create new book instance using ebooklib and transfer only things you care about. It is also up to you to change the paths for the links inside (to style sheets, images and other html files). When you are done just write it down. What happened to the MOBI support? ---------------------------------- We used to have branch with basic MOBI support. We stopped working on it as for our workflow KindleGen app (converting EPUB->MOBI) was more than enough and we never needed to parse MOBI files.ebooklib-0.17.1/docs/index.rst000066400000000000000000000016401341350332300161550ustar00rootroot00000000000000.. EbookLib documentation master file, created by sphinx-quickstart on Fri Apr 25 11:49:49 2014. You can adapt this file completely to your liking, but it should at least contain the root `toctree` directive. Welcome to EbookLib's documentation! ==================================== .. image:: _static/ebooklib1.gif EbookLib is a Python library for managing EPUB2/EPUB3 files. It's capable of reading and writing EPUB files programmatically. The API is designed to be as simple as possible, while at the same time making complex things possible too. It has support for covers, table of contents, spine, guide, metadata, SMIL, pagebreaks and more. EbookLib works with Python 2.7 and Python 3.3. Homepage: https://github.com/aerkalov/ebooklib/ .. toctree:: :maxdepth: 2 tutorial plugins faq ebooklib Indices and tables ================== * :ref:`genindex` * :ref:`modindex` * :ref:`search` ebooklib-0.17.1/docs/plugins.rst000066400000000000000000000066051341350332300165350ustar00rootroot00000000000000Plugins ======= Plugins can be used to automate some of the workflow. For instance :mod:`ebooklib.plugins.tidyhtml` plugins automatically cleans HTML output for you. FootnotePlugin for instance rewrites custom footnotes into EPUB3 kind of footnotes. Without these plugins you would need to do wanted transformations before setting or getting content from your chapters. There is a :class:`ebooklib.plugins.base.BasePlugin` class which you need to extend. These are the methods you can override. ================= ============= ================================== Method Arguments Description ================= ============= ================================== before_write book Processing before book save after_write book Processing after book save before_read book Processing before book read after_read book Processing after book read item_after_read book, item Process general item after read item_before_write book, item Process general item before write html_after_read book, chapter Processing HTML before read html_before_write book, chapter Processing HTML before save ================= ============= ================================== Custom plugin ------------- This is our use case. We have online WYSIWYG editing system for editing content of our books. In the editor to link to our other page we use this syntax *Our page* but in the EPUB book we would need to link to *page.xhtml* file for instance. We could do the transformations manually or we could write a plugin which does all of the work for us. We override *html_before_write* method. We parse the content of our chapter, find all links, replace them with new href and finally set new content to the chapter. :: try: from urlparse import urlparse, urljoin except ImportError: from urllib.parse import urlparse, urljoin from lxml import etree from ebooklib.plugins.base import BasePlugin from ebooklib.utils import parse_html_string class MyeLinks(BasePlugin): NAME = 'My Links' def html_before_write(self, book, chapter): try: tree = parse_html_string(chapter.content) except: return root = tree.getroottree() if len(root.find('body')) != 0: body = tree.find('body') for _link in body.xpath('//a'): _u = urlparse(_link.get('href', '')) # Let us care only for internal links at the moment if _u.scheme == '': if _u.path != '': _link.set('href', '%s.xhtml' % _u.path) if _u.fragment != '': _link.set('href', urljoin(_link.get('href'), '#%s' % _u.fragment)) if _link.get('name') != None: _link.set('id', _link.get('name')) etree.strip_attributes(_link, 'name') chapter.content = etree.tostring(tree, pretty_print=True, encoding='utf-8') When you want to use it just pass the list of plugins you want to use as extra option to the write_epub method (also to read_epub method). Plugins will be executed in the order they are defined in the list. :: epub.write_epub('test.epub', book, {"plugins": [MyLinks()]}) ebooklib-0.17.1/docs/tutorial.rst000066400000000000000000000223401341350332300167110ustar00rootroot00000000000000Tutorial ======== Introduction ------------ Ebooklib is used to manage EPUB2/EPUB3 files. Reading EPUB ------------ :: import ebooklib from ebooklib import epub book = epub.read_epub('test.epub') There is a :func:`ebooklib.epub.read_epub` function used for reading EPUB files. It accepts full file path to the EPUB file as argument. It will return instance of :class:`ebooklib.epub.EpubBook` class. Metadata ++++++++ Method :meth:`ebooklib.epub.EpubBook.get_metadata` is used for fetching metadata. It accepts 2 arguments. First argument is name of the namespace ('DC' for Dublin Core and 'OPF' for custom metadata). Second argument is name of the key. It always returns a list. List will be empty if nothing is defined for that key. Minimal required metadata from Dublic Core set (for EPUB3) is: * DC:identifier * DC:title * DC:language 'DC' namespace is used when accessing Dublin Core metadata. :: >>> book.get_metadata('DC', 'title') [('Ratio', {})] >>> book.get_metadata('DC', 'creator') [('Firstname Lastname ', {})] >>> book.get_metadata('DC', 'identifier') [('9781416566120', {'id': 'isbn_9781416566120'})] Optional metadata from the Dublic Core set is: * DC:creator * DC:contributor * DC:publisher * DC:rights * DC:coverage * DC:date * DC:description This is how Dublin Core metadata is defined inside of content.opf file. :: en 9781416566120 You can also have custom metadata. For instance this is how custom metadata is defined in content.opf file. You can define same key more then once. 2 :: When accessing custom metadata you will use namespace 'OPF'. Notice you will get more then one result now. :: >>> book.get_metadata('OPF', 'cover') [(None, {'content': 'my-cover-image', 'name': 'cover'}), (None, {'content': 'cover-image', 'name': 'cover'})] Check the official documentation for more info: * http://www.idpf.org/epub/30/spec/epub30-publications.html#sec-opf-dcmes-optional. * http://www.idpf.org/epub/30/spec/epub30-publications.html * http://dublincore.org/documents/dces/ Items +++++ All of the resources (style sheets, images, videos, sounds, scripts and html files) are items. :: images = book.get_items_of_type(ebooklib.ITEM_IMAGE) Fetch items by their type with :meth:`ebooklib.epub.EpubBook.get_items_of_type`. Here is a list of current item types you can use: * ITEM_UNKNOWN * ITEM_IMAGE * ITEM_STYLE * ITEM_SCRIPT * ITEM_NAVIGATION * ITEM_VECTOR * ITEM_FONT * ITEM_VIDEO * ITEM_AUDIO * ITEM_DOCUMENT * ITEM_COVER * ITEM_SMIL :: cover_image = book.get_item_with_id('cover-image') Fetch items by their id (if you know it) with :meth:`ebooklib.epub.EpubBook.get_item_with_id`. :: index = book.get_item_with_href('index.xhtml') Fetch them by their filename with :meth:`ebooklib.epub.EpubBook.get_item_with_href`. :: items = book.get_items_of_media_type('image/png') Fetch them by their media type with :meth:`ebooklib.epub.EpubBook.get_items_of_type`. :: all_items = book.get_items() Return all of the items with :meth:`ebooklib.epub.EpubBook.get_items`. This is what you are going to use most of the times when handling unknown EPUB files. **Important to remember!** Methods *get_item_with_id*, *get_item_with_href* will return item object. Methods *get_items_of_type*, *get_items_of_type* and *get_items* will return iterator (and not list). To get a content from existing item (regarding if it is image, style sheet or html file) you use :meth:`ebooklib.epub.EpubItem.get_content`. For HTML items you also have :meth:`ebooklib.epub.EpubHtml.get_body_content`. What is the difference? Get_content always return entire content of the file while get_body_content only returns whatever is in the part of the HTML document. :: for item in book.get_items(): if item.get_type() == ebooklib.ITEM_DOCUMENT: print('==================================') print('NAME : ', item.get_name()) print('----------------------------------') print(item.get_content()) print('==================================') Creating EPUB ------------- :: from ebooklib import epub book = epub.EpubBook() EPUB has some minimal metadata requirements which you need to fulfil. You need to define unique identifier, title of the book and language used inside. When it comes to language code recommended best practice is to use a controlled vocabulary such as RFC 4646 - http://www.ietf.org/rfc/rfc4646.txt. :: book.set_identifier('sample123456') book.set_title('Sample book') book.set_language('en') book.add_author('Aleksandar Erkalovic') You can also add custom metadata. First one is from the Dublic Core namespace and second one is purely custom. :: book.add_metadata('DC', 'description', 'This is description for my book') book.add_metadata(None, 'meta', '', {'name': 'key', 'content': 'value'}) This is how our custom metadata will end up in the *content.opf* file. :: This is description for my book Chapters are represented by :class:`ebooklib.epub.EpubHtml`. You must define the *file_name* and *title*. In our case title is going to be used when generating Table of Contents. When defining content you can define it as valid HTML file or just parts of HTML elements you have as a content. It will ignore whatever you have in element. :: # intro chapter c1 = epub.EpubHtml(title='Introduction', file_name='intro.xhtml', lang='en') c1.set_content(u'

Introduction

Introduction paragraph.

') # about chapter c2 = epub.EpubHtml(title='About this book', file_name='about.xhtml') c2.set_content('

About this book

This is a book.

') Do some basic debugging to see what kind of content will end up in the book. In this case we have inserted title of the chapter and language definition. It would also add links to the style sheet files if we have attached them to this chapter. :: >>> print(c1.get_content()) b'\n\n\n \n Introduction\n \n \n

Introduction

\n

Introduction paragraph.

\n \n\n' Any kind of item (style sheet, image, HTML file) must be added to the book. :: book.add_item(c1) book.add_item(c2) You can add any kind of file to the book. For instance, in this case we are adding style sheet file. We define filename, unique id, media_type and content for it. Just like the chapter files you need to add it to the book. Style sheet files could also be added to the chapter. In that case links would be automatically added to the chapter HTML. :: style = 'body { font-family: Times, Times New Roman, serif; }' nav_css = epub.EpubItem(uid="style_nav", file_name="style/nav.css", media_type="text/css", content=style) book.add_item(nav_css) Table of the contents must be defined manually. ToC is a tuple/list of elements. You can either define link manually with :class:`ebooklib.epub.Link` or just insert item object inside. When you manually insert you can define different title in the ToC than in the chapter. If you just insert item object it will use whatever title you defined for that item when creating it. Sections are just tuple with two values. First one is title of the section and 2nd is tuple/list with subchapters. :: book.toc = (epub.Link('intro.xhtml', 'Introduction', 'intro'), ( epub.Section('Languages'), (c1, c2) ) ) So as the Spine. You can use unique id for the item or just add instance of it to the spine. :: book.spine = ['nav', c1, c2] At the end we need to add NCX and Navigation tile. They will not be added automatically. :: book.add_item(epub.EpubNcx()) book.add_item(epub.EpubNav()) At the end write down your book. You need to specify full path to the book, you can not write it down to the File Object or something else. :: epub.write_epub('test.epub', book) It also accepts some of the options. ================= ==================================== Option Default value ================= ==================================== epub2_guide True epub3_landmark True epub3_pages True landmark_title "Guide" pages_title "Pages" spine_direction True package_direction False play_order {'enabled': False, 'start_from': 1} ================= ==================================== Example when overriding default options: :: epub.write_epub('test.epub', book, {"epub3_pages": False}) Samples ------- Further examples are available in https://github.com/aerkalov/ebooklib/tree/master/samples ebooklib-0.17.1/ebooklib/000077500000000000000000000000001341350332300151515ustar00rootroot00000000000000ebooklib-0.17.1/ebooklib/__init__.py000066400000000000000000000027451341350332300172720ustar00rootroot00000000000000# This file is part of EbookLib. # Copyright (c) 2013 Aleksandar Erkalovic # # EbookLib is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # EbookLib 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 Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License # along with EbookLib. If not, see . # Version of ebook library VERSION = (0, 17, 1) # LIST OF POSSIBLE ITEMS ITEM_UNKNOWN = 0 ITEM_IMAGE = 1 ITEM_STYLE = 2 ITEM_SCRIPT = 3 ITEM_NAVIGATION = 4 ITEM_VECTOR = 5 ITEM_FONT = 6 ITEM_VIDEO = 7 ITEM_AUDIO = 8 ITEM_DOCUMENT = 9 ITEM_COVER = 10 ITEM_SMIL = 11 # EXTENSION MAPPER EXTENSIONS = {ITEM_IMAGE: ['.jpg', '.jpeg', '.gif', '.tiff', '.tif', '.png'], ITEM_STYLE: ['.css'], ITEM_VECTOR: ['.svg'], ITEM_FONT: ['.otf', '.woff', '.ttf'], ITEM_SCRIPT: ['.js'], ITEM_NAVIGATION: ['.ncx'], ITEM_VIDEO: ['.mov', '.mp4', '.avi'], ITEM_AUDIO: ['.mp3', '.ogg'], ITEM_COVER: ['.jpg', '.jpeg', '.png'], ITEM_SMIL: ['.smil'] } ebooklib-0.17.1/ebooklib/epub.py000066400000000000000000001566731341350332300165000ustar00rootroot00000000000000# This file is part of EbookLib. # Copyright (c) 2013 Aleksandar Erkalovic # # EbookLib is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # EbookLib 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 Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License # along with EbookLib. If not, see . import zipfile import six import logging import uuid import posixpath as zip_path import os.path from collections import OrderedDict try: from urllib.parse import unquote except ImportError: from urllib import unquote from lxml import etree import ebooklib from ebooklib.utils import parse_string, parse_html_string, guess_type, get_pages_for_items # Version of EPUB library VERSION = (0, 17, 1) NAMESPACES = {'XML': 'http://www.w3.org/XML/1998/namespace', 'EPUB': 'http://www.idpf.org/2007/ops', 'DAISY': 'http://www.daisy.org/z3986/2005/ncx/', 'OPF': 'http://www.idpf.org/2007/opf', 'CONTAINERNS': 'urn:oasis:names:tc:opendocument:xmlns:container', 'DC': 'http://purl.org/dc/elements/1.1/', 'XHTML': 'http://www.w3.org/1999/xhtml'} # XML Templates CONTAINER_PATH = 'META-INF/container.xml' CONTAINER_XML = ''' ''' NCX_XML = six.b(''' ''') NAV_XML = six.b('''''') CHAPTER_XML = six.b('''''') COVER_XML = six.b(''' ''') IMAGE_MEDIA_TYPES = ['image/jpeg', 'image/jpg', 'image/png', 'image/svg+xml'] # TOC and navigation elements class Section(object): def __init__(self, title, href=''): self.title = title self.href = href class Link(object): def __init__(self, href, title, uid=None): self.href = href self.title = title self.uid = uid # Exceptions class EpubException(Exception): def __init__(self, code, msg): self.code = code self.msg = msg def __str__(self): return repr(self.msg) # Items class EpubItem(object): """ Base class for the items in a book. """ def __init__(self, uid=None, file_name='', media_type='', content=six.b(''), manifest=True): """ :Args: - uid: Unique identifier for this item (optional) - file_name: File name for this item (optional) - media_type: Media type for this item (optional) - content: Content for this item (optional) - manifest: Manifest for this item (optional) """ self.id = uid self.file_name = file_name self.media_type = media_type self.content = content self.is_linear = True self.manifest = manifest self.book = None def get_id(self): """ Returns unique identifier for this item. :Returns: Returns uid number as string. """ return self.id def get_name(self): """ Returns name for this item. By default it is always file name but it does not have to be. :Returns: Returns file name for this item. """ return self.file_name def get_type(self): """ Guess type according to the file extension. Might not be the best way how to do it, but it works for now. Items can be of type: - ITEM_UNKNOWN = 0 - ITEM_IMAGE = 1 - ITEM_STYLE = 2 - ITEM_SCRIPT = 3 - ITEM_NAVIGATION = 4 - ITEM_VECTOR = 5 - ITEM_FONT = 6 - ITEM_VIDEO = 7 - ITEM_AUDIO = 8 - ITEM_DOCUMENT = 9 - ITEM_COVER = 10 We map type according to the extensions which are defined in ebooklib.EXTENSIONS. :Returns: Returns type of the item as number. """ _, ext = zip_path.splitext(self.get_name()) ext = ext.lower() for uid, ext_list in six.iteritems(ebooklib.EXTENSIONS): if ext in ext_list: return uid return ebooklib.ITEM_UNKNOWN def get_content(self, default=six.b('')): """ Returns content of the item. Content should be of type 'str' (Python 2) or 'bytes' (Python 3) :Args: - default: Default value for the content if it is not already defined. :Returns: Returns content of the item. """ return self.content or default def set_content(self, content): """ Sets content value for this item. :Args: - content: Content value """ self.content = content def __str__(self): return '' % self.id class EpubNcx(EpubItem): "Represents Navigation Control File (NCX) in the EPUB." def __init__(self, uid='ncx', file_name='toc.ncx'): super(EpubNcx, self).__init__(uid=uid, file_name=file_name, media_type='application/x-dtbncx+xml') def __str__(self): return '' % self.id class EpubCover(EpubItem): """ Represents Cover image in the EPUB file. """ def __init__(self, uid='cover-img', file_name=''): super(EpubCover, self).__init__(uid=uid, file_name=file_name) def get_type(self): return ebooklib.ITEM_COVER def __str__(self): return '' % (self.id, self.file_name) class EpubHtml(EpubItem): """ Represents HTML document in the EPUB file. """ _template_name = 'chapter' def __init__(self, uid=None, file_name='', media_type='', content=None, title='', lang=None, direction=None, media_overlay=None, media_duration=None): super(EpubHtml, self).__init__(uid, file_name, media_type, content) self.title = title self.lang = lang self.direction = direction self.media_overlay = media_overlay self.media_duration = media_duration self.links = [] self.properties = [] self.pages = [] def is_chapter(self): """ Returns if this document is chapter or not. :Returns: Returns book value. """ return True def get_type(self): """ Always returns ebooklib.ITEM_DOCUMENT as type of this document. :Returns: Always returns ebooklib.ITEM_DOCUMENT """ return ebooklib.ITEM_DOCUMENT def set_language(self, lang): """ Sets language for this book item. By default it will use language of the book but it can be overwritten with this call. """ self.lang = lang def get_language(self): """ Get language code for this book item. Language of the book item can be different from the language settings defined globaly for book. :Returns: As string returns language code. """ return self.lang def add_link(self, **kwgs): """ Add additional link to the document. Links will be embeded only inside of this document. >>> add_link(href='styles.css', rel='stylesheet', type='text/css') """ self.links.append(kwgs) def get_links(self): """ Returns list of additional links defined for this document. :Returns: As tuple return list of links. """ return (link for link in self.links) def get_links_of_type(self, link_type): """ Returns list of additional links of specific type. :Returns: As tuple returns list of links. """ return (link for link in self.links if link.get('type', '') == link_type) def add_item(self, item): """ Add other item to this document. It will create additional links according to the item type. :Args: - item: item we want to add defined as instance of EpubItem """ if item.get_type() == ebooklib.ITEM_STYLE: self.add_link(href=item.get_name(), rel='stylesheet', type='text/css') if item.get_type() == ebooklib.ITEM_SCRIPT: self.add_link(src=item.get_name(), type='text/javascript') def get_body_content(self): """ Returns content of BODY element for this HTML document. Content will be of type 'str' (Python 2) or 'bytes' (Python 3). :Returns: Returns content of this document. """ try: html_tree = parse_html_string(self.content) except: return '' html_root = html_tree.getroottree() if len(html_root.find('body')) != 0: body = html_tree.find('body') tree_str = etree.tostring(body, pretty_print=True, encoding='utf-8', xml_declaration=False) # this is so stupid if tree_str.startswith(six.b('')): n = tree_str.rindex(six.b('')) return tree_str[6:n] return tree_str return '' def get_content(self, default=None): """ Returns content for this document as HTML string. Content will be of type 'str' (Python 2) or 'bytes' (Python 3). :Args: - default: Default value for the content if it is not defined. :Returns: Returns content of this document. """ tree = parse_string(self.book.get_template(self._template_name)) tree_root = tree.getroot() tree_root.set('lang', self.lang or self.book.language) tree_root.attrib['{%s}lang' % NAMESPACES['XML']] = self.lang or self.book.language # add to the head also # try: html_tree = parse_html_string(self.content) except: return '' html_root = html_tree.getroottree() # create and populate head _head = etree.SubElement(tree_root, 'head') if self.title != '': _title = etree.SubElement(_head, 'title') _title.text = self.title for lnk in self.links: if lnk.get('type') == 'text/javascript': _lnk = etree.SubElement(_head, 'script', lnk) # force _lnk.text = '' else: _lnk = etree.SubElement(_head, 'link', lnk) # this should not be like this # head = html_root.find('head') # if head is not None: # for i in head.getchildren(): # if i.tag == 'title' and self.title != '': # continue # _head.append(i) # create and populate body _body = etree.SubElement(tree_root, 'body') if self.direction: _body.set('dir', self.direction) body = html_tree.find('body') if body is not None: for i in body.getchildren(): _body.append(i) tree_str = etree.tostring(tree, pretty_print=True, encoding='utf-8', xml_declaration=True) return tree_str def __str__(self): return '' % (self.id, self.file_name) class EpubCoverHtml(EpubHtml): """ Represents Cover page in the EPUB file. """ def __init__(self, uid='cover', file_name='cover.xhtml', image_name='', title='Cover'): super(EpubCoverHtml, self).__init__(uid=uid, file_name=file_name, title=title) self.image_name = image_name self.is_linear = False def is_chapter(self): """ Returns if this document is chapter or not. :Returns: Returns book value. """ return False def get_content(self): """ Returns content for cover page as HTML string. Content will be of type 'str' (Python 2) or 'bytes' (Python 3). :Returns: Returns content of this document. """ self.content = self.book.get_template('cover') tree = parse_string(super(EpubCoverHtml, self).get_content()) tree_root = tree.getroot() images = tree_root.xpath('//xhtml:img', namespaces={'xhtml': NAMESPACES['XHTML']}) images[0].set('src', self.image_name) images[0].set('alt', self.title) tree_str = etree.tostring(tree, pretty_print=True, encoding='utf-8', xml_declaration=True) return tree_str def __str__(self): return '' % (self.id, self.file_name) class EpubNav(EpubHtml): """ Represents Navigation Document in the EPUB file. """ def __init__(self, uid='nav', file_name='nav.xhtml', media_type='application/xhtml+xml'): super(EpubNav, self).__init__(uid=uid, file_name=file_name, media_type=media_type) def is_chapter(self): """ Returns if this document is chapter or not. :Returns: Returns book value. """ return False def __str__(self): return '' % (self.id, self.file_name) class EpubImage(EpubItem): """ Represents Image in the EPUB file. """ def __init__(self): super(EpubImage, self).__init__() def get_type(self): return ebooklib.ITEM_IMAGE def __str__(self): return '' % (self.id, self.file_name) class EpubSMIL(EpubItem): def __init__(self, uid=None, file_name='', content=None): super(EpubSMIL, self).__init__(uid=uid, file_name=file_name, media_type='application/smil+xml', content=content) def get_type(self): return ebooklib.ITEM_SMIL def __str__(self): return '' % (self.id, self.file_name) # EpubBook class EpubBook(object): def __init__(self): self.EPUB_VERSION = None self.reset() # we should have options here def reset(self): "Initialises all needed variables to default values" self.metadata = {} self.items = [] self.spine = [] self.guide = [] self.pages = [] self.toc = [] self.bindings = [] self.IDENTIFIER_ID = 'id' self.FOLDER_NAME = 'EPUB' self._id_html = 0 self._id_image = 0 self._id_static = 0 self.title = '' self.language = 'en' self.direction = None self.templates = { 'ncx': NCX_XML, 'nav': NAV_XML, 'chapter': CHAPTER_XML, 'cover': COVER_XML } self.add_metadata('OPF', 'generator', '', { 'name': 'generator', 'content': 'Ebook-lib %s' % '.'.join([str(s) for s in VERSION]) }) # default to using a randomly-unique identifier if one is not specified manually self.set_identifier(str(uuid.uuid4())) # custom prefixes and namespaces to be set to the content.opf doc self.prefixes = [] self.namespaces = {} def set_identifier(self, uid): """ Sets unique id for this epub :Args: - uid: Value of unique identifier for this book """ self.uid = uid self.set_unique_metadata('DC', 'identifier', self.uid, {'id': self.IDENTIFIER_ID}) def set_title(self, title): """ Set title. You can set multiple titles. :Args: - title: Title value """ self.title = title self.add_metadata('DC', 'title', self.title) def set_language(self, lang): """ Set language for this epub. You can set multiple languages. Specific items in the book can have different language settings. :Args: - lang: Language code """ self.language = lang self.add_metadata('DC', 'language', lang) def set_direction(self, direction): """ :Args: - direction: Options are "ltr", "rtl" and "default" """ self.direction = direction def set_cover(self, file_name, content, create_page=True): """ Set cover and create cover document if needed. :Args: - file_name: file name of the cover page - content: Content for the cover image - create_page: Should cover page be defined. Defined as bool value (optional). Default value is True. """ # as it is now, it can only be called once c0 = EpubCover(file_name=file_name) c0.content = content self.add_item(c0) if create_page: c1 = EpubCoverHtml(image_name=file_name) self.add_item(c1) self.add_metadata(None, 'meta', '', OrderedDict([('name', 'cover'), ('content', 'cover-img')])) def add_author(self, author, file_as=None, role=None, uid='creator'): "Add author for this document" self.add_metadata('DC', 'creator', author, {'id': uid}) if file_as: self.add_metadata(None, 'meta', file_as, {'refines': '#' + uid, 'property': 'file-as', 'scheme': 'marc:relators'}) if role: self.add_metadata(None, 'meta', role, {'refines': '#' + uid, 'property': 'role', 'scheme': 'marc:relators'}) def add_metadata(self, namespace, name, value, others=None): "Add metadata" if namespace in NAMESPACES: namespace = NAMESPACES[namespace] if namespace not in self.metadata: self.metadata[namespace] = {} if name not in self.metadata[namespace]: self.metadata[namespace][name] = [] self.metadata[namespace][name].append((value, others)) def get_metadata(self, namespace, name): "Retrieve metadata" if namespace in NAMESPACES: namespace = NAMESPACES[namespace] return self.metadata[namespace].get(name, []) def set_unique_metadata(self, namespace, name, value, others=None): "Add metadata if metadata with this identifier does not already exist, otherwise update existing metadata." if namespace in NAMESPACES: namespace = NAMESPACES[namespace] if namespace in self.metadata and name in self.metadata[namespace]: self.metadata[namespace][name] = [(value, others)] else: self.add_metadata(namespace, name, value, others) def add_item(self, item): """ Add additional item to the book. If not defined, media type and chapter id will be defined for the item. :Args: - item: Item instance """ if item.media_type == '': (has_guessed, media_type) = guess_type(item.get_name().lower()) if has_guessed: if media_type is not None: item.media_type = media_type else: item.media_type = has_guessed else: item.media_type = 'application/octet-stream' if not item.get_id(): # make chapter_, image_ and static_ configurable if isinstance(item, EpubHtml): item.id = 'chapter_%d' % self._id_html self._id_html += 1 # If there's a page list, append it to the book's page list self.pages += item.pages elif isinstance(item, EpubImage): item.id = 'image_%d' % self._id_image self._id_image += 1 else: item.id = 'static_%d' % self._id_image self._id_image += 1 item.book = self self.items.append(item) return item def get_item_with_id(self, uid): """ Returns item for defined UID. >>> book.get_item_with_id('image_001') :Args: - uid: UID for the item :Returns: Returns item object. Returns None if nothing was found. """ for item in self.get_items(): if item.id == uid: return item return None def get_item_with_href(self, href): """ Returns item for defined HREF. >>> book.get_item_with_href('EPUB/document.xhtml') :Args: - href: HREF for the item we are searching for :Returns: Returns item object. Returns None if nothing was found. """ for item in self.get_items(): if item.get_name() == href: return item return None def get_items(self): """ Returns all items attached to this book. :Returns: Returns all items as tuple. """ return (item for item in self.items) def get_items_of_type(self, item_type): """ Returns all items of specified type. >>> book.get_items_of_type(epub.ITEM_IMAGE) :Args: - item_type: Type for items we are searching for :Returns: Returns found items as tuple. """ return (item for item in self.items if item.get_type() == item_type) def get_items_of_media_type(self, media_type): """ Returns all items of specified media type. :Args: - media_type: Media type for items we are searching for :Returns: Returns found items as tuple. """ return (item for item in self.items if item.media_type == media_type) def set_template(self, name, value): """ Defines templates which are used to generate certain types of pages. When defining new value for the template we have to use content of type 'str' (Python 2) or 'bytes' (Python 3). At the moment we use these templates: - ncx - nav - chapter - cover :Args: - name: Name for the template - value: Content for the template """ self.templates[name] = value def get_template(self, name): """ Returns value for the template. :Args: - name: template name :Returns: Value of the template. """ return self.templates.get(name) def add_prefix(self, name, uri): """ Appends custom prefix to be added to the content.opf document >>> epub_book.add_prefix('bkterms', 'http://booktype.org/') :Args: - name: namespave name - uri: URI for the namespace """ self.prefixes.append('%s: %s' % (name, uri)) class EpubWriter(object): DEFAULT_OPTIONS = { 'epub2_guide': True, 'epub3_landmark': True, 'epub3_pages': True, 'landmark_title': 'Guide', 'pages_title': 'Pages', 'spine_direction': True, 'package_direction': False, 'play_order': { 'enabled': False, 'start_from': 1 } } def __init__(self, name, book, options=None): self.file_name = name self.book = book self.options = dict(self.DEFAULT_OPTIONS) if options: self.options.update(options) self._init_play_order() def _init_play_order(self): self._play_order = { 'enabled': False, 'start_from': 1 } try: self._play_order['enabled'] = self.options['play_order']['enabled'] self._play_order['start_from'] = self.options['play_order']['start_from'] except KeyError: pass def process(self): # should cache this html parsing so we don't do it for every plugin for plg in self.options.get('plugins', []): if hasattr(plg, 'before_write'): plg.before_write(self.book) for item in self.book.get_items(): if isinstance(item, EpubHtml): for plg in self.options.get('plugins', []): if hasattr(plg, 'html_before_write'): plg.html_before_write(self.book, item) def _write_container(self): container_xml = CONTAINER_XML % {'folder_name': self.book.FOLDER_NAME} self.out.writestr(CONTAINER_PATH, container_xml) def _write_opf_metadata(self, root): # This is really not needed # problem is uppercase/lowercase # for ns_name, values in six.iteritems(self.book.metadata): # if ns_name: # for n_id, ns_url in six.iteritems(NAMESPACES): # if ns_name == ns_url: # nsmap[n_id.lower()] = NAMESPACES[n_id] nsmap = {'dc': NAMESPACES['DC'], 'opf': NAMESPACES['OPF']} nsmap.update(self.book.namespaces) metadata = etree.SubElement(root, 'metadata', nsmap=nsmap) el = etree.SubElement(metadata, 'meta', {'property': 'dcterms:modified'}) if 'mtime' in self.options: mtime = self.options['mtime'] else: import datetime mtime = datetime.datetime.now() el.text = mtime.strftime('%Y-%m-%dT%H:%M:%SZ') for ns_name, values in six.iteritems(self.book.metadata): if ns_name == NAMESPACES['OPF']: for values in values.values(): for v in values: if 'property' in v[1] and v[1]['property'] == 'dcterms:modified': continue try: el = etree.SubElement(metadata, 'meta', v[1]) if v[0]: el.text = v[0] except ValueError: logging.error('Could not create metadata.') else: for name, values in six.iteritems(values): for v in values: try: if ns_name: el = etree.SubElement(metadata, '{%s}%s' % (ns_name, name), v[1]) else: el = etree.SubElement(metadata, '%s' % name, v[1]) el.text = v[0] except ValueError: logging.error('Could not create metadata "{}".'.format(name)) def _write_opf_manifest(self, root): manifest = etree.SubElement(root, 'manifest') _ncx_id = None # mathml, scripted, svg, remote-resources, and switch # nav # cover-image for item in self.book.get_items(): if not item.manifest: continue if isinstance(item, EpubNav): etree.SubElement(manifest, 'item', {'href': item.get_name(), 'id': item.id, 'media-type': item.media_type, 'properties': 'nav'}) elif isinstance(item, EpubNcx): _ncx_id = item.id etree.SubElement(manifest, 'item', {'href': item.file_name, 'id': item.id, 'media-type': item.media_type}) elif isinstance(item, EpubCover): etree.SubElement(manifest, 'item', {'href': item.file_name, 'id': item.id, 'media-type': item.media_type, 'properties': 'cover-image'}) else: opts = {'href': item.file_name, 'id': item.id, 'media-type': item.media_type} if hasattr(item, 'properties') and len(item.properties) > 0: opts['properties'] = ' '.join(item.properties) if hasattr(item, 'media_overlay') and item.media_overlay is not None: opts['media-overlay'] = item.media_overlay if hasattr(item, 'media_duration') and item.media_duration is not None: opts['duration'] = item.media_duration etree.SubElement(manifest, 'item', opts) return _ncx_id def _write_opf_spine(self, root, ncx_id): spine_attributes = {'toc': ncx_id or 'ncx'} if self.book.direction and self.options['spine_direction']: spine_attributes['page-progression-direction'] = self.book.direction spine = etree.SubElement(root, 'spine', spine_attributes) for _item in self.book.spine: # this is for now # later we should be able to fetch things from tuple is_linear = True if isinstance(_item, tuple): item = _item[0] if len(_item) > 1: if _item[1] == 'no': is_linear = False else: item = _item if isinstance(item, EpubHtml): opts = {'idref': item.get_id()} if not item.is_linear or not is_linear: opts['linear'] = 'no' elif isinstance(item, EpubItem): opts = {'idref': item.get_id()} if not item.is_linear or not is_linear: opts['linear'] = 'no' else: opts = {'idref': item} try: itm = self.book.get_item_with_id(item) if not itm.is_linear or not is_linear: opts['linear'] = 'no' except: pass etree.SubElement(spine, 'itemref', opts) def _write_opf_guide(self, root): # - http://www.idpf.org/epub/20/spec/OPF_2.0.1_draft.htm#Section2.6 if len(self.book.guide) > 0 and self.options.get('epub2_guide'): guide = etree.SubElement(root, 'guide', {}) for item in self.book.guide: if 'item' in item: chap = item.get('item') if chap: _href = chap.file_name _title = chap.title else: _href = item.get('href', '') _title = item.get('title', '') if _title is None: _title = '' ref = etree.SubElement(guide, 'reference', {'type': item.get('type', ''), 'title': _title, 'href': _href}) def _write_opf_bindings(self, root): if len(self.book.bindings) > 0: bindings = etree.SubElement(root, 'bindings', {}) for item in self.book.bindings: etree.SubElement(bindings, 'mediaType', item) def _write_opf_file(self, root): tree_str = etree.tostring(root, pretty_print=True, encoding='utf-8', xml_declaration=True) self.out.writestr('%s/content.opf' % self.book.FOLDER_NAME, tree_str) def _write_opf(self): package_attributes = {'xmlns': NAMESPACES['OPF'], 'unique-identifier': self.book.IDENTIFIER_ID, 'version': '3.0'} if self.book.direction and self.options['package_direction']: package_attributes['dir'] = self.book.direction root = etree.Element('package', package_attributes) prefixes = ['rendition: http://www.idpf.org/vocab/rendition/#'] + self.book.prefixes root.attrib['prefix'] = ' '.join(prefixes) # METADATA self._write_opf_metadata(root) # MANIFEST _ncx_id = self._write_opf_manifest(root) # SPINE self._write_opf_spine(root, _ncx_id) # GUIDE self._write_opf_guide(root) # BINDINGS self._write_opf_bindings(root) # WRITE FILE self._write_opf_file(root) def _get_nav(self, item): # just a basic navigation for now nav_xml = parse_string(self.book.get_template('nav')) root = nav_xml.getroot() root.set('lang', self.book.language) root.attrib['{%s}lang' % NAMESPACES['XML']] = self.book.language nav_dir_name = os.path.dirname(item.file_name) head = etree.SubElement(root, 'head') title = etree.SubElement(head, 'title') title.text = self.book.title # for now this just handles css files and ignores others for _link in item.links: _lnk = etree.SubElement(head, 'link', { 'href': _link.get('href', ''), 'rel': 'stylesheet', 'type': 'text/css' }) body = etree.SubElement(root, 'body') nav = etree.SubElement(body, 'nav', { '{%s}type' % NAMESPACES['EPUB']: 'toc', 'id': 'id', 'role': 'doc-toc', }) content_title = etree.SubElement(nav, 'h2') content_title.text = self.book.title def _create_section(itm, items): ol = etree.SubElement(itm, 'ol') for item in items: if isinstance(item, tuple) or isinstance(item, list): li = etree.SubElement(ol, 'li') if isinstance(item[0], EpubHtml): a = etree.SubElement(li, 'a', {'href': os.path.relpath(item[0].file_name, nav_dir_name)}) elif isinstance(item[0], Section) and item[0].href != '': a = etree.SubElement(li, 'a', {'href': os.path.relpath(item[0].href, nav_dir_name)}) elif isinstance(item[0], Link): a = etree.SubElement(li, 'a', {'href': os.path.relpath(item[0].href, nav_dir_name)}) else: a = etree.SubElement(li, 'span') a.text = item[0].title _create_section(li, item[1]) elif isinstance(item, Link): li = etree.SubElement(ol, 'li') a = etree.SubElement(li, 'a', {'href': os.path.relpath(item.href, nav_dir_name)}) a.text = item.title elif isinstance(item, EpubHtml): li = etree.SubElement(ol, 'li') a = etree.SubElement(li, 'a', {'href': os.path.relpath(item.file_name, nav_dir_name)}) a.text = item.title _create_section(nav, self.book.toc) # LANDMARKS / GUIDE # - http://www.idpf.org/epub/30/spec/epub30-contentdocs.html#sec-xhtml-nav-def-types-landmarks if len(self.book.guide) > 0 and self.options.get('epub3_landmark'): # Epub2 guide types do not map completely to epub3 landmark types. guide_to_landscape_map = { 'notes': 'rearnotes', 'text': 'bodymatter' } guide_nav = etree.SubElement(body, 'nav', {'{%s}type' % NAMESPACES['EPUB']: 'landmarks'}) guide_content_title = etree.SubElement(guide_nav, 'h2') guide_content_title.text = self.options.get('landmark_title', 'Guide') guild_ol = etree.SubElement(guide_nav, 'ol') for elem in self.book.guide: li_item = etree.SubElement(guild_ol, 'li') if 'item' in elem: chap = elem.get('item', None) if chap: _href = chap.file_name _title = chap.title else: _href = elem.get('href', '') _title = elem.get('title', '') guide_type = elem.get('type', '') a_item = etree.SubElement(li_item, 'a', { '{%s}type' % NAMESPACES['EPUB']: guide_to_landscape_map.get(guide_type, guide_type), 'href': os.path.relpath(_href, nav_dir_name) }) a_item.text = _title # PAGE-LIST if self.options.get('epub3_pages'): inserted_pages = get_pages_for_items([item for item in self.book.get_items_of_type(ebooklib.ITEM_DOCUMENT) \ if not isinstance(item, EpubNav)]) if len(inserted_pages) > 0: pagelist_nav = etree.SubElement( body, 'nav', { '{%s}type' % NAMESPACES['EPUB']: 'page-list', 'id': 'pages', 'hidden': 'hidden', } ) pagelist_content_title = etree.SubElement(pagelist_nav, 'h2') pagelist_content_title.text = self.options.get( 'pages_title', 'Pages' ) pages_ol = etree.SubElement(pagelist_nav, 'ol') for filename, pageref, label in inserted_pages: li_item = etree.SubElement(pages_ol, 'li') _href = u'{}#{}'.format(filename, pageref) _title = label a_item = etree.SubElement(li_item, 'a', { 'href': os.path.relpath(_href, nav_dir_name), }) a_item.text = _title tree_str = etree.tostring(nav_xml, pretty_print=True, encoding='utf-8', xml_declaration=True) return tree_str def _get_ncx(self): # we should be able to setup language for NCX as also ncx = parse_string(self.book.get_template('ncx')) root = ncx.getroot() head = etree.SubElement(root, 'head') # get this id uid = etree.SubElement(head, 'meta', {'content': self.book.uid, 'name': 'dtb:uid'}) uid = etree.SubElement(head, 'meta', {'content': '0', 'name': 'dtb:depth'}) uid = etree.SubElement(head, 'meta', {'content': '0', 'name': 'dtb:totalPageCount'}) uid = etree.SubElement(head, 'meta', {'content': '0', 'name': 'dtb:maxPageNumber'}) doc_title = etree.SubElement(root, 'docTitle') title = etree.SubElement(doc_title, 'text') title.text = self.book.title # doc_author = etree.SubElement(root, 'docAuthor') # author = etree.SubElement(doc_author, 'text') # author.text = 'Name of the person' # For now just make a very simple navMap nav_map = etree.SubElement(root, 'navMap') def _add_play_order(nav_point): nav_point.set('playOrder', str(self._play_order['start_from'])) self._play_order['start_from'] += 1 def _create_section(itm, items, uid): for item in items: if isinstance(item, tuple) or isinstance(item, list): section, subsection = item[0], item[1] np = etree.SubElement(itm, 'navPoint', { 'id': section.get_id() if isinstance(section, EpubHtml) else 'sep_%d' % uid }) if self._play_order['enabled']: _add_play_order(np) nl = etree.SubElement(np, 'navLabel') nt = etree.SubElement(nl, 'text') nt.text = section.title # CAN NOT HAVE EMPTY SRC HERE href = '' if isinstance(section, EpubHtml): href = section.file_name elif isinstance(section, Section) and section.href != '': href = section.href elif isinstance(section, Link): href = section.href nc = etree.SubElement(np, 'content', {'src': href}) uid = _create_section(np, subsection, uid + 1) elif isinstance(item, Link): _parent = itm _content = _parent.find('content') if _content is not None: if _content.get('src') == '': _content.set('src', item.href) np = etree.SubElement(itm, 'navPoint', {'id': item.uid}) if self._play_order['enabled']: _add_play_order(np) nl = etree.SubElement(np, 'navLabel') nt = etree.SubElement(nl, 'text') nt.text = item.title nc = etree.SubElement(np, 'content', {'src': item.href}) elif isinstance(item, EpubHtml): _parent = itm _content = _parent.find('content') if _content is not None: if _content.get('src') == '': _content.set('src', item.file_name) np = etree.SubElement(itm, 'navPoint', {'id': item.get_id()}) if self._play_order['enabled']: _add_play_order(np) nl = etree.SubElement(np, 'navLabel') nt = etree.SubElement(nl, 'text') nt.text = item.title nc = etree.SubElement(np, 'content', {'src': item.file_name}) return uid _create_section(nav_map, self.book.toc, 0) tree_str = etree.tostring(root, pretty_print=True, encoding='utf-8', xml_declaration=True) return tree_str def _write_items(self): for item in self.book.get_items(): if isinstance(item, EpubNcx): self.out.writestr('%s/%s' % (self.book.FOLDER_NAME, item.file_name), self._get_ncx()) elif isinstance(item, EpubNav): self.out.writestr('%s/%s' % (self.book.FOLDER_NAME, item.file_name), self._get_nav(item)) elif item.manifest: self.out.writestr('%s/%s' % (self.book.FOLDER_NAME, item.file_name), item.get_content()) else: self.out.writestr('%s' % item.file_name, item.get_content()) def write(self): # check for the option allowZip64 self.out = zipfile.ZipFile(self.file_name, 'w', zipfile.ZIP_DEFLATED) self.out.writestr('mimetype', 'application/epub+zip', compress_type=zipfile.ZIP_STORED) self._write_container() self._write_opf() self._write_items() self.out.close() class EpubReader(object): DEFAULT_OPTIONS = {} def __init__(self, epub_file_name, options=None): self.file_name = epub_file_name self.book = EpubBook() self.zf = None self.opf_file = '' self.opf_dir = '' self.options = dict(self.DEFAULT_OPTIONS) if options: self.options.update(options) def process(self): # should cache this html parsing so we don't do it for every plugin for plg in self.options.get('plugins', []): if hasattr(plg, 'after_read'): plg.after_read(self.book) for item in self.book.get_items(): if isinstance(item, EpubHtml): for plg in self.options.get('plugins', []): if hasattr(plg, 'html_after_read'): plg.html_after_read(self.book, item) def load(self): self._load() return self.book def read_file(self, name): # Raises KeyError name = zip_path.normpath(name) return self.zf.read(name) def _load_container(self): meta_inf = self.read_file('META-INF/container.xml') tree = parse_string(meta_inf) for root_file in tree.findall('//xmlns:rootfile[@media-type]', namespaces={'xmlns': NAMESPACES['CONTAINERNS']}): if root_file.get('media-type') == 'application/oebps-package+xml': self.opf_file = root_file.get('full-path') self.opf_dir = zip_path.dirname(self.opf_file) def _load_metadata(self): container_root = self.container.getroot() # get epub version self.book.version = container_root.get('version', None) # get unique-identifier if container_root.get('unique-identifier', None): self.book.IDENTIFIER_ID = container_root.get('unique-identifier') # get xml:lang # get metadata metadata = self.container.find('{%s}%s' % (NAMESPACES['OPF'], 'metadata')) nsmap = metadata.nsmap nstags = dict((k, '{%s}' % v) for k, v in six.iteritems(nsmap)) default_ns = nstags.get(None, '') nsdict = dict((v, {}) for v in nsmap.values()) def add_item(ns, tag, value, extra): if ns not in nsdict: nsdict[ns] = {} values = nsdict[ns].setdefault(tag, []) values.append((value, extra)) for t in metadata: if not etree.iselement(t) or t.tag is etree.Comment: continue if t.tag == default_ns + 'meta': name = t.get('name') others = dict((k, v) for k, v in t.items()) if name and ':' in name: prefix, name = name.split(':', 1) else: prefix = None add_item(t.nsmap.get(prefix, prefix), name, t.text, others) else: tag = t.tag[t.tag.rfind('}') + 1:] if (t.prefix and t.prefix.lower() == 'dc') and tag == 'identifier': _id = t.get('id', None) if _id: self.book.IDENTIFIER_ID = _id others = dict((k, v) for k, v in t.items()) add_item(t.nsmap[t.prefix], tag, t.text, others) self.book.metadata = nsdict titles = self.book.get_metadata('DC', 'title') if len(titles) > 0: self.book.title = titles[0][0] for value, others in self.book.get_metadata('DC', 'identifier'): if others.get('id') == self.book.IDENTIFIER_ID: self.book.uid = value def _load_manifest(self): for r in self.container.find('{%s}%s' % (NAMESPACES['OPF'], 'manifest')): if r is not None and r.tag != '{%s}item' % NAMESPACES['OPF']: continue media_type = r.get('media-type') _properties = r.get('properties', '') if _properties: properties = _properties.split(' ') else: properties = [] # people use wrong content types if media_type == 'image/jpg': media_type = 'image/jpeg' if media_type == 'application/x-dtbncx+xml': ei = EpubNcx(uid=r.get('id'), file_name=unquote(r.get('href'))) ei.content = self.read_file(zip_path.join(self.opf_dir, ei.file_name)) if media_type == 'application/smil+xml': ei = EpubSMIL(uid=r.get('id'), file_name=unquote(r.get('href'))) ei.content = self.read_file(zip_path.join(self.opf_dir, ei.file_name)) elif media_type == 'application/xhtml+xml': if 'nav' in properties: ei = EpubNav(uid=r.get('id'), file_name=unquote(r.get('href'))) ei.content = self.read_file(zip_path.join(self.opf_dir, r.get('href'))) elif 'cover' in properties: ei = EpubCoverHtml() ei.content = self.read_file(zip_path.join(self.opf_dir, unquote(r.get('href')))) else: ei = EpubHtml() ei.id = r.get('id') ei.file_name = unquote(r.get('href')) ei.media_type = media_type ei.media_overlay = r.get('media-overlay', None) ei.media_duration = r.get('duration', None) ei.content = self.read_file(zip_path.join(self.opf_dir, ei.get_name())) ei.properties = properties elif media_type in IMAGE_MEDIA_TYPES: if 'cover-image' in properties: ei = EpubCover(uid=r.get('id'), file_name=unquote(r.get('href'))) ei.media_type = media_type ei.content = self.read_file(zip_path.join(self.opf_dir, ei.get_name())) else: ei = EpubImage() ei.id = r.get('id') ei.file_name = unquote(r.get('href')) ei.media_type = media_type ei.content = self.read_file(zip_path.join(self.opf_dir, ei.get_name())) else: # different types ei = EpubItem() ei.id = r.get('id') ei.file_name = unquote(r.get('href')) ei.media_type = media_type ei.content = self.read_file(zip_path.join(self.opf_dir, ei.get_name())) self.book.add_item(ei) def _parse_ncx(self, data): tree = parse_string(data) tree_root = tree.getroot() nav_map = tree_root.find('{%s}navMap' % NAMESPACES['DAISY']) def _get_children(elems, n, nid): label, content = '', '' children = [] for a in elems.getchildren(): if a.tag == '{%s}navLabel' % NAMESPACES['DAISY']: label = a.getchildren()[0].text if a.tag == '{%s}content' % NAMESPACES['DAISY']: content = a.get('src', '') if a.tag == '{%s}navPoint' % NAMESPACES['DAISY']: children.append(_get_children(a, n + 1, a.get('id', ''))) if len(children) > 0: if n == 0: return children return (Section(label, href=content), children) else: return Link(content, label, nid) self.book.toc = _get_children(nav_map, 0, '') def _parse_nav(self, data, base_path, navtype='toc'): html_node = parse_html_string(data) if navtype == 'toc': # parsing the table of contents nav_node = html_node.xpath("//nav[@*='toc']")[0] else: # parsing the list of pages _page_list = html_node.xpath("//nav[@*='page-list']") if len(_page_list) == 0: return nav_node = _page_list[0] def parse_list(list_node): items = [] for item_node in list_node.findall('li'): sublist_node = item_node.find('ol') link_node = item_node.find('a') if sublist_node is not None: title = item_node[0].text children = parse_list(sublist_node) if link_node is not None: href = zip_path.normpath(zip_path.join(base_path, link_node.get('href'))) items.append((Section(title, href=href), children)) else: items.append((Section(title), children)) elif link_node is not None: title = link_node.text href = zip_path.normpath(zip_path.join(base_path, link_node.get('href'))) items.append(Link(href, title)) return items if navtype == 'toc': self.book.toc = parse_list(nav_node.find('ol')) elif nav_node is not None: # generate the pages list if there is one self.book.pages = parse_list(nav_node.find('ol')) # generate the per-file pages lists # because of the order of parsing the files, this can't be done # when building the EpubHtml objects htmlfiles = dict() for htmlfile in self.book.items: if isinstance(htmlfile, EpubHtml): htmlfiles[htmlfile.file_name] = htmlfile for page in self.book.pages: try: (filename, idref) = page.href.split('#') except ValueError: filename = page.href if filename in htmlfiles: htmlfiles[filename].pages.append(page) def _load_spine(self): spine = self.container.find('{%s}%s' % (NAMESPACES['OPF'], 'spine')) self.book.spine = [(t.get('idref'), t.get('linear', 'yes')) for t in spine] toc = spine.get('toc', '') self.book.set_direction(spine.get('page-progression-direction', None)) # should read ncx or nav file if toc: try: ncxFile = self.read_file(zip_path.join(self.opf_dir, self.book.get_item_with_id(toc).get_name())) except KeyError: raise EpubException(-1, 'Can not find ncx file.') self._parse_ncx(ncxFile) def _load_guide(self): guide = self.container.find('{%s}%s' % (NAMESPACES['OPF'], 'guide')) if guide is not None: self.book.guide = [{'href': t.get('href'), 'title': t.get('title'), 'type': t.get('type')} for t in guide] def _load_opf_file(self): try: s = self.read_file(self.opf_file) except KeyError: raise EpubException(-1, 'Can not find container file') self.container = parse_string(s) self._load_metadata() self._load_manifest() self._load_spine() self._load_guide() # read nav file if found # nav_item = next((item for item in self.book.items if isinstance(item, EpubNav)), None) if nav_item: if not self.book.toc: self._parse_nav( nav_item.content, zip_path.dirname(nav_item.file_name), navtype='toc' ) self._parse_nav( nav_item.content, zip_path.dirname(nav_item.file_name), navtype='pages' ) def _load(self): try: self.zf = zipfile.ZipFile(self.file_name, 'r', compression=zipfile.ZIP_DEFLATED, allowZip64=True) except zipfile.BadZipfile as bz: raise EpubException(0, 'Bad Zip file') except zipfile.LargeZipFile as bz: raise EpubException(1, 'Large Zip file') # 1st check metadata self._load_container() self._load_opf_file() self.zf.close() # WRITE def write_epub(name, book, options=None): """ Creates epub file with the content defined in EpubBook. >>> ebooklib.write_epub('book.epub', book) :Args: - name: file name for the output file - book: instance of EpubBook - options: extra opions as dictionary (optional) """ epub = EpubWriter(name, book, options) epub.process() try: epub.write() except IOError: pass # READ def read_epub(name, options=None): """ Creates new instance of EpubBook with the content defined in the input file. >>> book = ebooklib.read_epub('book.epub') :Args: - name: full path to the input file - options: extra options as dictionary (optional) :Returns: Instance of EpubBook. """ reader = EpubReader(name, options) book = reader.load() reader.process() return book ebooklib-0.17.1/ebooklib/plugins/000077500000000000000000000000001341350332300166325ustar00rootroot00000000000000ebooklib-0.17.1/ebooklib/plugins/__init__.py000066400000000000000000000000001341350332300207310ustar00rootroot00000000000000ebooklib-0.17.1/ebooklib/plugins/base.py000066400000000000000000000030121341350332300201120ustar00rootroot00000000000000# This file is part of EbookLib. # Copyright (c) 2013 Aleksandar Erkalovic # # EbookLib is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # EbookLib 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 Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License # along with EbookLib. If not, see . class BasePlugin(object): def before_write(self, book): "Processing before save" return True def after_write(self, book): "Processing after save" return True def before_read(self, book): "Processing before save" return True def after_read(self, book): "Processing after save" return True def item_after_read(self, book, item): "Process general item after read." return True def item_before_write(self, book, item): "Process general item before write." return True def html_after_read(self, book, chapter): "Processing HTML before read." return True def html_before_write(self, book, chapter): "Processing HTML before save." return True ebooklib-0.17.1/ebooklib/plugins/booktype.py000066400000000000000000000104071341350332300210420ustar00rootroot00000000000000# This file is part of EbookLib. # Copyright (c) 2013 Aleksandar Erkalovic # # EbookLib is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # EbookLib 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 Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License # along with EbookLib. If not, see . from ebooklib.plugins.base import BasePlugin from ebooklib.utils import parse_html_string class BooktypeLinks(BasePlugin): NAME = 'Booktype Links' def __init__(self, booktype_book): self.booktype_book = booktype_book def html_before_write(self, book, chapter): from lxml import etree try: from urlparse import urlparse, urljoin except ImportError: from urllib.parse import urlparse, urljoin try: tree = parse_html_string(chapter.content) except: return root = tree.getroottree() if len(root.find('body')) != 0: body = tree.find('body') # should also be aware to handle # ../chapter/ # ../chapter/#reference # ../chapter#reference for _link in body.xpath('//a'): # This is just temporary for the footnotes if _link.get('href', '').find('InsertNoteID') != -1: _ln = _link.get('href', '') i = _ln.find('#') _link.set('href', _ln[i:]) continue _u = urlparse(_link.get('href', '')) # Let us care only for internal links at the moment if _u.scheme == '': if _u.path != '': _link.set('href', '%s.xhtml' % _u.path) if _u.fragment != '': _link.set('href', urljoin(_link.get('href'), '#%s' % _u.fragment)) if _link.get('name') != None: _link.set('id', _link.get('name')) etree.strip_attributes(_link, 'name') chapter.content = etree.tostring(tree, pretty_print=True, encoding='utf-8') class BooktypeFootnotes(BasePlugin): NAME = 'Booktype Footnotes' def __init__(self, booktype_book): self.booktype_book = booktype_book def html_before_write(self, book, chapter): from lxml import etree from ebooklib import epub try: tree = parse_html_string(chapter.content) except: return root = tree.getroottree() if len(root.find('body')) != 0: body = tree.find('body') # 1 #
  1. prvi footnote ^
  2. # 1

    # for footnote in body.xpath('//span[@class="InsertNoteMarker"]'): footnote_id = footnote.get('id')[:-8] a = footnote.getchildren()[0].getchildren()[0] footnote_text = body.xpath('//li[@id="%s"]' % footnote_id)[0] a.attrib['{%s}type' % epub.NAMESPACES['EPUB']] = 'noteref' ftn = etree.SubElement(body, 'aside', {'id': footnote_id}) ftn.attrib['{%s}type' % epub.NAMESPACES['EPUB']] = 'footnote' ftn_p = etree.SubElement(ftn, 'p') ftn_p.text = footnote_text.text old_footnote = body.xpath('//ol[@id="InsertNote_NoteList"]') if len(old_footnote) > 0: body.remove(old_footnote[0]) chapter.content = etree.tostring(tree, pretty_print=True, encoding='utf-8') ebooklib-0.17.1/ebooklib/plugins/sourcecode.py000066400000000000000000000046611341350332300213460ustar00rootroot00000000000000# This file is part of EbookLib. # Copyright (c) 2013 Aleksandar Erkalovic # # EbookLib is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # EbookLib 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 Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License # along with EbookLib. If not, see . from ebooklib.plugins.base import BasePlugin from ebooklib.utils import parse_html_string class SourceHighlighter(BasePlugin): def __init__(self): pass def html_before_write(self, book, chapter): from lxml import etree, html from pygments import highlight from pygments.formatters import HtmlFormatter from ebooklib import epub try: tree = parse_html_string(chapter.content) except: return root = tree.getroottree() had_source = False if len(root.find('body')) != 0: body = tree.find('body') # check for embeded source for source in body.xpath('//pre[contains(@class,"source-")]'): css_class = source.get('class') source_text = (source.text or '') + ''.join([html.tostring(child) for child in source.iterchildren()]) if 'source-python' in css_class: from pygments.lexers import PythonLexer # _text = highlight(source_text, PythonLexer(), HtmlFormatter(linenos="inline")) _text = highlight(source_text, PythonLexer(), HtmlFormatter()) if 'source-css' in css_class: from pygments.lexers import CssLexer _text = highlight(source_text, CssLexer(), HtmlFormatter()) _parent = source.getparent() _parent.replace(source, etree.XML(_text)) had_source = True if had_source: chapter.add_link(href="style/code.css", rel="stylesheet", type="text/css") chapter.content = etree.tostring(tree, pretty_print=True, encoding='utf-8') ebooklib-0.17.1/ebooklib/plugins/standard.py000066400000000000000000000303661341350332300210140ustar00rootroot00000000000000# This file is part of EbookLib. # Copyright (c) 2013 Aleksandar Erkalovic # # EbookLib is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # EbookLib 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 Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License # along with EbookLib. If not, see . import six from ebooklib.plugins.base import BasePlugin from ebooklib.utils import parse_html_string # TODO: # - should also look for the _required_ elements # http://www.w3.org/html/wg/drafts/html/master/tabular-data.html#the-table-element ATTRIBUTES_GLOBAL = ['accesskey', 'class', 'contenteditable', 'contextmenu', 'dir', 'draggable', 'dropzone', 'hidden', 'id', 'inert', 'itemid', 'itemprop', 'itemref', 'itemscope', 'itemtype', 'lang', 'spellcheck', 'style', 'tabindex', 'title', 'translate', 'epub:type'] # Remove for now from here DEPRECATED_TAGS = ['acronym', 'applet', 'basefont', 'big', 'center', 'dir', 'font', 'frame', 'frameset', 'isindex', 'noframes', 's', 'strike', 'tt'] def leave_only(item, tag_list): for _attr in six.iterkeys(item.attrib): if _attr not in tag_list: del item.attrib[_attr] class SyntaxPlugin(BasePlugin): NAME = 'Check HTML syntax' def html_before_write(self, book, chapter): from lxml import etree try: tree = parse_html_string(chapter.content) except: return root = tree.getroottree() # delete deprecated tags # i should really have a list of allowed tags for tag in DEPRECATED_TAGS: etree.strip_tags(root, tag) head = tree.find('head') if head is not None and len(head) != 0: for _item in head: if _item.tag == 'base': leave_only(_item, ATTRIBUTES_GLOBAL + ['href', 'target']) elif _item.tag == 'link': leave_only(_item, ATTRIBUTES_GLOBAL + ['href', 'crossorigin', 'rel', 'media', 'hreflang', 'type', 'sizes']) elif _item.tag == 'title': if _item.text == '': head.remove(_item) elif _item.tag == 'meta': leave_only(_item, ATTRIBUTES_GLOBAL + ['name', 'http-equiv', 'content', 'charset']) # just remove for now, but really should not be like this head.remove(_item) elif _item.tag == 'script': leave_only(_item, ATTRIBUTES_GLOBAL + ['src', 'type', 'charset', 'async', 'defer', 'crossorigin']) elif _item.tag == 'source': leave_only(_item, ATTRIBUTES_GLOBAL + ['src', 'type', 'media']) elif _item.tag == 'style': leave_only(_item, ATTRIBUTES_GLOBAL + ['media', 'type', 'scoped']) else: leave_only(_item, ATTRIBUTES_GLOBAL) if len(root.find('body')) != 0: body = tree.find('body') for _item in body.iter(): # it is not # if _item.tag == 'a': leave_only(_item, ATTRIBUTES_GLOBAL + ['href', 'target', 'download', 'rel', 'hreflang', 'type']) elif _item.tag == 'area': leave_only(_item, ATTRIBUTES_GLOBAL + ['alt', 'coords', 'shape', 'href', 'target', 'download', 'rel', 'hreflang', 'type']) elif _item.tag == 'audio': leave_only(_item, ATTRIBUTES_GLOBAL + ['src', 'crossorigin', 'preload', 'autoplay', 'mediagroup', 'loop', 'muted', 'controls']) elif _item.tag == 'blockquote': leave_only(_item, ATTRIBUTES_GLOBAL + ['cite']) elif _item.tag == 'button': leave_only(_item, ATTRIBUTES_GLOBAL + ['autofocus', 'disabled', 'form', 'formaction', 'formenctype', 'formmethod', 'formnovalidate', 'formtarget', 'name', 'type', 'value', 'menu']) elif _item.tag == 'canvas': leave_only(_item, ATTRIBUTES_GLOBAL + ['width', 'height']) elif _item.tag == 'canvas': leave_only(_item, ATTRIBUTES_GLOBAL + ['width', 'height']) elif _item.tag == 'del': leave_only(_item, ATTRIBUTES_GLOBAL + ['cite', 'datetime']) elif _item.tag == 'details': leave_only(_item, ATTRIBUTES_GLOBAL + ['open']) elif _item.tag == 'embed': leave_only(_item, ATTRIBUTES_GLOBAL + ['src', 'type', 'width', 'height']) elif _item.tag == 'fieldset': leave_only(_item, ATTRIBUTES_GLOBAL + ['disable', 'form', 'name']) elif _item.tag == 'details': leave_only(_item, ATTRIBUTES_GLOBAL + ['accept-charset', 'action', 'autocomplete', 'enctype', 'method', 'name', 'novalidate', 'target']) elif _item.tag == 'iframe': leave_only(_item, ATTRIBUTES_GLOBAL + ['src', 'srcdoc', 'name', 'sandbox', 'seamless', 'allowfullscreen', 'width', 'height']) elif _item.tag == 'img': _src = _item.get('src', '').lower() if _src.startswith('http://') or _src.startswith('https://'): if 'remote-resources' not in chapter.properties: chapter.properties.append('remote-resources') # THIS DOES NOT WORK, ONLY VIDEO AND AUDIO FILES CAN BE REMOTE RESOURCES # THAT MEANS I SHOULD ALSO CATCH # # EbookLib is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # EbookLib 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 Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License # along with EbookLib. If not, see . import six import subprocess from ebooklib.plugins.base import BasePlugin from ebooklib.utils import parse_html_string # Recommend usage of # - https://github.com/w3c/tidy-html5 def tidy_cleanup(content, **extra): cmd = [] for k, v in six.iteritems(extra): if v: cmd.append('--%s' % k) cmd.append(v) else: cmd.append('-%s' % k) # must parse all other extra arguments try: p = subprocess.Popen(['tidy']+cmd, shell=False, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, close_fds=True) except OSError: return (3, None) p.stdin.write(content) (cont, p_err) = p.communicate() # 0 - all ok # 1 - there were warnings # 2 - there were errors # 3 - exception return (p.returncode, cont) class TidyPlugin(BasePlugin): NAME = 'Tidy HTML' OPTIONS = {'char-encoding': 'utf8', 'tidy-mark': 'no' } def __init__(self, extra = {}): self.options = dict(self.OPTIONS) self.options.update(extra) def html_before_write(self, book, chapter): if not chapter.content: return None (_, chapter.content) = tidy_cleanup(chapter.content, **self.options) return chapter.content def html_after_read(self, book, chapter): if not chapter.content: return None (_, chapter.content) = tidy_cleanup(chapter.content, **self.options) return chapter.content ebooklib-0.17.1/ebooklib/utils.py000066400000000000000000000060431341350332300166660ustar00rootroot00000000000000# This file is part of EbookLib. # Copyright (c) 2013 Aleksandar Erkalovic # # EbookLib is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # EbookLib 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 Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License # along with EbookLib. If not, see . import io import mimetypes from lxml import etree mimetype_initialised = False def debug(obj): import pprint pp = pprint.PrettyPrinter(indent=4) pp.pprint(obj) def parse_string(s): try: tree = etree.parse(io.BytesIO(s.encode('utf-8'))) except: tree = etree.parse(io.BytesIO(s)) return tree def parse_html_string(s): from lxml import html utf8_parser = html.HTMLParser(encoding='utf-8') html_tree = html.document_fromstring(s, parser=utf8_parser) return html_tree def guess_type(extenstion): global mimetype_initialised if not mimetype_initialised: mimetypes.init() mimetypes.add_type('application/xhtml+xml', '.xhtml') mimetype_initialised = True return mimetypes.guess_type(extenstion) def create_pagebreak(pageref, label=None, html=True): from ebooklib.epub import NAMESPACES pageref_attributes = { '{%s}type' % NAMESPACES['EPUB']: 'pagebreak', 'title': u'{}'.format(pageref), 'id': u'{}'.format(pageref), } pageref_elem = etree.Element('span', pageref_attributes, nsmap={'epub': NAMESPACES['EPUB']}) if label: pageref_elem.text = label if html: return etree.tostring(pageref_elem, encoding='unicode') return pageref_elem def get_headers(elem): for n in range(1, 7): headers = elem.xpath('./h{}'.format(n)) if len(headers) > 0: text = headers[0].text_content().strip() if len(text) > 0: return text return None def get_pages(item): body = parse_html_string(item.get_body_content()) pages = [] for elem in body.iter(): if 'epub:type' in elem.attrib: if elem.get('id') is not None: _text = None if elem.text is not None and elem.text.strip() != '': _text = elem.text.strip() if _text is None: _text = elem.get('aria-label') if _text is None: _text = get_headers(elem) pages.append((item.get_name(), elem.get('id'), _text or elem.get('id'))) return pages def get_pages_for_items(items): pages_from_docs = [get_pages(item) for item in items] return [item for pages in pages_from_docs for item in pages] ebooklib-0.17.1/samples/000077500000000000000000000000001341350332300150275ustar00rootroot00000000000000ebooklib-0.17.1/samples/01_basic_create/000077500000000000000000000000001341350332300177335ustar00rootroot00000000000000ebooklib-0.17.1/samples/01_basic_create/README.md000066400000000000000000000001211341350332300212040ustar00rootroot00000000000000Basic create ============ Simple EPUB3 creation. ## Start python create.pyebooklib-0.17.1/samples/01_basic_create/create.py000066400000000000000000000036551341350332300215610ustar00rootroot00000000000000# coding=utf-8 from ebooklib import epub if __name__ == '__main__': book = epub.EpubBook() # add metadata book.set_identifier('sample123456') book.set_title('Sample book') book.set_language('en') book.add_author('Aleksandar Erkalovic') # intro chapter c1 = epub.EpubHtml(title='Introduction', file_name='intro.xhtml', lang='en') c1.content=u'

    Introduction

    Introduction paragraph where i explain what is happening.

    ' # about chapter c2 = epub.EpubHtml(title='About this book', file_name='about.xhtml') c2.content='

    About this book

    Helou, this is my book! There are many books, but this one is mine.

    ' # add chapters to the book book.add_item(c1) book.add_item(c2) # create table of contents # - add section # - add auto created links to chapters book.toc = (epub.Link('intro.xhtml', 'Introduction', 'intro'), (epub.Section('Languages'), (c1, c2)) ) # add navigation files book.add_item(epub.EpubNcx()) book.add_item(epub.EpubNav()) # define css style style = ''' @namespace epub "http://www.idpf.org/2007/ops"; body { font-family: Cambria, Liberation Serif, Bitstream Vera Serif, Georgia, Times, Times New Roman, serif; } h2 { text-align: left; text-transform: uppercase; font-weight: 200; } ol { list-style-type: none; } ol > li:first-child { margin-top: 0.3em; } nav[epub|type~='toc'] > ol > li > ol { list-style-type:square; } nav[epub|type~='toc'] > ol > li > ol > li { margin-top: 0.3em; } ''' # add css file nav_css = epub.EpubItem(uid="style_nav", file_name="style/nav.css", media_type="text/css", content=style) book.add_item(nav_css) # create spine book.spine = ['nav', c1, c2] # create epub file epub.write_epub('test.epub', book, {}) ebooklib-0.17.1/samples/02_cover_create/000077500000000000000000000000001341350332300177715ustar00rootroot00000000000000ebooklib-0.17.1/samples/02_cover_create/README.md000066400000000000000000000001411341350332300212440ustar00rootroot00000000000000Cover support ============= Create simple EPUB3 with cover page. ## Start python create.pyebooklib-0.17.1/samples/02_cover_create/cover.jpg000066400000000000000000002530541341350332300216220ustar00rootroot00000000000000*ExifMM*bj(1 r2i ' 'Adobe Photoshop CS6 (Macintosh)2013:02:09 13:28:28N"*(2HH XICC_PROFILE HLinomntrRGB XYZ  1acspMSFTIEC sRGB-HP cprtP3desclwtptbkptrXYZgXYZ,bXYZ@dmndTpdmddvuedLview$lumimeas $tech0 rTRC< gTRC< bTRC< textCopyright (c) 1998 Hewlett-Packard CompanydescsRGB IEC61966-2.1sRGB IEC61966-2.1XYZ QXYZ XYZ o8XYZ bXYZ $descIEC http://www.iec.chIEC http://www.iec.chdesc.IEC 61966-2.1 Default RGB colour space - sRGB.IEC 61966-2.1 Default RGB colour space - sRGBdesc,Reference Viewing Condition in IEC61966-2.1,Reference Viewing Condition in IEC61966-2.1view_. \XYZ L VPWmeassig CRT curv #(-27;@EJOTY^chmrw| %+28>ELRY`gnu| &/8AKT]gqz !-8COZfr~ -;HUcq~ +:IXgw'7HYj{+=Oat 2FZn  % : O d y  ' = T j " 9 Q i  * C \ u & @ Z t .Id %A^z &Ca~1Om&Ed#Cc'Ij4Vx&IlAe@e Ek*Qw;c*R{Gp@j>i  A l !!H!u!!!"'"U"""# #8#f###$$M$|$$% %8%h%%%&'&W&&&''I'z''( (?(q(())8)k))**5*h**++6+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/ezmi~\f9AkZ^ӡ}߼׵j( 3\_k]nsMv=/QO$N6k/ǺVCK1oܵ)GCϩ8V1v)I$JRI$'Photoshop 3.08BIMZ%GZ%G8BIM%]tn۾9y\8BIM: printOutputPstSboolInteenumInteClrmprintSixteenBitbool printerNameTEXTprintProofSetupObjc Proof Setup proofSetupBltnenum builtinProof proofCMYK8BIM;-printOutputOptionsCptnboolClbrboolRgsMboolCrnCboolCntCboolLblsboolNgtvboolEmlDboolIntrboolBckgObjcRGBCRd doub@oGrn doub@oBl doub@oBrdTUntF#RltBld UntF#RltRsltUntF#Pxl@R vectorDataboolPgPsenumPgPsPgPCLeftUntF#RltTop UntF#RltScl UntF#Prc@YcropWhenPrintingboolcropRectBottomlong cropRectLeftlong cropRectRightlong cropRectToplong8BIMHH8BIM&?8BIM x8BIM8BIM 8BIM' 8BIMH/fflff/ff2Z5-8BIMp8BIM@@8BIM8BIM]NThe-binary-chronicesNnullboundsObjcRct1Top longLeftlongBtomlongRghtlongNslicesVlLsObjcslicesliceIDlonggroupIDlongoriginenum ESliceOrigin autoGeneratedTypeenum ESliceTypeImg boundsObjcRct1Top longLeftlongBtomlongRghtlongNurlTEXTnullTEXTMsgeTEXTaltTagTEXTcellTextIsHTMLboolcellTextTEXT horzAlignenumESliceHorzAligndefault vertAlignenumESliceVertAligndefault bgColorTypeenumESliceBGColorTypeNone topOutsetlong leftOutsetlong bottomOutsetlong rightOutsetlong8BIM( ?8BIM8BIM  ~| XICC_PROFILE HLinomntrRGB XYZ  1acspMSFTIEC sRGB-HP cprtP3desclwtptbkptrXYZgXYZ,bXYZ@dmndTpdmddvuedLview$lumimeas $tech0 rTRC< gTRC< bTRC< textCopyright (c) 1998 Hewlett-Packard CompanydescsRGB IEC61966-2.1sRGB IEC61966-2.1XYZ QXYZ XYZ o8XYZ bXYZ $descIEC http://www.iec.chIEC http://www.iec.chdesc.IEC 61966-2.1 Default RGB colour space - sRGB.IEC 61966-2.1 Default RGB colour space - sRGBdesc,Reference Viewing Condition in IEC61966-2.1,Reference Viewing Condition in IEC61966-2.1view_. \XYZ L VPWmeassig CRT curv #(-27;@EJOTY^chmrw| %+28>ELRY`gnu| &/8AKT]gqz !-8COZfr~ -;HUcq~ +:IXgw'7HYj{+=Oat 2FZn  % : O d y  ' = T j " 9 Q i  * C \ u & @ Z t .Id %A^z &Ca~1Om&Ed#Cc'Ij4Vx&IlAe@e Ek*Qw;c*R{Gp@j>i  A l !!H!u!!!"'"U"""# #8#f###$$M$|$$% %8%h%%%&'&W&&&''I'z''( (?(q(())8)k))**5*h**++6+i++,,9,n,,- -A-v--..L.../$/Z///050l0011J1112*2c223 3F3334+4e4455M555676r667$7`7788P8899B999:6:t::;-;k;;<' >`>>?!?a??@#@d@@A)AjAAB0BrBBC:C}CDDGDDEEUEEF"FgFFG5G{GHHKHHIIcIIJ7J}JK KSKKL*LrLMMJMMN%NnNOOIOOP'PqPQQPQQR1R|RSS_SSTBTTU(UuUVV\VVWDWWX/X}XYYiYZZVZZ[E[[\5\\]']x]^^l^__a_``W``aOaabIbbcCccd@dde=eef=ffg=ggh?hhiCiijHjjkOkklWlmm`mnnknooxop+ppq:qqrKrss]sttptu(uuv>vvwVwxxnxy*yyzFz{{c{|!||}A}~~b~#G k͂0WGrׇ;iΉ3dʋ0cʍ1fΏ6n֑?zM _ɖ4 uL$h՛BdҞ@iءG&vVǥ8nRĩ7u\ЭD-u`ֲK³8%yhYѹJº;.! zpg_XQKFAǿ=ȼ:ɹ8ʷ6˶5̵5͵6ζ7ϸ9к<Ѿ?DINU\dlvۀ܊ݖޢ)߯6DScs 2F[p(@Xr4Pm8Ww)Km Adobe_CMAdobed            ~"?   3!1AQa"q2B#$Rb34rC%Scs5&DTdE£t6UeuF'Vfv7GWgw5!1AQaq"2B#R3$brCScs4%&5DTdEU6teuFVfv'7GWgw ?TT&$״piΙ jݝ#m`H5R7"}cߥ#vN!;Xm`';R\f|Xrm5$nGwDk44!?H֊9@CE]NOǭ,vkADJ{k7hL;MR'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y1oZB>adzOk_ӁTכëN+)}.vW_}E 7XZ5 ׁs j㱮sxo%svD2ݍhѕ>vwk}yog[{o\^\-gG?W &ZZzUkqkWv;q~KrC[I$I$TI%)$IJT:t>Ŏ @]FtVc%<eĂƀL( uOP@!L GaL:r's̡II,%^ y^qiѕy J{4]O2׿zjdEmd]]?D Dfy8&ZIUt;ڱz?Mn&6Jo0:atI)I$JRI$TI%)$IJY_Z4Xַ3 ߵj8fHr1/t>J|tdlqm&V]6۶"\[~oekr:}o0= ;m0~S:zu^jw{u%=sS6j`X a;u\dg])hX/ezmi~\f9AkZ^ӡ}߼׵j( 3\_k]nsMv=/QO$N6k/ǺVCK1oܵ)GCϩ8V1v)I$JRI$8BIM!UAdobe PhotoshopAdobe Photoshop CS68BIMhttp://ns.adobe.com/xap/1.0/ B45851E6EC9E130BE35D35FB857AB355 XICC_PROFILE HLinomntrRGB XYZ  1acspMSFTIEC sRGB-HP cprtP3desclwtptbkptrXYZgXYZ,bXYZ@dmndTpdmddvuedLview$lumimeas $tech0 rTRC< gTRC< bTRC< textCopyright (c) 1998 Hewlett-Packard CompanydescsRGB IEC61966-2.1sRGB IEC61966-2.1XYZ QXYZ XYZ o8XYZ bXYZ $descIEC http://www.iec.chIEC http://www.iec.chdesc.IEC 61966-2.1 Default RGB colour space - sRGB.IEC 61966-2.1 Default RGB colour space - sRGBdesc,Reference Viewing Condition in IEC61966-2.1,Reference Viewing Condition in IEC61966-2.1view_. \XYZ L VPWmeassig CRT curv #(-27;@EJOTY^chmrw| %+28>ELRY`gnu| &/8AKT]gqz !-8COZfr~ -;HUcq~ +:IXgw'7HYj{+=Oat 2FZn  % : O d y  ' = T j " 9 Q i  * C \ u & @ Z t .Id %A^z &Ca~1Om&Ed#Cc'Ij4Vx&IlAe@e Ek*Qw;c*R{Gp@j>i  A l !!H!u!!!"'"U"""# #8#f###$$M$|$$% %8%h%%%&'&W&&&''I'z''( (?(q(())8)k))**5*h**++6+i++,,9,n,,- -A-v--..L.../$/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*UثWb]v*UتYOupW>b> |UX__T>>b8bMX 5ܞcx  ncC iT,ғljVaqLU/ԹV9sSMKAxҋrk%W,UoIc2}^jHP|P<)u)bKV'@68ij'cN7Qm&TH^D@G'q_\V%bX"F1 uSRB9J!4_^E45,޲kh~x=5,kdQM=CɌL#ys,bƼCi]y6jÓzV>إiǜ l$弄sWM[%eԘJ„zvX=/JN];*&~p?D[6_f]v*UثWb]v*UثWb]v*UثWbebooklib-0.17.1/samples/02_cover_create/create.py000066400000000000000000000041601341350332300216070ustar00rootroot00000000000000# coding=utf-8 from ebooklib import epub if __name__ == '__main__': book = epub.EpubBook() # add metadata book.set_identifier('sample123456') book.set_title('Sample book') book.set_language('en') book.add_author('Aleksandar Erkalovic') # add cover image book.set_cover("image.jpg", open('cover.jpg', 'rb').read()) # intro chapter c1 = epub.EpubHtml(title='Introduction', file_name='intro.xhtml', lang='hr') c1.content=u'

    Introduction

    Introduction paragraph where i explain what is happening.

    ' # about chapter c2 = epub.EpubHtml(title='About this book', file_name='about.xhtml') c2.content='

    About this book

    Helou, this is my book! There are many books, but this one is mine.

    Cover Image

    ' # add chapters to the book book.add_item(c1) book.add_item(c2) # create table of contents # - add manual link # - add section # - add auto created links to chapters book.toc = (epub.Link('intro.xhtml', 'Introduction', 'intro'), (epub.Section('Languages'), (c1, c2)) ) # add navigation files book.add_item(epub.EpubNcx()) book.add_item(epub.EpubNav()) # define css style style = ''' @namespace epub "http://www.idpf.org/2007/ops"; body { font-family: Cambria, Liberation Serif, Bitstream Vera Serif, Georgia, Times, Times New Roman, serif; } h2 { text-align: left; text-transform: uppercase; font-weight: 200; } ol { list-style-type: none; } ol > li:first-child { margin-top: 0.3em; } nav[epub|type~='toc'] > ol > li > ol { list-style-type:square; } nav[epub|type~='toc'] > ol > li > ol > li { margin-top: 0.3em; } ''' # add css file nav_css = epub.EpubItem(uid="style_nav", file_name="style/nav.css", media_type="text/css", content=style) book.add_item(nav_css) # create spin, add cover page as first page book.spine = ['cover', 'nav', c1, c2] # create epub file epub.write_epub('test.epub', book, {}) ebooklib-0.17.1/samples/03_advanced_create/000077500000000000000000000000001341350332300204215ustar00rootroot00000000000000ebooklib-0.17.1/samples/03_advanced_create/README.md000066400000000000000000000002011341350332300216710ustar00rootroot00000000000000Advanced create =============== Create simple EPUB3 using some of advanced features of EbookLib. ## Start python create.pyebooklib-0.17.1/samples/03_advanced_create/create.py000066400000000000000000000045141341350332300222420ustar00rootroot00000000000000# coding=utf-8 from ebooklib import epub if __name__ == '__main__': book = epub.EpubBook() # add metadata book.set_identifier('sample123456') book.set_title('Sample book') book.set_language('en') book.add_author('Aleksandar Erkalovic') # intro chapter c1 = epub.EpubHtml(title='Introduction', file_name='intro.xhtml', lang='hr') c1.content=u'

    Introduction

    Introduction paragraph where i explain what is happening.

    ' # defube style style = '''BODY { text-align: justify;}''' default_css = epub.EpubItem(uid="style_default", file_name="style/default.css", media_type="text/css", content=style) book.add_item(default_css) # about chapter c2 = epub.EpubHtml(title='About this book', file_name='about.xhtml') c2.content='

    About this book

    Helou, this is my book! There are many books, but this one is mine.

    ' c2.set_language('hr') c2.properties.append('rendition:layout-pre-paginated rendition:orientation-landscape rendition:spread-none') c2.add_item(default_css) # add chapters to the book book.add_item(c1) book.add_item(c2) # create table of contents # - add manual link # - add section # - add auto created links to chapters book.toc = (epub.Link('intro.xhtml', 'Introduction', 'intro'), (epub.Section('Languages'), (c1, c2)) ) # add navigation files book.add_item(epub.EpubNcx()) book.add_item(epub.EpubNav()) # define css style style = ''' @namespace epub "http://www.idpf.org/2007/ops"; body { font-family: Cambria, Liberation Serif, Bitstream Vera Serif, Georgia, Times, Times New Roman, serif; } h2 { text-align: left; text-transform: uppercase; font-weight: 200; } ol { list-style-type: none; } ol > li:first-child { margin-top: 0.3em; } nav[epub|type~='toc'] > ol > li > ol { list-style-type:square; } nav[epub|type~='toc'] > ol > li > ol > li { margin-top: 0.3em; } ''' # add css file nav_css = epub.EpubItem(uid="style_nav", file_name="style/nav.css", media_type="text/css", content=style) book.add_item(nav_css) # create spine book.spine = ['nav', c1, c2] # create epub file epub.write_epub('test.epub', book, {}) ebooklib-0.17.1/samples/04_markdown_parse/000077500000000000000000000000001341350332300203465ustar00rootroot00000000000000ebooklib-0.17.1/samples/04_markdown_parse/README.md000066400000000000000000000004101341350332300216200ustar00rootroot00000000000000# epub2markdown This is just a simple example and not utility script you should use for converting your ebooks. ## Usage epub2markdown my_ebook.epub ## Dependencies You need to install [Pandoc](http://johnmacfarlane.net/pandoc/) for this script to work. ebooklib-0.17.1/samples/04_markdown_parse/epub2markdown.py000077500000000000000000000023471341350332300235110ustar00rootroot00000000000000#!/usr/bin/env python import os.path import subprocess import sys from ebooklib import epub # This is just a basic example which can easily break in real world. if __name__ == '__main__': # read epub book = epub.read_epub(sys.argv[1]) # get base filename from the epub base_name = os.path.basename(os.path.splitext(sys.argv[1])[0]) for item in book.items: # convert into markdown if this is html if isinstance(item, epub.EpubHtml): proc = subprocess.Popen(['pandoc', '-f', 'html', '-t', 'markdown', '-'], stdin=subprocess.PIPE, stdout=subprocess.PIPE) content, error = proc.communicate(item.content) file_name = os.path.splitext(item.file_name)[0] + '.md' else: file_name = item.file_name content = item.content # create needed directories dir_name = '{0}/{1}'.format(base_name, os.path.dirname(file_name)) if not os.path.exists(dir_name): os.makedirs(dir_name) print('>> {0}'.format(file_name)) # write content to file with open('{0}/{1}'.format(base_name, file_name), 'w') as f: f.write(content) ebooklib-0.17.1/samples/05_plugins_create/000077500000000000000000000000001341350332300203375ustar00rootroot00000000000000ebooklib-0.17.1/samples/05_plugins_create/README.md000066400000000000000000000001211341350332300216100ustar00rootroot00000000000000Plugins ======= How to make your useless plugin. ## Start python create.pyebooklib-0.17.1/samples/05_plugins_create/create.py000066400000000000000000000056311341350332300221610ustar00rootroot00000000000000# coding=utf-8 from ebooklib import epub from ebooklib.plugins.base import BasePlugin class SamplePlugin(BasePlugin): NAME = 'Sample Plugin' # Very useless but example of what can be done def html_before_write(self, book, chapter): if chapter.content is None: return try: from urlparse import urlparse, urljoin except ImportError: from urllib.parse import urlparse, urljoin from lxml import html, etree utf8_parser = html.HTMLParser(encoding='utf-8') tree = html.document_fromstring(chapter.content, parser=utf8_parser) root = tree.getroottree() if len(root.find('body')) != 0: body = tree.find('body') for _link in body.xpath("//a[@class='test']"): _link.set('href', 'http://www.binarni.net/') chapter.content = etree.tostring(tree, pretty_print=True, encoding='utf-8') if __name__ == '__main__': book = epub.EpubBook() # add metadata book.set_identifier('sample123456') book.set_title('Sample book') book.set_language('en') book.add_author('Aleksandar Erkalovic') # intro chapter c1 = epub.EpubHtml(title='Introduction', file_name='intro.xhtml', lang='en') c1.content=u'

    Introduction

    Introduction paragraph with a link where i explain what is happening.

    ' # about chapter c2 = epub.EpubHtml(title='About this book', file_name='about.xhtml') c2.content='

    About this book

    Helou, this is my book! There are many books, but this one is mine.

    ' # add chapters to the book book.add_item(c1) book.add_item(c2) # create table of contents # - add section # - add auto created links to chapters book.toc = (epub.Link('intro.xhtml', 'Introduction', 'intro'), (epub.Section('Languages'), (c1, c2)) ) # add navigation files book.add_item(epub.EpubNcx()) book.add_item(epub.EpubNav()) # define css style style = ''' @namespace epub "http://www.idpf.org/2007/ops"; body { font-family: Cambria, Liberation Serif, Bitstream Vera Serif, Georgia, Times, Times New Roman, serif; } h2 { text-align: left; text-transform: uppercase; font-weight: 200; } ol { list-style-type: none; } ol > li:first-child { margin-top: 0.3em; } nav[epub|type~='toc'] > ol > li > ol { list-style-type:square; } nav[epub|type~='toc'] > ol > li > ol > li { margin-top: 0.3em; } ''' # add css file nav_css = epub.EpubItem(uid="style_nav", file_name="style/nav.css", media_type="text/css", content=style) book.add_item(nav_css) # create spine book.spine = ['nav', c1, c2] opts = {'plugins': [SamplePlugin()]} # create epub file epub.write_epub('test.epub', book, opts) ebooklib-0.17.1/samples/06_parse/000077500000000000000000000000001341350332300164465ustar00rootroot00000000000000ebooklib-0.17.1/samples/06_parse/README.md000066400000000000000000000001251341350332300177230ustar00rootroot00000000000000Plugins ======= How to parse EPUB file. ## Start python parse.py my-book.epub ebooklib-0.17.1/samples/06_parse/parse.py000066400000000000000000000005001341350332300201250ustar00rootroot00000000000000import sys import ebooklib from ebooklib import epub from ebooklib.utils import debug book = epub.read_epub(sys.argv[1]) debug(book.metadata) debug(book.spine) debug(book.toc) for x in book.get_items_of_type(ebooklib.ITEM_IMAGE): debug(x) for x in book.get_items_of_type(ebooklib.ITEM_DOCUMENT): debug(x) ebooklib-0.17.1/samples/07_pagebreaks/000077500000000000000000000000001341350332300174415ustar00rootroot00000000000000ebooklib-0.17.1/samples/07_pagebreaks/README.md000066400000000000000000000002001341350332300207100ustar00rootroot00000000000000Advanced create =============== Create simple EPUB3 with both visible and invisible pagebreaks ## Start python create.py ebooklib-0.17.1/samples/07_pagebreaks/create.py000066400000000000000000000035601341350332300212620ustar00rootroot00000000000000# coding=utf-8 from ebooklib import epub from ebooklib.plugins import standard from ebooklib.utils import create_pagebreak if __name__ == '__main__': book = epub.EpubBook() # add metadata book.set_identifier('sample123456') book.set_title('Sample book') book.set_language('en') book.add_author('Aleksandar Erkalovic') # build the chapter HTML and add the page break c1 = epub.EpubHtml(title='Introduction', file_name='intro.xhtml', lang='en') c1.content = u'

    Introduction

    1This chapter has a visible page number.

    2Something else now.

    ' c2 = epub.EpubHtml(title='Chapter the Second', file_name='chap02.xhtml', lang='en') c2.content = u'

    Chapter the Second

    This chapter has two page breaks, both with invisible page numbers.

    ' # Add invisible page numbers that match the printed text, for accessibility c2.content += create_pagebreak("2") # You can add more content after the page break c2.content += u'

    This is the second page in the second chapter, after the invisible page break.

    ' # Add invisible page numbers that match the printed text, for accessibility c2.content += create_pagebreak("3", label="Page 3") # close the chapter c2.content += u'' # add chapters to the book book.add_item(c1) book.add_item(c2) # create table of contents # - add manual link # - add section # - add auto created links to chapters book.toc = ((c1, c2, )) # add navigation files book.add_item(epub.EpubNcx()) book.add_item(epub.EpubNav()) # create spine book.spine = ['nav', c1, c2, ] # create epub file opts = {'plugins': [standard.SyntaxPlugin()]} epub.write_epub('test.epub', book, opts) ebooklib-0.17.1/samples/08_SMIL/000077500000000000000000000000001341350332300161025ustar00rootroot00000000000000ebooklib-0.17.1/samples/08_SMIL/chapter1_audio.mp3000066400000000000000000002737661341350332300214400ustar00rootroot00000000000000ID3TIT21 Minute of SilenceTPE1Anar Software LLCTALB Blank AudioAPICimage/jpegPNG  IHDR88lbKGD pHYs==UtIME 1ov IDATx{Ue0 7/(ꀉW,S42oV*5MQ3iy-54 CYy)dra[ sΞ9g<3Zzkg?{߳pηg]NJN$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$O$OAlbĉ1tPh*"^h {g|ѿ?`47hA TVVO~=ztA:ꨘ1c,SNq 7ĨQ f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b? "`GgDK?!I\_lj$hJ8)f .4D*7=O6F$zb$SI$cFs$ݓbǭ=J.aQ@8BN`j*¿OÚ'b-/Tr7:hJ&v$j'$EbIULAMEUB D)Cf SHeJ$i?=]DL10Ĕ% tz4X ZLAME3.98fSH.2LAME3.98.2;bQ fMHkmXQHTAG1 Minute of SilenceAnar Software LLCBlank Audioebooklib-0.17.1/samples/08_SMIL/create.py000066400000000000000000000031611341350332300177200ustar00rootroot00000000000000# coding=utf-8 from ebooklib import epub if __name__ == '__main__': book = epub.EpubBook() # add metadata book.set_identifier('sample123456') book.set_title('Sample book') book.set_language('en') book.add_metadata(None, 'meta', 'Naro Narrator', {'property': 'media:narrator'}) book.add_metadata(None, 'meta', '0:10:10.500', {'property': 'media:duration'}) book.add_metadata(None, 'meta', '0:05:00.500', {'property': 'media:duration', 'refines': '#intro_overlay'}) book.add_metadata(None, 'meta', '-epub-media-overlay-active', {'property': 'media:active-class'}) book.add_author('Aleksandar Erkalovic') # intro chapter c1 = epub.EpubHtml(title='Introduction', file_name='intro.xhtml', lang='en', media_overlay='intro_overlay') c1.content=u'

    Introduction

    Introduction paragraph where i explain what is happening.

    ' s1 = epub.EpubSMIL(uid='intro_overlay', file_name='test.smil', content=open('test.smil', 'rt').read()) a1 = epub.EpubItem(file_name='chapter1_audio.mp3', content=open('chapter1_audio.mp3', 'rb').read(), media_type='audio/mpeg') # add chapters to the book book.add_item(c1) book.add_item(s1) book.add_item(a1) book.toc = [epub.Link('intro.xhtml', 'Introduction', 'intro')] # add navigation files book.add_item(epub.EpubNcx()) book.add_item(epub.EpubNav()) # create spine book.spine = ['nav', c1] # create epub file epub.write_epub('test.epub', book, {}) ebooklib-0.17.1/samples/08_SMIL/parse.py000066400000000000000000000010541341350332300175660ustar00rootroot00000000000000import sys import ebooklib from ebooklib import epub from ebooklib.utils import debug book = epub.read_epub(sys.argv[1]) debug(book.metadata) debug(book.spine) debug(book.toc) debug('================================') debug('SMIL') for x in book.get_items_of_type(ebooklib.ITEM_SMIL): debug(x) debug('================================') debug('DOCUMENTS') for x in book.get_items_of_type(ebooklib.ITEM_DOCUMENT): if x.is_chapter(): debug('[{}] media_overlay={}'.format(x, x.media_overlay)) debug('================================') ebooklib-0.17.1/samples/08_SMIL/test.smil000066400000000000000000000007561341350332300177570ustar00rootroot00000000000000 ebooklib-0.17.1/samples/README.md000066400000000000000000000006241341350332300163100ustar00rootroot00000000000000EbookLib Samples ================ * 01_sample_create Create simple EPUB with two chapters and custom CSS for the navigation. * 02_cover_create Same as 01_sample_create but with cover page. * 03_advanced_create Creates EPUB but uses some advanced options from the library. * 04_markdown_parse Simple script which creates static markdown files + images from your EPUB. * 05_plugins_createebooklib-0.17.1/setup.py000066400000000000000000000023531341350332300151000ustar00rootroot00000000000000import io import re from setuptools import setup def read(path): with io.open(path, mode="r", encoding="utf-8") as fd: content = fd.read() # Convert Markdown links to reStructuredText links return re.sub(r"\[([^]]+)\]\(([^)]+)\)", r"`\1 <\2>`_", content) setup( name = 'EbookLib', version = '0.17.1', author = 'Aleksandar Erkalovic', author_email = 'aerkalov@gmail.com', packages = ['ebooklib', 'ebooklib.plugins'], url = 'https://github.com/aerkalov/ebooklib', license = 'GNU Affero General Public License', description = 'Ebook library which can handle EPUB2/EPUB3 and Kindle format', long_description = read('README.md'), keywords = ['ebook', 'epub', 'kindle'], classifiers = [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "Operating System :: OS Independent", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Topic :: Software Development :: Libraries :: Python Modules" ], install_requires = [ "lxml", "six" ] )