-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathREADME.txt
138 lines (103 loc) · 3.96 KB
/
README.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
yael
====
**yael** (Yet Another EPUB Library) is a Python library for reading,
manipulating, and writing EPUB 2/3 files.
- Version: 0.0.9
- Date: 2015-03-04
- Developer: `Alberto Pettarin <http://www.albertopettarin.it/>`__
(`contact <http://www.albertopettarin.it/contact.html>`__)
- License: the MIT License (MIT)
This library is currently in **development**. The reading part is
essentially complete, while the editing/writing is missing. Please do
**NOT** use this code in production until it reaches v1.0.0.
Feedback (especially on the lib interface) is welcome at any version
number! (Please use the `GitHub issue
tracker <https://github.com/pettarin/yael/issues>`__.)
Usage
-----
.. code:: python
from yael import SimpleEPUB
ebook = SimpleEPUB(path="/tmp/bierce01.epub")
ebook.manifestation # 'compressed'
ebook.size # 7281362
ebook.version # '3.0'
ebook.unique_identifier # 'urn:uuid:2722b0eb-a4f9-4b05-97f9-9123381e58b3'
ebook.release_identifier # 'urn:uuid:2722b0eb-a4f9-4b05-97f9-9123381e58b3@2014-06-06T00:00:01Z'
ebook.title # 'A Horseman In The Sky'
ebook.language # 'en'
ebook.author # 'Ambrose Bierce'
ebook.date # '2014-06-06'
ebook.description # 'This Audio-eBook was crafted by ReadBeyond ...'
ebook.publisher # 'ReadBeyond'
ebook.internal_path_cover_image # 'OEBPS/Images/cover.png'
# print a JSON string representation
print(ebook)
# print the TOC with resolved paths
print(ebook.resolved_toc)
# print the spine
print("Spine")
for i_p_spine_item in ebook.resolved_spine:
print(i_p_spine_item)
print("")
# extract cover image to /tmp/extracted_cover.jpg
cover_image = ebook.cover_image
if cover_image != None:
output_file = open("/tmp/extracted_cover.jpg", "wb")
output_file.write(cover_image)
output_file.close()
print("Cover image extracted to '/tmp/extracted_cover.jpg' ...")
See
```yael/examples/publication_examples.py`` <yael/examples/publication_example.py>`__,
```yael/examples/simpleepub_examples.py`` <yael/examples/simpleepub_example.py>`__,
and ```yael/examples/epub_to_gv.py`` <yael/examples/epub_to_gv.py>`__
for more complex, commented examples.
Documentation
-------------
Online: http://www.albertopettarin.it/yael/
Generated from the source (requires sphinx):
.. code:: bash
$ git clone https://github.com/pettarin/yael.git
$ cd yael/docs
$ make html
License
-------
**yael** is released under the terms of the MIT License. See the LICENSE
file.
Supported Features
------------------
Parsing nearly all of EPUB 2 and 3 OCF/OPF specifications, including:
- EPUB 2 ``<meta>`` and ``<guide>`` OPF elements
- EPUB 3 ``<meta>`` (including ``refines``)
- EPUB 3 Media Overlays (SMIL files)
- EPUB 3 Navigation Document (including ``<nav>`` elements other than
``toc`` and ``landmarks``)
- EPUB 3 Multiple Renditions
- Asset obfuscation with either Adobe or IDPF algorithms
Other useful stuff:
- Loadind/saving publications in compressed, uncompressed, or in-memory
form
- Retrieving ``viewport`` information from Content Documents in FXL
EPUB files
- Building sub-objects from strings
- Outputting a JSON representation of any object
- Resolution of MARC Relator values
- Conversion of SMIL clip times from string to seconds
Limitations and Missing Features
--------------------------------
- EPUB OCF elements not parsed: ``manifest.xml``, ``rights.xml``,
``signatures.xml``
- EPUB 3 OPF elements not parsed: ``<bindings>``, ``<collection>``
- No EPUB CFI support
- No editing of SVG Content Documents
Similar Libraries
-----------------
- `epub <https://pypi.python.org/pypi/epub>`__
- `epubzilla <https://pypi.python.org/pypi/Epubzilla>`__
- `py-clave <https://github.com/gabalese/py-clave>`__
Acknowledgments
---------------
Many thanks to:
- *Yael*, of course.
|Analytics|
.. |Analytics| image:: https://ga-beacon.appspot.com/UA-52776738-1/yael
:target: http://www.albertopettarin.it