View Single Post
Old 07-11-2019, 11:49 AM   #30
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 8,816
Karma: 6000000
Join Date: Nov 2009
Device: many
Okay checked the wrapper.py code and if no file in the manifest has the correct mimetype for the ncx ("application/x-dtbncx+xml"), it will return a python None, not a empty string. And this case of no ncx is already properly handled when rebuilding the spine attributes.

So to detect if an epub3 has an ncx or not, you can check the return value against None.

Code:
    def gettocid(self):
        for id in self.id_to_mime:
            mime = self.id_to_mime[id]
            if mime == "application/x-dtbncx+xml":
	        return id
        return None

Last edited by KevinH; 07-11-2019 at 11:52 AM.
KevinH is offline   Reply With Quote