From 80a7d5ad5fd354ef7580214f788b857e5418f04a Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 11 Jun 2009 14:04:53 -0700 Subject: [PATCH 1/2] Fix #2566 (Support tpz and azw1 files?) --- src/calibre/ebooks/__init__.py | 2 +- src/calibre/gui2/main.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/calibre/ebooks/__init__.py b/src/calibre/ebooks/__init__.py index a084cdd0f8..dcd5604aa8 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', 'chm'] + 'rb', 'imp', 'odt', 'chm', 'tpz', 'azw1'] class HTMLRenderer(object): diff --git a/src/calibre/gui2/main.py b/src/calibre/gui2/main.py index b57387033d..37d40f25fb 100644 --- a/src/calibre/gui2/main.py +++ b/src/calibre/gui2/main.py @@ -385,7 +385,7 @@ class Main(MainWindow, Ui_MainWindow, DeviceGUI): self.action_view, self.action_save, None, None) QObject.connect(self.library_view, SIGNAL('files_dropped(PyQt_PyObject)'), - self.files_dropped) + self.files_dropped, Qt.QueuedConnection) for func, target in [ ('connect_to_search_box', self.search), ('connect_to_book_display', From af9e34b6d6aca0e7a2de0f3b508455e0e742953c Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 11 Jun 2009 14:13:43 -0700 Subject: [PATCH 2/2] Fix #2559 (Convert html to Mobil failed) --- src/calibre/ebooks/oeb/base.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/calibre/ebooks/oeb/base.py b/src/calibre/ebooks/oeb/base.py index 3e16e73ab9..711dce0b8d 100644 --- a/src/calibre/ebooks/oeb/base.py +++ b/src/calibre/ebooks/oeb/base.py @@ -765,7 +765,14 @@ class Manifest(object): data = etree.fromstring(data) except: data=data.replace(':=', '=').replace(':>', '>') - data = etree.fromstring(data) + try: + data = etree.fromstring(data) + except etree.XMLSyntaxError: + self.oeb.logger.warn('Stripping comments from %s'% + self.href) + data = re.compile(r'', re.DOTALL).sub('', + data) + data = etree.fromstring(data) elif namespace(data.tag) != XHTML_NS: # OEB_DOC_NS, but possibly others ns = namespace(data.tag)