GwR fixes for tickets 2279, 4652, 5162

This commit is contained in:
GRiker 2010-03-26 13:07:09 -07:00
parent 5091859c49
commit 9c38a1b5b8
2 changed files with 13 additions and 2 deletions

View File

@ -349,6 +349,17 @@ class MetadataUpdater(object):
if mi.tags: if mi.tags:
subjects = '; '.join(mi.tags) subjects = '; '.join(mi.tags)
update_exth_record((105, subjects.encode(self.codec, 'replace'))) update_exth_record((105, subjects.encode(self.codec, 'replace')))
# >>> Begin patch for ticket #4652 <<<
kindle_doc_types = set([u'[kindle_ebok]',u'[kindle_pdoc]'])
doc_type = list(kindle_doc_types.intersection(set(mi.tags)))[0]
if doc_type:
if doc_type == '[kindle_ebok]':
update_exth_record((501,str('EBOK')))
elif doc_type == '[kindle_pdoc]':
update_exth_record((501, str('PDOC')))
# >>> End patch
if mi.pubdate: if mi.pubdate:
update_exth_record((106, str(mi.pubdate).encode(self.codec, 'replace'))) update_exth_record((106, str(mi.pubdate).encode(self.codec, 'replace')))
elif mi.timestamp: elif mi.timestamp:

View File

@ -359,7 +359,7 @@ class OEBReader(object):
self._toc_from_navpoint(item, node, child) self._toc_from_navpoint(item, node, child)
def _toc_from_ncx(self, item): def _toc_from_ncx(self, item):
if item is None: if (item is None) or (item.data is None):
return False return False
self.log.debug('Reading TOC from NCX...') self.log.debug('Reading TOC from NCX...')
ncx = item.data ncx = item.data