Download PDF format - calibre User Manual

Transcript
calibre User Manual, Release 2.46.0
manifest_has_name(name)
Return True if the manifest has an entry corresponding to name
manifest_id_map
Mapping of manifest id to canonical names
manifest_type_map
Mapping of manifest media-type to list of canonical names of that media-type
mi
The metadata of this book as a Metadata object. Note that this object is constructed on the fly every time
this property is requested, so use it sparingly.
name_to_abspath(name)
Convert a canonical name to an absolute OS dependant path
name_to_href(name, base=None)
Convert a name to a href relative to base, which must be a name or None in which case self.root is used as
the base
names_that_must_not_be_changed
Set of names that must never be renamed. Depends on the ebook file format.
names_that_must_not_be_removed
Set of names that must never be deleted from the container. Depends on the ebook file format.
names_that_need_not_be_manifested
Set of names that are allowed to be missing from the manifest. Depends on the ebook file format.
open(name, mode=u’rb’)
Open the file pointed to by name for direct read/write. Note that this will commit the file if it is dirtied
and remove it from the parse cache. You must finish with this file before accessing the parsed version of it
again, or bad things will happen.
opf
The parsed OPF file
opf_get_or_create(name)
Convenience method to either return the first XML element with the specified name or create it under the
opf:package element and then return it, if it does not already exist.
opf_version
The version set on the OPF’s <package> element
opf_xpath(expr)
Convenience method to evaluate an XPath expression on the OPF file, has the opf: and dc: namespace
prefixes pre-defined.
parsed(name)
Return a parsed representation of the file specified by name. For HTML and XML files an lxml tree is returned. For CSS files a cssutils stylesheet is returned. Note that parsed objects are cached for performance.
If you make any changes to the parsed object, you must call dirty() (page 288) so that the container
knows to update the cache. See also replace() (page 290).
raw_data(name, decode=True, normalize_to_nfc=True)
Return the raw data corresponding to the file specified by name
Parameters
• decode – If True and the file has a text based mimetype, decode it and return a unicode
object instead of raw bytes.
1.12. Setting up a calibre development environment
289