From 9c38a1b5b84afce49c1950cf366e5398530f30de Mon Sep 17 00:00:00 2001 From: GRiker Date: Fri, 26 Mar 2010 13:07:09 -0700 Subject: [PATCH] GwR fixes for tickets 2279, 4652, 5162 --- src/calibre/ebooks/metadata/mobi.py | 13 ++++++++++++- src/calibre/ebooks/oeb/reader.py | 2 +- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/calibre/ebooks/metadata/mobi.py b/src/calibre/ebooks/metadata/mobi.py index fd1a1c3947..7581b560cd 100644 --- a/src/calibre/ebooks/metadata/mobi.py +++ b/src/calibre/ebooks/metadata/mobi.py @@ -331,7 +331,7 @@ class MetadataUpdater(object): authors = mi.author_sort update_exth_record((100, authors.encode(self.codec, 'replace'))) elif mi.authors: - authors = '; '.join(mi.authors) + authors = ';'.join(mi.authors) update_exth_record((100, authors.encode(self.codec, 'replace'))) if mi.publisher: update_exth_record((101, mi.publisher.encode(self.codec, 'replace'))) @@ -349,6 +349,17 @@ class MetadataUpdater(object): if mi.tags: subjects = '; '.join(mi.tags) 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: update_exth_record((106, str(mi.pubdate).encode(self.codec, 'replace'))) elif mi.timestamp: diff --git a/src/calibre/ebooks/oeb/reader.py b/src/calibre/ebooks/oeb/reader.py index 9043db97f1..e829891a45 100644 --- a/src/calibre/ebooks/oeb/reader.py +++ b/src/calibre/ebooks/oeb/reader.py @@ -359,7 +359,7 @@ class OEBReader(object): self._toc_from_navpoint(item, node, child) def _toc_from_ncx(self, item): - if item is None: + if (item is None) or (item.data is None): return False self.log.debug('Reading TOC from NCX...') ncx = item.data