diff --git a/src/calibre/customize/profiles.py b/src/calibre/customize/profiles.py index f253b17c6e..242c7d8a91 100644 --- a/src/calibre/customize/profiles.py +++ b/src/calibre/customize/profiles.py @@ -261,6 +261,18 @@ class SonyReaderOutput(OutputProfile): fbase = 12 fsizes = [7.5, 9, 10, 12, 15.5, 20, 22, 24] +class KoboReaderOutput(OutputProfile): + + name = 'Kobo Reader' + short_name = 'kobo' + + description = _('This profile is intended for the Kobo Reader.') + + screen_size = (590, 775) + dpi = 168.451 + fbase = 12 + fsizes = [7.5, 9, 10, 12, 15.5, 20, 22, 24] + class SonyReader300Output(SonyReaderOutput): author = 'John Schember' @@ -461,7 +473,7 @@ class NookOutput(OutputProfile): output_profiles = [OutputProfile, SonyReaderOutput, SonyReader300Output, SonyReader900Output, MSReaderOutput, MobipocketOutput, HanlinV3Output, HanlinV5Output, CybookG3Output, CybookOpusOutput, KindleOutput, - iPadOutput, + iPadOutput, KoboReaderOutput, SonyReaderLandscapeOutput, KindleDXOutput, IlliadOutput, IRexDR1000Output, IRexDR800Output, JetBook5Output, NookOutput,] diff --git a/src/calibre/devices/prs505/books.py b/src/calibre/devices/prs505/books.py index 9d943bd8e6..ee5209c563 100644 --- a/src/calibre/devices/prs505/books.py +++ b/src/calibre/devices/prs505/books.py @@ -384,7 +384,7 @@ class BookList(_BookList): if not pl: continue db_ids = [i.getAttribute('id') for i in pl.childNodes if hasattr(i, 'getAttribute')] - pl_book_ids = [self.book_by_id(i.getAttribute('id')).db_id for i in pl.childNodes if hasattr(i, 'getAttribute')] + pl_book_ids = [getattr(self.book_by_id(i), 'db_id', None) for i in db_ids] map = {} for i, j in zip(pl_book_ids, db_ids): map[i] = j diff --git a/src/calibre/ebooks/epub/output.py b/src/calibre/ebooks/epub/output.py index fd96bfdb94..129a63ef3c 100644 --- a/src/calibre/ebooks/epub/output.py +++ b/src/calibre/ebooks/epub/output.py @@ -171,6 +171,10 @@ class EPUBOutput(OutputFormatPlugin): self.workaround_sony_quirks() + if self.oeb.toc.count() == 0: + self.log.warn('This EPUB file has no Table of Contents. It will ' + 'not validate via epubcheck') + from calibre.ebooks.oeb.base import OPF identifiers = oeb.metadata['identifier'] uuid = None diff --git a/src/calibre/ebooks/oeb/transforms/rescale.py b/src/calibre/ebooks/oeb/transforms/rescale.py index a217af853a..55aafded5c 100644 --- a/src/calibre/ebooks/oeb/transforms/rescale.py +++ b/src/calibre/ebooks/oeb/transforms/rescale.py @@ -37,6 +37,11 @@ class RescaleImages(object): page_height -= (self.opts.margin_top + self.opts.margin_bottom) * self.opts.dest.dpi/72. for item in self.oeb.manifest: if item.media_type.startswith('image'): + ext = item.media_type.split('/')[-1].upper() + if ext == 'JPG': ext = 'JPEG' + if ext not in ('PNG', 'JPEG'): + ext = 'JPEG' + raw = item.data if not raw: continue if qt: @@ -65,11 +70,11 @@ class RescaleImages(object): if qt: img = img.scaled(new_width, new_height, Qt.IgnoreAspectRatio, Qt.SmoothTransformation) - data = pixmap_to_data(img) + data = pixmap_to_data(img, format=ext) else: im = im.resize((int(new_width), int(new_height)), PILImage.ANTIALIAS) of = cStringIO.StringIO() - im.convert('RGB').save(of, 'JPEG') + im.convert('RGB').save(of, ext) data = of.getvalue() if data is not None: item.data = data diff --git a/src/calibre/gui2/dialogs/config/__init__.py b/src/calibre/gui2/dialogs/config/__init__.py index cbe53662d9..1cb6aad283 100644 --- a/src/calibre/gui2/dialogs/config/__init__.py +++ b/src/calibre/gui2/dialogs/config/__init__.py @@ -473,6 +473,17 @@ class ConfigDialog(ResizableDialog, Ui_Dialog): self.opt_overwrite_author_title_metadata.setChecked(config['overwrite_author_title_metadata']) self.opt_enforce_cpu_limit.setChecked(config['enforce_cpu_limit']) self.device_detection_button.clicked.connect(self.debug_device_detection) + self.port.editingFinished.connect(self.check_port_value) + + def check_port_value(self, *args): + port = self.port.value() + if port < 1025: + warning_dialog(self, _('System port selected'), '

'+ + _('The value %d you have chosen for the content ' + 'server port is a system port. You operating ' + 'system may not allow the server to run on this ' + 'port. To be safe choose a port number larger than ' + '1024.')%port, show=True) def debug_device_detection(self): from calibre.gui2.dialogs.config.device_debug import DebugDevice diff --git a/src/calibre/gui2/dialogs/config/config.ui b/src/calibre/gui2/dialogs/config/config.ui index 22e1b30683..5d84e2e2af 100644 --- a/src/calibre/gui2/dialogs/config/config.ui +++ b/src/calibre/gui2/dialogs/config/config.ui @@ -800,9 +800,6 @@ - - 1025 - 65535 diff --git a/src/calibre/gui2/wizard/__init__.py b/src/calibre/gui2/wizard/__init__.py index 6141494bbf..30127b7266 100644 --- a/src/calibre/gui2/wizard/__init__.py +++ b/src/calibre/gui2/wizard/__init__.py @@ -92,6 +92,14 @@ class Sony505(Sony500): name = 'SONY Reader 6" and Touch Edition' id = 'prs505' +class Kobo(Device): + name = 'Kobo Reader' + manufacturer = 'Kobo' + output_profile = 'kobo' + output_format = 'EPUB' + name = 'Kobo Reader' + id = 'kobo' + class Sony300(Sony505): name = 'SONY Reader Pocket Edition' @@ -125,6 +133,20 @@ class CybookOpus(CybookG3): output_profile = 'cybook_opus' id = 'cybook_opus' +class PocketBook360(CybookOpus): + + manufacturer = 'PocketBook' + name = 'PocketBook 360' + id = 'pocketbook360' + output_profile = 'cybook_opus' + +class PocketBook(CybookG3): + + manufacturer = 'PocketBook' + name = 'PocketBook 301/302' + id = 'pocketbook' + output_profile = 'cybookg3' + class iPhone(Device): name = 'iPad or iPhone/iTouch + Stanza' diff --git a/src/calibre/library/database2.py b/src/calibre/library/database2.py index 9f9a42f700..724c1bd41a 100644 --- a/src/calibre/library/database2.py +++ b/src/calibre/library/database2.py @@ -1108,7 +1108,10 @@ class LibraryDatabase2(LibraryDatabase, SchemaUpgrade, CustomColumns): mi.pubdate = utcnow() self.set_metadata(id, mi) if cover is not None: - self.set_cover(id, cover) + try: + self.set_cover(id, cover) + except: + traceback.print_exc() return id