mirror of
git://github.com/kovidgoyal/calibre.git
synced 2025-12-30 09:05:48 +01:00
Merge from trunk
This commit is contained in:
commit
1b63da86ff
2 changed files with 6 additions and 10 deletions
|
|
@ -13,7 +13,6 @@
|
|||
from calibre.devices.kindle.bookmark import Bookmark
|
||||
from calibre.devices.usbms.driver import USBMS
|
||||
from calibre import strftime
|
||||
from calibre.utils.logging import default_log
|
||||
|
||||
'''
|
||||
Notes on collections:
|
||||
|
|
@ -389,6 +388,7 @@ def upload_cover(self, path, filename, metadata, filepath):
|
|||
self.upload_apnx(path, filename, metadata, filepath)
|
||||
|
||||
def upload_kindle_thumbnail(self, metadata, filepath):
|
||||
from calibre.utils.logging import default_log
|
||||
coverdata = getattr(metadata, 'thumbnail', None)
|
||||
if not coverdata or not coverdata[2]:
|
||||
return
|
||||
|
|
|
|||
|
|
@ -36,13 +36,9 @@ def synchronous(tlockname):
|
|||
|
||||
def _synched(func):
|
||||
@wraps(func)
|
||||
def _synchronizer(self,*args, **kwargs):
|
||||
tlock = self.__getattribute__( tlockname)
|
||||
tlock.acquire()
|
||||
try:
|
||||
def _synchronizer(self, *args, **kwargs):
|
||||
with self.__getattribute__(tlockname):
|
||||
return func(self, *args, **kwargs)
|
||||
finally:
|
||||
tlock.release()
|
||||
return _synchronizer
|
||||
return _synched
|
||||
|
||||
|
|
@ -466,12 +462,12 @@ def is_usb_connected(self, devices_on_system, debug=False, only_presence=False):
|
|||
ans = select.select((self.listen_socket,), (), (), 0)
|
||||
if len(ans[0]) > 0:
|
||||
# timeout in 10 ms to detect rare case where the socket went
|
||||
# way between the select and the accent
|
||||
# way between the select and the accept
|
||||
try:
|
||||
self.device_socket = None
|
||||
self.listen_socket.settimeout(0.010)
|
||||
self.device_socket, ign = \
|
||||
eintr_retry_call(self.listen_socket.accept)
|
||||
self.device_socket, ign = eintr_retry_call(
|
||||
self.listen_socket.accept)
|
||||
self.listen_socket.settimeout(None)
|
||||
self.device_socket.settimeout(None)
|
||||
self.is_connected = True
|
||||
|
|
|
|||
Loading…
Reference in a new issue