diff --git a/src/calibre/ebooks/__init__.py b/src/calibre/ebooks/__init__.py index d2d6fc94e1..a084cdd0f8 100644 --- a/src/calibre/ebooks/__init__.py +++ b/src/calibre/ebooks/__init__.py @@ -25,7 +25,7 @@ class DRMError(ValueError): BOOK_EXTENSIONS = ['lrf', 'rar', 'zip', 'rtf', 'lit', 'txt', 'htm', 'xhtm', 'html', 'xhtml', 'pdf', 'pdb', 'prc', 'mobi', 'azw', 'doc', 'epub', 'fb2', 'djvu', 'lrx', 'cbr', 'cbz', 'oebzip', - 'rb', 'imp', 'odt'] + 'rb', 'imp', 'odt', 'chm'] class HTMLRenderer(object): diff --git a/src/calibre/ebooks/oeb/base.py b/src/calibre/ebooks/oeb/base.py index e2a4875399..244acf7627 100644 --- a/src/calibre/ebooks/oeb/base.py +++ b/src/calibre/ebooks/oeb/base.py @@ -1327,7 +1327,9 @@ class TOC(object): return len(list(self.iter())) - 1 def next_play_order(self): - return max([x.play_order for x in self.iter()])+1 + entries = [x.play_order for x in self.iter()] + base = max(entries) if entries else 0 + return base+1 def has_href(self, href): for x in self.iter():