Fix catalog regression

This commit is contained in:
Kovid Goyal 2010-02-07 11:26:00 -07:00
parent 6248c2105f
commit 391a47369d
2 changed files with 16 additions and 5 deletions

View File

@ -610,12 +610,21 @@ class MobiWriter(object):
if (i>firstSequentialNode) and self._ctoc_map[i-1]['klass'] != 'section': if (i>firstSequentialNode) and self._ctoc_map[i-1]['klass'] != 'section':
if offset != previousOffset + previousLength : if offset != previousOffset + previousLength :
self._oeb.log.warning("*** TOC discontinuity: nodes are not sequential ***") self._oeb.log.warning("*** TOC discontinuity: nodes are not sequential ***")
self._oeb.log.warning(" node %03d: '%s' offset: 0x%X length: 0x%X" % \ self._oeb.log.info(" node %03d: '%s' offset: 0x%X length: 0x%X" % \
(i-1, entries[i-1].title, previousOffset, previousLength) ) (i-1, entries[i-1].title, previousOffset, previousLength) )
self._oeb.log.warning(" node %03d: '%s' offset: 0x%X != 0x%06X" % \ self._oeb.log.warning(" node %03d: '%s' offset: 0x%X != 0x%06X" % \
(i, child.title, offset, previousOffset + previousLength) ) (i, child.title, offset, previousOffset + previousLength) )
self._oeb.log.warning("\tnode data %03d: %s" % (i-1, self._ctoc_map[i-1]) ) # self._oeb.log.warning("\tnode data %03d: %s" % (i-1, self._ctoc_map[i-1]) )
self._oeb.log.warning("\tnode data %03d: %s" % (i, self._ctoc_map[i]) ) # self._oeb.log.warning("\tnode data %03d: %s" % (i, self._ctoc_map[i]) )
# Dump the offending entry
self._oeb.log.info("...")
for z in range(i-6 if i-6 > 0 else 0, i+6 if i+6 < len(entries) else len(entries)):
if z == i:
self._oeb.log.warning("child %03d: %s" % (z, entries[z]))
else:
self._oeb.log.info("child %03d: %s" % (z, entries[z]))
self._oeb.log.info("...")
self._oeb.log.warning('_generate_indexed_navpoints: Failed to generate index') self._oeb.log.warning('_generate_indexed_navpoints: Failed to generate index')
# Zero out self._HTMLRecords, return False # Zero out self._HTMLRecords, return False
self._HTMLRecords = [] self._HTMLRecords = []

View File

@ -941,7 +941,7 @@ class EPUB_MOBI(CatalogPlugin):
this_title['author'] = " &amp; ".join(record['authors']) this_title['author'] = " &amp; ".join(record['authors'])
else: else:
this_title['author'] = 'Unknown' this_title['author'] = 'Unknown'
this_title['author_sort'] = record['author_sort'] if len(record['author_sort']) \ this_title['author_sort'] = record['author_sort'].capitalize() if len(record['author_sort']) \
else self.author_to_author_sort(this_title['author']) else self.author_to_author_sort(this_title['author'])
this_title['id'] = record['id'] this_title['id'] = record['id']
if record['publisher']: if record['publisher']:
@ -1089,6 +1089,7 @@ class EPUB_MOBI(CatalogPlugin):
for author in unique_authors: for author in unique_authors:
self.opts.log.info((u" %-50s %-25s %2d" % (author[0][0:45], author[1][0:20], self.opts.log.info((u" %-50s %-25s %2d" % (author[0][0:45], author[1][0:20],
author[2])).encode('utf-8')) author[2])).encode('utf-8'))
self.authors = unique_authors self.authors = unique_authors
def generateHTMLDescriptions(self): def generateHTMLDescriptions(self):
@ -2490,7 +2491,7 @@ class EPUB_MOBI(CatalogPlugin):
tokens = tokens[-1:] + tokens[:-1] tokens = tokens[-1:] + tokens[:-1]
if len(tokens) > 1: if len(tokens) > 1:
tokens[0] += ',' tokens[0] += ','
return ' '.join(tokens) return ' '.join(tokens).capitalize()
def convertHTMLEntities(self, s): def convertHTMLEntities(self, s):
matches = re.findall("&#\d+;", s) matches = re.findall("&#\d+;", s)
@ -3100,6 +3101,7 @@ class EPUB_MOBI(CatalogPlugin):
op = self.opts.output_profile op = self.opts.output_profile
if op is None: if op is None:
op = 'default' op = 'default'
self.opts.output_profile = op
opts.descriptionClip = 380 if op.endswith('dx') or 'kindle' not in op else 90 opts.descriptionClip = 380 if op.endswith('dx') or 'kindle' not in op else 90
opts.basename = "Catalog" opts.basename = "Catalog"
opts.plugin_path = self.plugin_path opts.plugin_path = self.plugin_path