{ "info": { "author": "David Buxton", "author_email": "david@gasmark6.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3.2", "Topic :: Software Development :: Libraries" ], "description": "UCFlib\n=======\n\n\nUCFlib is a Python module for reading and writing UCF format files.\n\nUCF format is used by Adobe for some of its products, including InDesign IDML. UCFlib can also be used to read OCF/EPUB e-books and LibreOffice ODT files since they use the same structure (a zipped directory).\n\nFor more information see `the UCF documentation`_ on the Adobe website and the `EPUB Open Container Format (OCF) 3.0 specification`_.\n\n.. _the UCF documentation: http://learn.adobe.com/wiki/display/PDFNAV/Universal+Container+Format\n.. _EPUB Open Container Format (OCF) 3.0 specification: http://idpf.org/epub/30/spec/epub30-ocf.html\n\n\nUCFlib is provided under the MIT license.\n\nInstallation\n------------\n\nUCFlib requires Python 2.7 or Python 3.2 or later. You can install it from PyPI with pip::\n\n pip install ucflib\n\nAlternatively you can download and unpack the source. Then ``cd`` into the source directory and install it with::\n\n python setup.py install\n\n\n\nCreating a new file\n-------------------\n\n::\n\n import ucf\n \n my_doc = ucf.UCF(mimetype='application/epub+zip')\n \n my_doc['OPS/chapter-1.xhtml'] = b''\n my_doc['OPS/epb.opf'] = b''\n my_doc.rootfiles.append(('OPS/epb.opf', 'application/oebps-package-xml'))\n \n my_doc.save(filename='my_doc.epub')\n\nThe ``filename`` argument can be a string or any file-like object open for writing. Alternatively ``filename`` can be omitted when saving if it was included when the instance was created::\n\n my_doc = ufc.UCF(filename='my_doc.epub')\n my_doc['OPS/epb.opf'] = b''\n my_doc.save()\n \n\nReading an existing file\n------------------------\n\nUse the ``filename`` argument when creating a new instance. ``filename`` can be a string or any file-like object open for reading::\n\n import ucf\n \n my_doc = ucf.UCF(filename='my_doc.epub')\n\nAn instance of UCF is an ordered dictionary. Keys are the names of files in the archive and are always unicode strings. The values are the contents of the files and are always byte strings.\n\n::\n\n list(my_doc.keys())\n\nThe mimetype property is a convenience for accessing the 'mimetype' file in the package. The UCF specification states that the value must an ASCII string, so if you assign a unicode string UFClib will encode it for you::\n\n my_doc.mimetype = unicode('application/oebps-package-xml')\n assert isinstance(my_doc.mimetype, bytes) # True\n \nThe EPUB specification requires a 'META-INF/container.xml' file in the archive. You can use a shortcut to refer to any file in the 'META-INF' directory in the archive::\n\n my_doc.meta[u'container.xml']\n # Equivalent to\n my_doc['META-INF/container.xml']\n\nThe special 'META-INF/container.xml' file is used to find the main document in the archive. You can access the paths and mime-types using the 'rootfiles' property, a list of tuples. Each tuple is in fact a named tuple::\n\n for my_tuple in my_doc.rootfiles:\n my_tuple.path, my_tuple.mimetype\n\nTo create a new entry in the list of root files, just add a tuple (or named tuple)::\n\n my_tuple = ucf.Rootfile(path='OPS/epb.opf', mimetype='application/oebps-package-xml')\n my_doc.rootfiles.append(my_tuple)", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://github.com/davidwtbuxton/ucflib", "keywords": null, "license": "MIT", "maintainer": null, "maintainer_email": null, "name": "UCFlib", "package_url": "https://pypi.org/project/UCFlib/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/UCFlib/", "project_urls": { "Download": "UNKNOWN", "Homepage": "http://github.com/davidwtbuxton/ucflib" }, "release_url": "https://pypi.org/project/UCFlib/0.2.1/", "requires_dist": null, "requires_python": null, "summary": "a library for reading and writing UCF and EPUB formats", "version": "0.2.1" }, "last_serial": 785926, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "a640f70ab31c10dc927f181a74fd636a", "sha256": "1786010f6ca3d3d268f61aac064d64652f4c5f4fd7e0416822490a963291f9d3" }, "downloads": -1, "filename": "UCFlib-0.1.tar.gz", "has_sig": false, "md5_digest": "a640f70ab31c10dc927f181a74fd636a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5456, "upload_time": "2012-08-25T22:02:01", "url": "https://files.pythonhosted.org/packages/0e/de/f068bff3c5d4e9b19168113103a15951a7ebe99042e979a1066cfb9996ac/UCFlib-0.1.tar.gz" } ], "0.2": [ { "comment_text": "", "digests": { "md5": "ea703813b4a98a8e537be9ab34fb4e57", "sha256": "dfb00a3312104ab78ffc7fbddd9b52f180c36ba62ab7fb02a26dfd5669f89911" }, "downloads": -1, "filename": "UCFlib-0.2.tar.gz", "has_sig": false, "md5_digest": "ea703813b4a98a8e537be9ab34fb4e57", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5778, "upload_time": "2012-08-26T14:39:42", "url": "https://files.pythonhosted.org/packages/40/02/9941bb613bc5d725e5a63c546cd697aa7601a1b0c82d4afee2f1060878c7/UCFlib-0.2.tar.gz" } ], "0.2.1": [ { "comment_text": "", "digests": { "md5": "211ff057d86537af5b4d93235bdb2ec4", "sha256": "c0f6ca5cd471260cf82d9611121e624b4a83c3c7628ca962fdee849fe19e26be" }, "downloads": -1, "filename": "UCFlib-0.2.1.tar.gz", "has_sig": false, "md5_digest": "211ff057d86537af5b4d93235bdb2ec4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7768, "upload_time": "2012-08-31T16:36:17", "url": "https://files.pythonhosted.org/packages/4e/a8/efcc1953c3069ac25625e973e2fbbff77f5b12e650e143755c53771c7579/UCFlib-0.2.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "211ff057d86537af5b4d93235bdb2ec4", "sha256": "c0f6ca5cd471260cf82d9611121e624b4a83c3c7628ca962fdee849fe19e26be" }, "downloads": -1, "filename": "UCFlib-0.2.1.tar.gz", "has_sig": false, "md5_digest": "211ff057d86537af5b4d93235bdb2ec4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7768, "upload_time": "2012-08-31T16:36:17", "url": "https://files.pythonhosted.org/packages/4e/a8/efcc1953c3069ac25625e973e2fbbff77f5b12e650e143755c53771c7579/UCFlib-0.2.1.tar.gz" } ] }