From c317411f038c4d32e7c1e270d6c96626d64e29bd Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 11 Jun 2009 14:35:41 -0700 Subject: [PATCH 1/8] Fix #2565 (MOBI to Epub convertion creates a abreviated epub version) --- src/calibre/ebooks/mobi/reader.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/calibre/ebooks/mobi/reader.py b/src/calibre/ebooks/mobi/reader.py index 2088ca7537..c1ea4d8f2f 100644 --- a/src/calibre/ebooks/mobi/reader.py +++ b/src/calibre/ebooks/mobi/reader.py @@ -300,9 +300,9 @@ class MobiReader(object): root = html.fromstring(self.processed_html) if root.xpath('descendant::p/descendant::p'): from lxml.html import soupparser - self.log.warning('Markup contains unclosed

tags, parsing using', - 'BeatifulSoup') + self.log.warning('Malformed markup, parsing using BeatifulSoup') root = soupparser.fromstring(self.processed_html) + if root.tag != 'html': self.log.warn('File does not have opening tag') nroot = html.fromstring('') @@ -313,6 +313,7 @@ class MobiReader(object): root = nroot htmls = list(root.xpath('//html')) + if len(htmls) > 1: self.log.warn('Markup contains multiple tags') # Keep only the largest head and body @@ -428,6 +429,7 @@ class MobiReader(object): self.processed_html = '

' + self.processed_html.replace('\n\n', '

') + '' self.processed_html = self.processed_html.replace('\r\n', '\n') self.processed_html = self.processed_html.replace('> <', '>\n<') + self.processed_html = re.sub('\x14|\x15', '', self.processed_html) def upshift_markup(self, root): self.log.debug('Converting style information to CSS...') From a23bdcf53671f4768e1f56492170c5f4bab24865 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 11 Jun 2009 14:41:08 -0700 Subject: [PATCH 2/8] LRF Output: Fix --header option --- src/calibre/ebooks/lrf/output.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/calibre/ebooks/lrf/output.py b/src/calibre/ebooks/lrf/output.py index 52c2a22ccd..a9763adeca 100644 --- a/src/calibre/ebooks/lrf/output.py +++ b/src/calibre/ebooks/lrf/output.py @@ -54,6 +54,7 @@ class LRFOptions(object): self.minimize_memory_usage = False self.autorotation = opts.enable_autorotation self.header_separation = (self.profile.dpi/72.) * opts.header_separation + self.headerformat = opts.header_format for x in ('top', 'bottom', 'left', 'right'): From 233c3bcb1b5d227a4b34c2480521a27b236a6401 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 11 Jun 2009 15:27:16 -0700 Subject: [PATCH 3/8] Updated translatable strings --- src/calibre/gui2/convert/txt_output.ui | 2 +- src/calibre/gui2/viewer/bookmarkmanager.py | 44 +++++----- src/calibre/translations/calibre.pot | 99 +++++++++++----------- 3 files changed, 75 insertions(+), 70 deletions(-) diff --git a/src/calibre/gui2/convert/txt_output.ui b/src/calibre/gui2/convert/txt_output.ui index 368c8d7b8b..dfe6d40fc9 100644 --- a/src/calibre/gui2/convert/txt_output.ui +++ b/src/calibre/gui2/convert/txt_output.ui @@ -17,7 +17,7 @@ - Newline Type: + Line ending style: diff --git a/src/calibre/gui2/viewer/bookmarkmanager.py b/src/calibre/gui2/viewer/bookmarkmanager.py index 60709a2ac1..1c386a27e1 100644 --- a/src/calibre/gui2/viewer/bookmarkmanager.py +++ b/src/calibre/gui2/viewer/bookmarkmanager.py @@ -1,4 +1,4 @@ -from __future__ import with_statement +from __future__ import with_statement __license__ = 'GPL v3' __copyright__ = '2009, John Schember ' @@ -14,29 +14,29 @@ from calibre.gui2 import NONE, qstring_to_unicode class BookmarkManager(QDialog, Ui_BookmarkManager): def __init__(self, parent, bookmarks): QDialog.__init__(self, parent) - + self.setupUi(self) - + self.bookmarks = bookmarks[:] self.set_bookmarks() - + self.connect(self.button_revert, SIGNAL('clicked()'), self.set_bookmarks) self.connect(self.button_delete, SIGNAL('clicked()'), self.delete_bookmark) self.connect(self.button_edit, SIGNAL('clicked()'), self.edit_bookmark) self.connect(self.button_export, SIGNAL('clicked()'), self.export_bookmarks) self.connect(self.button_import, SIGNAL('clicked()'), self.import_bookmarks) - + def set_bookmarks(self, bookmarks=None): if bookmarks == None: bookmarks = self.bookmarks[:] self._model = BookmarkTableModel(self, bookmarks) self.bookmarks_table.setModel(self._model) - + def delete_bookmark(self): indexes = self.bookmarks_table.selectionModel().selectedIndexes() if indexes != []: self._model.remove_row(indexes[0].row()) - + def edit_bookmark(self): indexes = self.bookmarks_table.selectionModel().selectedIndexes() if indexes != []: @@ -44,27 +44,29 @@ class BookmarkManager(QDialog, Ui_BookmarkManager): title = QVariant(unicode(title).strip()) if ok and title: self._model.setData(indexes[0], title, Qt.EditRole) - + def get_bookmarks(self): return self._model.bookmarks - + def export_bookmarks(self): - filename = QFileDialog.getSaveFileName(self, _("Export Bookmarks"), '%s%suntitled.pickle' % (os.getcwdu(), os.sep), _("Pickled Bookmarks (*.pickle)")) + filename = QFileDialog.getSaveFileName(self, _("Export Bookmarks"), + '%s%suntitled.pickle' % (os.getcwdu(), os.sep), + _("Saved Bookmarks (*.pickle)")) if filename == '': return - + with open(filename, 'w') as fileobj: cPickle.dump(self._model.bookmarks, fileobj) - + def import_bookmarks(self): filename = QFileDialog.getOpenFileName(self, _("Import Bookmarks"), '%s' % os.getcwdu(), _("Pickled Bookmarks (*.pickle)")) if filename == '': return - + imported = None with open(filename, 'r') as fileobj: imported = cPickle.load(fileobj) - + if imported != None: bad = False try: @@ -74,7 +76,7 @@ class BookmarkManager(QDialog, Ui_BookmarkManager): break except: pass - + if not bad: bookmarks = self._model.bookmarks[:] for bm in imported: @@ -88,32 +90,32 @@ class BookmarkTableModel(QAbstractTableModel): def __init__(self, parent, bookmarks): QAbstractTableModel.__init__(self, parent) - + self.bookmarks = bookmarks[:] def rowCount(self, parent): if parent and parent.isValid(): return 0 return len(self.bookmarks) - + def columnCount(self, parent): if parent and parent.isValid(): return 0 return len(self.headers) - + def data(self, index, role): if role in (Qt.DisplayRole, Qt.EditRole): ans = self.bookmarks[index.row()][0] return NONE if ans is None else QVariant(ans) return NONE - + def setData(self, index, value, role): if role == Qt.EditRole: self.bookmarks[index.row()] = (qstring_to_unicode(value.toString()).strip(), self.bookmarks[index.row()][1]) self.emit(SIGNAL("dataChanged(QModelIndex, QModelIndex)"), index, index) return True return False - + def flags(self, index): flags = QAbstractTableModel.flags(self, index) flags |= Qt.ItemIsEditable @@ -126,7 +128,7 @@ class BookmarkTableModel(QAbstractTableModel): return QVariant(self.headers[section]) else: return QVariant(section+1) - + def remove_row(self, row): self.beginRemoveRows(QModelIndex(), row, row) del self.bookmarks[row] diff --git a/src/calibre/translations/calibre.pot b/src/calibre/translations/calibre.pot index 8c8d69f29a..d4e86afcc9 100644 --- a/src/calibre/translations/calibre.pot +++ b/src/calibre/translations/calibre.pot @@ -4,9 +4,9 @@ # msgid "" msgstr "" -"Project-Id-Version: calibre 0.6.0b3\n" -"POT-Creation-Date: 2009-06-10 13:26+PDT\n" -"PO-Revision-Date: 2009-06-10 13:26+PDT\n" +"Project-Id-Version: calibre 0.6.0b5\n" +"POT-Creation-Date: 2009-06-11 15:24+PDT\n" +"PO-Revision-Date: 2009-06-11 15:24+PDT\n" "Last-Translator: Automatically generated\n" "Language-Team: LANGUAGE\n" "MIME-Version: 1.0\n" @@ -58,12 +58,12 @@ msgstr "" #: /home/kovid/work/calibre/src/calibre/ebooks/mobi/reader.py:69 #: /home/kovid/work/calibre/src/calibre/ebooks/mobi/reader.py:78 #: /home/kovid/work/calibre/src/calibre/ebooks/mobi/reader.py:149 -#: /home/kovid/work/calibre/src/calibre/ebooks/mobi/reader.py:531 -#: /home/kovid/work/calibre/src/calibre/ebooks/mobi/reader.py:715 +#: /home/kovid/work/calibre/src/calibre/ebooks/mobi/reader.py:535 +#: /home/kovid/work/calibre/src/calibre/ebooks/mobi/reader.py:719 #: /home/kovid/work/calibre/src/calibre/ebooks/odt/input.py:44 #: /home/kovid/work/calibre/src/calibre/ebooks/odt/input.py:46 -#: /home/kovid/work/calibre/src/calibre/ebooks/oeb/base.py:791 -#: /home/kovid/work/calibre/src/calibre/ebooks/oeb/base.py:796 +#: /home/kovid/work/calibre/src/calibre/ebooks/oeb/base.py:798 +#: /home/kovid/work/calibre/src/calibre/ebooks/oeb/base.py:803 #: /home/kovid/work/calibre/src/calibre/ebooks/oeb/reader.py:162 #: /home/kovid/work/calibre/src/calibre/ebooks/oeb/reader.py:165 #: /home/kovid/work/calibre/src/calibre/ebooks/oeb/transforms/jacket.py:82 @@ -363,7 +363,7 @@ msgstr "" #: /home/kovid/work/calibre/src/calibre/devices/prs505/driver.py:151 #: /home/kovid/work/calibre/src/calibre/devices/usbms/driver.py:133 #: /home/kovid/work/calibre/src/calibre/gui2/dialogs/scheduler.py:467 -#: /home/kovid/work/calibre/src/calibre/gui2/tags.py:50 +#: /home/kovid/work/calibre/src/calibre/gui2/tag_view.py:80 #: /home/kovid/work/calibre/src/calibre/library/database2.py:937 #: /home/kovid/work/calibre/src/calibre/library/database2.py:941 #: /home/kovid/work/calibre/src/calibre/library/database2.py:1259 @@ -1082,51 +1082,51 @@ msgstr "" msgid "Set book ID" msgstr "" -#: /home/kovid/work/calibre/src/calibre/ebooks/lrf/output.py:77 +#: /home/kovid/work/calibre/src/calibre/ebooks/lrf/output.py:78 msgid "Enable autorotation of images that are wider than the screen width." msgstr "" -#: /home/kovid/work/calibre/src/calibre/ebooks/lrf/output.py:81 +#: /home/kovid/work/calibre/src/calibre/ebooks/lrf/output.py:82 msgid "Set the space between words in pts. Default is %default" msgstr "" -#: /home/kovid/work/calibre/src/calibre/ebooks/lrf/output.py:84 +#: /home/kovid/work/calibre/src/calibre/ebooks/lrf/output.py:85 msgid "Add a header to all the pages with title and author." msgstr "" -#: /home/kovid/work/calibre/src/calibre/ebooks/lrf/output.py:87 +#: /home/kovid/work/calibre/src/calibre/ebooks/lrf/output.py:88 msgid "Set the format of the header. %a is replaced by the author and %t by the title. Default is %default" msgstr "" -#: /home/kovid/work/calibre/src/calibre/ebooks/lrf/output.py:91 +#: /home/kovid/work/calibre/src/calibre/ebooks/lrf/output.py:92 msgid "Add extra spacing below the header. Default is %default pt." msgstr "" -#: /home/kovid/work/calibre/src/calibre/ebooks/lrf/output.py:94 +#: /home/kovid/work/calibre/src/calibre/ebooks/lrf/output.py:95 msgid "Minimum paragraph indent (the indent of the first line of a paragraph) in pts. Default: %default" msgstr "" -#: /home/kovid/work/calibre/src/calibre/ebooks/lrf/output.py:99 +#: /home/kovid/work/calibre/src/calibre/ebooks/lrf/output.py:100 msgid "Render tables in the HTML as images (useful if the document has large or complex tables)" msgstr "" -#: /home/kovid/work/calibre/src/calibre/ebooks/lrf/output.py:104 +#: /home/kovid/work/calibre/src/calibre/ebooks/lrf/output.py:105 msgid "Multiply the size of text in rendered tables by this factor. Default is %default" msgstr "" -#: /home/kovid/work/calibre/src/calibre/ebooks/lrf/output.py:108 +#: /home/kovid/work/calibre/src/calibre/ebooks/lrf/output.py:109 msgid "The serif family of fonts to embed" msgstr "" -#: /home/kovid/work/calibre/src/calibre/ebooks/lrf/output.py:111 +#: /home/kovid/work/calibre/src/calibre/ebooks/lrf/output.py:112 msgid "The sans-serif family of fonts to embed" msgstr "" -#: /home/kovid/work/calibre/src/calibre/ebooks/lrf/output.py:114 +#: /home/kovid/work/calibre/src/calibre/ebooks/lrf/output.py:115 msgid "The monospace family of fonts to embed" msgstr "" -#: /home/kovid/work/calibre/src/calibre/ebooks/lrf/output.py:139 +#: /home/kovid/work/calibre/src/calibre/ebooks/lrf/output.py:140 msgid "Comic" msgstr "" @@ -1178,7 +1178,7 @@ msgstr "" #: /home/kovid/work/calibre/src/calibre/gui2/library.py:942 #: /home/kovid/work/calibre/src/calibre/gui2/library.py:1002 #: /home/kovid/work/calibre/src/calibre/gui2/status.py:60 -#: /home/kovid/work/calibre/src/calibre/gui2/tags.py:50 +#: /home/kovid/work/calibre/src/calibre/gui2/tag_view.py:80 msgid "Tags" msgstr "" @@ -1186,7 +1186,7 @@ msgstr "" #: /home/kovid/work/calibre/src/calibre/gui2/library.py:124 #: /home/kovid/work/calibre/src/calibre/gui2/library.py:319 #: /home/kovid/work/calibre/src/calibre/gui2/status.py:59 -#: /home/kovid/work/calibre/src/calibre/gui2/tags.py:50 +#: /home/kovid/work/calibre/src/calibre/gui2/tag_view.py:80 msgid "Series" msgstr "" @@ -1356,74 +1356,74 @@ msgstr "" msgid "Disable compression of the file contents." msgstr "" -#: /home/kovid/work/calibre/src/calibre/ebooks/oeb/base.py:1164 +#: /home/kovid/work/calibre/src/calibre/ebooks/oeb/base.py:1177 msgid "Cover" msgstr "" -#: /home/kovid/work/calibre/src/calibre/ebooks/oeb/base.py:1165 +#: /home/kovid/work/calibre/src/calibre/ebooks/oeb/base.py:1178 msgid "Title Page" msgstr "" -#: /home/kovid/work/calibre/src/calibre/ebooks/oeb/base.py:1166 +#: /home/kovid/work/calibre/src/calibre/ebooks/oeb/base.py:1179 #: /home/kovid/work/calibre/src/calibre/ebooks/oeb/transforms/htmltoc.py:15 #: /home/kovid/work/calibre/src/calibre/gui2/viewer/main.py:48 #: /home/kovid/work/calibre/src/calibre/gui2/viewer/main_ui.py:166 msgid "Table of Contents" msgstr "" -#: /home/kovid/work/calibre/src/calibre/ebooks/oeb/base.py:1167 +#: /home/kovid/work/calibre/src/calibre/ebooks/oeb/base.py:1180 msgid "Index" msgstr "" -#: /home/kovid/work/calibre/src/calibre/ebooks/oeb/base.py:1168 +#: /home/kovid/work/calibre/src/calibre/ebooks/oeb/base.py:1181 msgid "Glossary" msgstr "" -#: /home/kovid/work/calibre/src/calibre/ebooks/oeb/base.py:1169 +#: /home/kovid/work/calibre/src/calibre/ebooks/oeb/base.py:1182 msgid "Acknowledgements" msgstr "" -#: /home/kovid/work/calibre/src/calibre/ebooks/oeb/base.py:1170 +#: /home/kovid/work/calibre/src/calibre/ebooks/oeb/base.py:1183 msgid "Bibliography" msgstr "" -#: /home/kovid/work/calibre/src/calibre/ebooks/oeb/base.py:1171 +#: /home/kovid/work/calibre/src/calibre/ebooks/oeb/base.py:1184 msgid "Colophon" msgstr "" -#: /home/kovid/work/calibre/src/calibre/ebooks/oeb/base.py:1172 +#: /home/kovid/work/calibre/src/calibre/ebooks/oeb/base.py:1185 msgid "Copyright" msgstr "" -#: /home/kovid/work/calibre/src/calibre/ebooks/oeb/base.py:1173 +#: /home/kovid/work/calibre/src/calibre/ebooks/oeb/base.py:1186 msgid "Dedication" msgstr "" -#: /home/kovid/work/calibre/src/calibre/ebooks/oeb/base.py:1174 +#: /home/kovid/work/calibre/src/calibre/ebooks/oeb/base.py:1187 msgid "Epigraph" msgstr "" -#: /home/kovid/work/calibre/src/calibre/ebooks/oeb/base.py:1175 +#: /home/kovid/work/calibre/src/calibre/ebooks/oeb/base.py:1188 msgid "Foreword" msgstr "" -#: /home/kovid/work/calibre/src/calibre/ebooks/oeb/base.py:1176 +#: /home/kovid/work/calibre/src/calibre/ebooks/oeb/base.py:1189 msgid "List of Illustrations" msgstr "" -#: /home/kovid/work/calibre/src/calibre/ebooks/oeb/base.py:1177 +#: /home/kovid/work/calibre/src/calibre/ebooks/oeb/base.py:1190 msgid "List of Tables" msgstr "" -#: /home/kovid/work/calibre/src/calibre/ebooks/oeb/base.py:1178 +#: /home/kovid/work/calibre/src/calibre/ebooks/oeb/base.py:1191 msgid "Notes" msgstr "" -#: /home/kovid/work/calibre/src/calibre/ebooks/oeb/base.py:1179 +#: /home/kovid/work/calibre/src/calibre/ebooks/oeb/base.py:1192 msgid "Preface" msgstr "" -#: /home/kovid/work/calibre/src/calibre/ebooks/oeb/base.py:1180 +#: /home/kovid/work/calibre/src/calibre/ebooks/oeb/base.py:1193 msgid "Main Text" msgstr "" @@ -2791,7 +2791,7 @@ msgstr "" #: /home/kovid/work/calibre/src/calibre/gui2/dialogs/config.py:212 #: /home/kovid/work/calibre/src/calibre/gui2/library.py:309 #: /home/kovid/work/calibre/src/calibre/gui2/status.py:57 -#: /home/kovid/work/calibre/src/calibre/gui2/tags.py:50 +#: /home/kovid/work/calibre/src/calibre/gui2/tag_view.py:80 msgid "Formats" msgstr "" @@ -4327,7 +4327,7 @@ msgstr "" #: /home/kovid/work/calibre/src/calibre/gui2/library.py:302 #: /home/kovid/work/calibre/src/calibre/gui2/library.py:308 #: /home/kovid/work/calibre/src/calibre/gui2/library.py:313 -#: /home/kovid/work/calibre/src/calibre/gui2/widgets.py:374 +#: /home/kovid/work/calibre/src/calibre/gui2/widgets.py:376 msgid "None" msgstr "" @@ -5028,11 +5028,11 @@ msgstr "" msgid "Click to browse books by tags" msgstr "" -#: /home/kovid/work/calibre/src/calibre/gui2/tags.py:50 +#: /home/kovid/work/calibre/src/calibre/gui2/tag_view.py:80 msgid "Authors" msgstr "" -#: /home/kovid/work/calibre/src/calibre/gui2/tags.py:50 +#: /home/kovid/work/calibre/src/calibre/gui2/tag_view.py:80 msgid "Publishers" msgstr "" @@ -5076,16 +5076,19 @@ msgstr "" msgid "Export Bookmarks" msgstr "" -#: /home/kovid/work/calibre/src/calibre/gui2/viewer/bookmarkmanager.py:52 -#: /home/kovid/work/calibre/src/calibre/gui2/viewer/bookmarkmanager.py:60 -msgid "Pickled Bookmarks (*.pickle)" +#: /home/kovid/work/calibre/src/calibre/gui2/viewer/bookmarkmanager.py:54 +msgid "Saved Bookmarks (*.pickle)" msgstr "" -#: /home/kovid/work/calibre/src/calibre/gui2/viewer/bookmarkmanager.py:60 +#: /home/kovid/work/calibre/src/calibre/gui2/viewer/bookmarkmanager.py:62 msgid "Import Bookmarks" msgstr "" -#: /home/kovid/work/calibre/src/calibre/gui2/viewer/bookmarkmanager.py:87 +#: /home/kovid/work/calibre/src/calibre/gui2/viewer/bookmarkmanager.py:62 +msgid "Pickled Bookmarks (*.pickle)" +msgstr "" + +#: /home/kovid/work/calibre/src/calibre/gui2/viewer/bookmarkmanager.py:89 msgid "Name" msgstr "" From 8d1bcee8dda16b12ecd92bf62935719cd5d0927a Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 11 Jun 2009 16:04:54 -0700 Subject: [PATCH 4/8] MOBI Input: Merge multiple html sections instead of just using the largest one --- src/calibre/ebooks/html/input.py | 2 +- src/calibre/ebooks/mobi/reader.py | 26 ++++++++++++++++---------- src/calibre/ebooks/oeb/base.py | 1 + 3 files changed, 18 insertions(+), 11 deletions(-) diff --git a/src/calibre/ebooks/html/input.py b/src/calibre/ebooks/html/input.py index f566714878..4385291f69 100644 --- a/src/calibre/ebooks/html/input.py +++ b/src/calibre/ebooks/html/input.py @@ -233,7 +233,7 @@ class HTMLInput(InputFormatPlugin): name = 'HTML Input' author = 'Kovid Goyal' description = 'Convert HTML and OPF files to an OEB' - file_types = set(['opf', 'html', 'htm', 'xhtml', 'xhtm']) + file_types = set(['opf', 'html', 'htm', 'xhtml', 'xhtm', 'shtm', 'shtml']) options = set([ OptionRecommendation(name='breadth_first', diff --git a/src/calibre/ebooks/mobi/reader.py b/src/calibre/ebooks/mobi/reader.py index c1ea4d8f2f..686a6efdf9 100644 --- a/src/calibre/ebooks/mobi/reader.py +++ b/src/calibre/ebooks/mobi/reader.py @@ -315,18 +315,24 @@ class MobiReader(object): htmls = list(root.xpath('//html')) if len(htmls) > 1: - self.log.warn('Markup contains multiple tags') - # Keep only the largest head and body + self.log.warn('Markup contains multiple tags, merging.') + # Merge all and sections + for h in htmls: + p = h.getparent() + if hasattr(p, 'remove'): + p.remove(h) bodies, heads = root.xpath('//body'), root.xpath('//head') - def sz(x): return len(list(x.iter())) - def scmp(x, y): return cmp(sz(x), sz(y)) - body = list(sorted(bodies, cmp=scmp)) - head = list(sorted(heads, cmp=scmp)) for x in root: root.remove(x) - if head: - root.append(head[-1]) - if body: - root.append(body[-1]) + head, body = map(root.makeelement, ('head', 'body')) + for h in heads: + for x in h: + h.remove(x) + head.append(x) + for b in bodies: + for x in b: + b.remove(x) + body.append(x) + root.append(head), root.append(body) for x in root.xpath('//script'): x.getparent().remove(x) diff --git a/src/calibre/ebooks/oeb/base.py b/src/calibre/ebooks/oeb/base.py index 711dce0b8d..67a8f04cc8 100644 --- a/src/calibre/ebooks/oeb/base.py +++ b/src/calibre/ebooks/oeb/base.py @@ -823,6 +823,7 @@ class Manifest(object): for key in list(body.attrib.keys()): if key == 'lang' or key.endswith('}lang'): body.attrib.pop(key) + return data def _parse_css(self, data): From d2eccc9647fa8f05ebf32d4aa2b72076ca6c7155 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 11 Jun 2009 16:09:45 -0700 Subject: [PATCH 5/8] Add support for the Kindle DX --- src/calibre/customize/builtins.py | 4 ++-- src/calibre/devices/kindle/driver.py | 12 ++++++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/calibre/customize/builtins.py b/src/calibre/customize/builtins.py index e26813a77a..e709e5593d 100644 --- a/src/calibre/customize/builtins.py +++ b/src/calibre/customize/builtins.py @@ -350,8 +350,7 @@ from calibre.devices.blackberry.driver import BLACKBERRY from calibre.devices.cybookg3.driver import CYBOOKG3 from calibre.devices.eb600.driver import EB600 from calibre.devices.jetbook.driver import JETBOOK -from calibre.devices.kindle.driver import KINDLE -from calibre.devices.kindle.driver import KINDLE2 +from calibre.devices.kindle.driver import KINDLE, KINDLE2, KINDLE_DX from calibre.devices.prs500.driver import PRS500 from calibre.devices.prs505.driver import PRS505 from calibre.devices.prs700.driver import PRS700 @@ -397,6 +396,7 @@ plugins += [ JETBOOK, KINDLE, KINDLE2, + KINDLE_DX, PRS500, PRS505, PRS700, diff --git a/src/calibre/devices/kindle/driver.py b/src/calibre/devices/kindle/driver.py index 00cd615b6d..8c62da7587 100644 --- a/src/calibre/devices/kindle/driver.py +++ b/src/calibre/devices/kindle/driver.py @@ -72,3 +72,15 @@ class KINDLE2(KINDLE): PRODUCT_ID = [0x0002] BCD = [0x0100] + +class KINDLE_DX(KINDLE): + name = 'Kindle DX Device Interface' + description = _('Communicate with the Kindle 2 eBook reader.') + author = _('John Schember') + supported_platforms = ['windows', 'osx', 'linux'] + + + PRODUCT_ID = [0x0003] + BCD = [0x0100] + + From 5350670f53c60b10a0934cc2ed9f260a9d662e3d Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 11 Jun 2009 16:13:36 -0700 Subject: [PATCH 6/8] beta 6 --- src/calibre/constants.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/calibre/constants.py b/src/calibre/constants.py index 75912b276d..3663f9fd13 100644 --- a/src/calibre/constants.py +++ b/src/calibre/constants.py @@ -2,7 +2,7 @@ __license__ = 'GPL v3' __copyright__ = '2008, Kovid Goyal kovid@kovidgoyal.net' __docformat__ = 'restructuredtext en' __appname__ = 'calibre' -__version__ = '0.6.0b5' +__version__ = '0.6.0b6' __author__ = "Kovid Goyal " import re From 556c2a4f74c166f19c678b19d8cb7ef4a6bc717e Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 11 Jun 2009 17:27:29 -0700 Subject: [PATCH 7/8] ... --- src/calibre/manual/faq.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/calibre/manual/faq.rst b/src/calibre/manual/faq.rst index 71cf179f12..30457b5deb 100644 --- a/src/calibre/manual/faq.rst +++ b/src/calibre/manual/faq.rst @@ -77,7 +77,7 @@ Device Integration What devices does |app| support? ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -At the moment |app| has full support for the SONY PRS 500/505/700, Cybook Gen 3, Amazon Kindle 1/2, Netronix EB600, Ectaco Jetbook, BeBook/BeBook Mini and the iPhone. In addition, using the :guilabel:`Save to disk` function you can use it with any ebook reader that exports itself as a USB disk. +At the moment |app| has full support for the SONY PRS 500/505/700, Cybook Gen 3, Amazon Kindle 1/2/DX, Netronix EB600, Ectaco Jetbook, BeBook/BeBook Mini and the iPhone. In addition, using the :guilabel:`Save to disk` function you can use it with any ebook reader that exports itself as a USB disk. I used |app| to transfer some books to my reader, and now the SONY software hangs every time I connect the reader? ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ From af4d9aa8efd9e1b30b3ae602da6c2724a061348e Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 11 Jun 2009 18:22:19 -0700 Subject: [PATCH 8/8] DX supports PDF --- src/calibre/devices/kindle/driver.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/calibre/devices/kindle/driver.py b/src/calibre/devices/kindle/driver.py index 8c62da7587..1052ab87a0 100644 --- a/src/calibre/devices/kindle/driver.py +++ b/src/calibre/devices/kindle/driver.py @@ -79,6 +79,7 @@ class KINDLE_DX(KINDLE): author = _('John Schember') supported_platforms = ['windows', 'osx', 'linux'] + FORMATS = ['azw', 'mobi', 'prc', 'azw1', 'tpz', 'pdf', 'txt'] PRODUCT_ID = [0x0003] BCD = [0x0100]