{ "info": { "author": "voussoir", "author_email": "ethan@voussoir.net", "bugtrack_url": null, "classifiers": [], "description": "epubfile\n========\n\n```Python\nimport epubfile\nbook = epubfile.Epub.open('mybook.epub')\n\nfor text_id in book.get_texts():\n soup = book.read_file(text_id, soup=True)\n ...\n book.write_file(text_id, soup)\n\nfor image_id in book.get_images():\n data = book.read_file(image_id)\n ...\n book.write_file(image_id, data)\n\n# Note that this does not reverse the table of contents.\nbook.set_spine_order(reversed(book.get_spine_order()))\n\ncover_id = book.get_cover_image()\nif cover_id:\n book.rename_file(cover_id, 'myfavoritecoverimage')\n\nbook.save('modifiedbook.epub')\n```\n\nepubfile provides simple editing of epub books. epubfile attempts to keep file modifications to a minimum. It does not add, remove, or rearrange files unless you ask it to, and does not inject additional metadata. As such, it works for both epub2 and epub3 assuming you stick to supported operations for your book version.\n\n# Install\n\n`pip install epubfile`\n\n# Command line utilities\n\nThis library was born out of my own needs. So there are a couple of builtin utilities.\n\n```\naddfile:\n Add files into the book.\n\ncovercomesfirst:\n Rename the cover image file so that it is the alphabetically-first image.\n\nmerge:\n Merge multiple books into one.\n\nnormalize:\n Rename files and directories in the book to match a common structure.\n```\n\n# Spec compliance\n\nepubfile does not rigorously enforce the epub spec and you can create noncompliant books with it. Basic errors are checked, and I am open to issues and comments regarding ways to improve spec-compliance without adding significant size or complexity to the library. I am prioritizing simplicity and ease of use over perfection.\n\n# Pairs well with...\n\nFor advanced inter-file operations and better validation, I suggest using this library in conjunction with a good editor like [Sigil](https://github.com/Sigil-Ebook/Sigil). I wrote this library because although Sigil plugins are great for processing a single book, it is difficult to use Sigil to process multiple books, read book data for use in other programs, or do other inter-book operations.\n\n# What not to expect\n\nI do not intend to implement an object model for book metadata, beyond perhaps some basic getters and setters. You have full control over the `Epub.opf` BeautifulSoup object so you can edit the metadata however you want.\n\n---\n\n```\nBSD 3-Clause License\n\nCopyright (c) 2019, Ethan Dalool\nhttps://github.com/voussoir/epubfile\nAll rights reserved.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n\n1. Redistributions of source code must retain the above copyright notice, this\n list of conditions and the following disclaimer.\n\n2. Redistributions in binary form must reproduce the above copyright notice,\n this list of conditions and the following disclaimer in the documentation\n and/or other materials provided with the distribution.\n\n3. Neither the name of the copyright holder nor the names of its\n contributors may be used to endorse or promote products derived from\n this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\nAND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\nIMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE\nFOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\nDAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\nSERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\nCAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,\nOR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n```", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/voussoir/epubfile", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "epubfile", "package_url": "https://pypi.org/project/epubfile/", "platform": "", "project_url": "https://pypi.org/project/epubfile/", "project_urls": { "Homepage": "https://github.com/voussoir/epubfile" }, "release_url": "https://pypi.org/project/epubfile/0.0.3/", "requires_dist": null, "requires_python": "", "summary": "simple epub file reading and writing", "version": "0.0.3" }, "last_serial": 5811804, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "ecddb8d4de39391c6e5520ddf48210f8", "sha256": "e34143948921728e797f40f60f3e9cf8430ae860de964d67db73ec35fdb3637e" }, "downloads": -1, "filename": "epubfile-0.0.1.tar.gz", "has_sig": false, "md5_digest": "ecddb8d4de39391c6e5520ddf48210f8", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10096, "upload_time": "2019-08-04T07:13:00", "url": "https://files.pythonhosted.org/packages/34/fa/1dbefe27b5e295486d1d48d74a8e4bda1392682f386863db3f4453da95c0/epubfile-0.0.1.tar.gz" } ], "0.0.2": [ { "comment_text": "", "digests": { "md5": "96d063c993dca0cc039ede7c0bb160a0", "sha256": "c919c90b98950bb1ed8d8d0fc2e0061dee2fdb130f71620529de6d2fc35ec546" }, "downloads": -1, "filename": "epubfile-0.0.2.tar.gz", "has_sig": false, "md5_digest": "96d063c993dca0cc039ede7c0bb160a0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12696, "upload_time": "2019-08-07T06:50:13", "url": "https://files.pythonhosted.org/packages/c8/5c/a4eae561cefa4e45149379d66f690835596096ed1c2cc566ded177b2534b/epubfile-0.0.2.tar.gz" } ], "0.0.3": [ { "comment_text": "", "digests": { "md5": "846736b6955f8cc521454d3482cc525b", "sha256": "5fd9d8dbd0271ff58b4899a267f25c94d013001055b179200e6c34457b5bdd1e" }, "downloads": -1, "filename": "epubfile-0.0.3.tar.gz", "has_sig": false, "md5_digest": "846736b6955f8cc521454d3482cc525b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 15706, "upload_time": "2019-09-10T22:25:59", "url": "https://files.pythonhosted.org/packages/f7/57/4468966cea144dee28ac33086672f5cc432197e2be4b8d798347574ed158/epubfile-0.0.3.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "846736b6955f8cc521454d3482cc525b", "sha256": "5fd9d8dbd0271ff58b4899a267f25c94d013001055b179200e6c34457b5bdd1e" }, "downloads": -1, "filename": "epubfile-0.0.3.tar.gz", "has_sig": false, "md5_digest": "846736b6955f8cc521454d3482cc525b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 15706, "upload_time": "2019-09-10T22:25:59", "url": "https://files.pythonhosted.org/packages/f7/57/4468966cea144dee28ac33086672f5cc432197e2be4b8d798347574ed158/epubfile-0.0.3.tar.gz" } ] }