View Single Post
Old 10-04-2019, 06:18 AM   #10
davidfor
Grand Sorcerer
davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.
 
Posts: 24,905
Karma: 47303824
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
Quote:
Originally Posted by Mick2nd View Post
  • epub toc at different location than expected
Looking at the code, you are assuming the NCX file is called "toc.ncx" and will either be in the OEPBS or root directory of the book. I have plenty of books where this would fail. You should be finding the file using the OPF.

Alternatively, calibre has methods to do this. Look at:

Code:
from calibre.ebooks.oeb.polish.container import EpubContainer
from calibre.ebooks.oeb.polish.toc import get_toc
Open the book using the first, and get the ToC using the latter. Or look at them to see how to find the appropriate file.
davidfor is offline   Reply With Quote