mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Pull from trunk
This commit is contained in:
commit
f364cbcc36
@ -261,6 +261,18 @@ class SonyReaderOutput(OutputProfile):
|
|||||||
fbase = 12
|
fbase = 12
|
||||||
fsizes = [7.5, 9, 10, 12, 15.5, 20, 22, 24]
|
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):
|
class SonyReader300Output(SonyReaderOutput):
|
||||||
|
|
||||||
author = 'John Schember'
|
author = 'John Schember'
|
||||||
@ -461,7 +473,7 @@ class NookOutput(OutputProfile):
|
|||||||
output_profiles = [OutputProfile, SonyReaderOutput, SonyReader300Output,
|
output_profiles = [OutputProfile, SonyReaderOutput, SonyReader300Output,
|
||||||
SonyReader900Output, MSReaderOutput, MobipocketOutput, HanlinV3Output,
|
SonyReader900Output, MSReaderOutput, MobipocketOutput, HanlinV3Output,
|
||||||
HanlinV5Output, CybookG3Output, CybookOpusOutput, KindleOutput,
|
HanlinV5Output, CybookG3Output, CybookOpusOutput, KindleOutput,
|
||||||
iPadOutput,
|
iPadOutput, KoboReaderOutput,
|
||||||
SonyReaderLandscapeOutput, KindleDXOutput, IlliadOutput,
|
SonyReaderLandscapeOutput, KindleDXOutput, IlliadOutput,
|
||||||
IRexDR1000Output, IRexDR800Output, JetBook5Output, NookOutput,]
|
IRexDR1000Output, IRexDR800Output, JetBook5Output, NookOutput,]
|
||||||
|
|
||||||
|
@ -384,7 +384,7 @@ class BookList(_BookList):
|
|||||||
if not pl:
|
if not pl:
|
||||||
continue
|
continue
|
||||||
db_ids = [i.getAttribute('id') for i in pl.childNodes if hasattr(i, 'getAttribute')]
|
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 = {}
|
map = {}
|
||||||
for i, j in zip(pl_book_ids, db_ids):
|
for i, j in zip(pl_book_ids, db_ids):
|
||||||
map[i] = j
|
map[i] = j
|
||||||
|
@ -171,6 +171,10 @@ class EPUBOutput(OutputFormatPlugin):
|
|||||||
|
|
||||||
self.workaround_sony_quirks()
|
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
|
from calibre.ebooks.oeb.base import OPF
|
||||||
identifiers = oeb.metadata['identifier']
|
identifiers = oeb.metadata['identifier']
|
||||||
uuid = None
|
uuid = None
|
||||||
|
@ -37,6 +37,11 @@ class RescaleImages(object):
|
|||||||
page_height -= (self.opts.margin_top + self.opts.margin_bottom) * self.opts.dest.dpi/72.
|
page_height -= (self.opts.margin_top + self.opts.margin_bottom) * self.opts.dest.dpi/72.
|
||||||
for item in self.oeb.manifest:
|
for item in self.oeb.manifest:
|
||||||
if item.media_type.startswith('image'):
|
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
|
raw = item.data
|
||||||
if not raw: continue
|
if not raw: continue
|
||||||
if qt:
|
if qt:
|
||||||
@ -65,11 +70,11 @@ class RescaleImages(object):
|
|||||||
if qt:
|
if qt:
|
||||||
img = img.scaled(new_width, new_height,
|
img = img.scaled(new_width, new_height,
|
||||||
Qt.IgnoreAspectRatio, Qt.SmoothTransformation)
|
Qt.IgnoreAspectRatio, Qt.SmoothTransformation)
|
||||||
data = pixmap_to_data(img)
|
data = pixmap_to_data(img, format=ext)
|
||||||
else:
|
else:
|
||||||
im = im.resize((int(new_width), int(new_height)), PILImage.ANTIALIAS)
|
im = im.resize((int(new_width), int(new_height)), PILImage.ANTIALIAS)
|
||||||
of = cStringIO.StringIO()
|
of = cStringIO.StringIO()
|
||||||
im.convert('RGB').save(of, 'JPEG')
|
im.convert('RGB').save(of, ext)
|
||||||
data = of.getvalue()
|
data = of.getvalue()
|
||||||
if data is not None:
|
if data is not None:
|
||||||
item.data = data
|
item.data = data
|
||||||
|
@ -473,6 +473,17 @@ class ConfigDialog(ResizableDialog, Ui_Dialog):
|
|||||||
self.opt_overwrite_author_title_metadata.setChecked(config['overwrite_author_title_metadata'])
|
self.opt_overwrite_author_title_metadata.setChecked(config['overwrite_author_title_metadata'])
|
||||||
self.opt_enforce_cpu_limit.setChecked(config['enforce_cpu_limit'])
|
self.opt_enforce_cpu_limit.setChecked(config['enforce_cpu_limit'])
|
||||||
self.device_detection_button.clicked.connect(self.debug_device_detection)
|
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'), '<p>'+
|
||||||
|
_('The value <b>%d</b> you have chosen for the content '
|
||||||
|
'server port is a system port. You operating '
|
||||||
|
'system <b>may</b> 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):
|
def debug_device_detection(self):
|
||||||
from calibre.gui2.dialogs.config.device_debug import DebugDevice
|
from calibre.gui2.dialogs.config.device_debug import DebugDevice
|
||||||
|
@ -800,9 +800,6 @@
|
|||||||
</item>
|
</item>
|
||||||
<item row="0" column="1">
|
<item row="0" column="1">
|
||||||
<widget class="QSpinBox" name="port">
|
<widget class="QSpinBox" name="port">
|
||||||
<property name="minimum">
|
|
||||||
<number>1025</number>
|
|
||||||
</property>
|
|
||||||
<property name="maximum">
|
<property name="maximum">
|
||||||
<number>65535</number>
|
<number>65535</number>
|
||||||
</property>
|
</property>
|
||||||
|
@ -92,6 +92,14 @@ class Sony505(Sony500):
|
|||||||
name = 'SONY Reader 6" and Touch Edition'
|
name = 'SONY Reader 6" and Touch Edition'
|
||||||
id = 'prs505'
|
id = 'prs505'
|
||||||
|
|
||||||
|
class Kobo(Device):
|
||||||
|
name = 'Kobo Reader'
|
||||||
|
manufacturer = 'Kobo'
|
||||||
|
output_profile = 'kobo'
|
||||||
|
output_format = 'EPUB'
|
||||||
|
name = 'Kobo Reader'
|
||||||
|
id = 'kobo'
|
||||||
|
|
||||||
class Sony300(Sony505):
|
class Sony300(Sony505):
|
||||||
|
|
||||||
name = 'SONY Reader Pocket Edition'
|
name = 'SONY Reader Pocket Edition'
|
||||||
@ -125,6 +133,20 @@ class CybookOpus(CybookG3):
|
|||||||
output_profile = 'cybook_opus'
|
output_profile = 'cybook_opus'
|
||||||
id = '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):
|
class iPhone(Device):
|
||||||
|
|
||||||
name = 'iPad or iPhone/iTouch + Stanza'
|
name = 'iPad or iPhone/iTouch + Stanza'
|
||||||
|
@ -1108,7 +1108,10 @@ class LibraryDatabase2(LibraryDatabase, SchemaUpgrade, CustomColumns):
|
|||||||
mi.pubdate = utcnow()
|
mi.pubdate = utcnow()
|
||||||
self.set_metadata(id, mi)
|
self.set_metadata(id, mi)
|
||||||
if cover is not None:
|
if cover is not None:
|
||||||
|
try:
|
||||||
self.set_cover(id, cover)
|
self.set_cover(id, cover)
|
||||||
|
except:
|
||||||
|
traceback.print_exc()
|
||||||
return id
|
return id
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user