mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Merge from trunk
This commit is contained in:
commit
cb13da2b9b
@ -25,6 +25,8 @@ def fingerprint(d):
|
|||||||
return MTPDevice(d.busnum, d.devnum, d.vendor_id, d.product_id, d.bcd,
|
return MTPDevice(d.busnum, d.devnum, d.vendor_id, d.product_id, d.bcd,
|
||||||
d.serial, d.manufacturer, d.product)
|
d.serial, d.manufacturer, d.product)
|
||||||
|
|
||||||
|
APPLE = 0x05ac
|
||||||
|
|
||||||
class MTP_DEVICE(MTPDeviceBase):
|
class MTP_DEVICE(MTPDeviceBase):
|
||||||
|
|
||||||
# libusb(x) does not work on OS X. So no MTP support for OS X
|
# libusb(x) does not work on OS X. So no MTP support for OS X
|
||||||
@ -53,7 +55,8 @@ class MTP_DEVICE(MTPDeviceBase):
|
|||||||
devs = set()
|
devs = set()
|
||||||
for d in devices_on_system:
|
for d in devices_on_system:
|
||||||
fp = fingerprint(d)
|
fp = fingerprint(d)
|
||||||
if fp not in self.blacklisted_devices:
|
if fp not in self.blacklisted_devices and fp.vendor_id != APPLE:
|
||||||
|
# Do not try to open Apple devices
|
||||||
devs.add(fp)
|
devs.add(fp)
|
||||||
|
|
||||||
# Clean up ejected devices
|
# Clean up ejected devices
|
||||||
@ -93,7 +96,7 @@ class MTP_DEVICE(MTPDeviceBase):
|
|||||||
p(err)
|
p(err)
|
||||||
return False
|
return False
|
||||||
devs = [d for d in devices_on_system if (d.vendor_id, d.product_id)
|
devs = [d for d in devices_on_system if (d.vendor_id, d.product_id)
|
||||||
in self.known_devices]
|
in self.known_devices and d.vendor_id != APPLE]
|
||||||
if not devs:
|
if not devs:
|
||||||
p('No known MTP devices connected to system')
|
p('No known MTP devices connected to system')
|
||||||
return False
|
return False
|
||||||
|
@ -42,8 +42,8 @@ def update_internal_links(mobi8_reader):
|
|||||||
mr.header.codec) + suffix
|
mr.header.codec) + suffix
|
||||||
tag = posfid_index_pattern.sub(replacement, tag, 1)
|
tag = posfid_index_pattern.sub(replacement, tag, 1)
|
||||||
srcpieces[j] = tag
|
srcpieces[j] = tag
|
||||||
part = ''.join([x.decode(mr.header.codec) for x in srcpieces])
|
raw = b''.join(srcpieces)
|
||||||
parts.append(part)
|
parts.append(raw.decode(mr.header.codec))
|
||||||
|
|
||||||
# All parts are now unicode and have no internal links
|
# All parts are now unicode and have no internal links
|
||||||
return parts
|
return parts
|
||||||
|
@ -305,7 +305,7 @@ class Chunker(object):
|
|||||||
ans.append(start)
|
ans.append(start)
|
||||||
while rest:
|
while rest:
|
||||||
start, rest = split_multibyte_text(rest)
|
start, rest = split_multibyte_text(rest)
|
||||||
ans.append(b'<span class="AmznBigTextBlock">' + start + '</span>')
|
ans.append(b'<span class="AmznBigTextBlock">' + start + b'</span>')
|
||||||
return [Chunk(x, self.chunk_selector) for x in ans]
|
return [Chunk(x, self.chunk_selector) for x in ans]
|
||||||
|
|
||||||
def merge_small_chunks(self, chunks):
|
def merge_small_chunks(self, chunks):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user