mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-06-23 15:30:45 -04:00
Speed up parsing of OPF files
This commit is contained in:
parent
4a74faa6e5
commit
8dd35bc55c
@ -272,6 +272,10 @@ class Spine(ResourceCollection):
|
|||||||
self.id = idfunc(self.path)
|
self.id = idfunc(self.path)
|
||||||
self.idref = None
|
self.idref = None
|
||||||
|
|
||||||
|
def __repr__(self):
|
||||||
|
return 'Spine.Item(path=%r, id=%s, is_linear=%s)' % \
|
||||||
|
(self.path, self.id, self.is_linear)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def from_opf_spine_element(itemrefs, manifest):
|
def from_opf_spine_element(itemrefs, manifest):
|
||||||
s = Spine(manifest)
|
s = Spine(manifest)
|
||||||
@ -280,7 +284,7 @@ class Spine(ResourceCollection):
|
|||||||
if idref is not None:
|
if idref is not None:
|
||||||
path = s.manifest.path_for_id(idref)
|
path = s.manifest.path_for_id(idref)
|
||||||
if path:
|
if path:
|
||||||
r = Spine.Item(s.manifest.id_for_path, path, is_path=True)
|
r = Spine.Item(lambda x:idref, path, is_path=True)
|
||||||
r.is_linear = itemref.get('linear', 'yes') == 'yes'
|
r.is_linear = itemref.get('linear', 'yes') == 'yes'
|
||||||
r.idref = idref
|
r.idref = idref
|
||||||
s.append(r)
|
s.append(r)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user