Merge from trunk

This commit is contained in:
Charles Haley 2012-07-31 15:48:39 +02:00
commit 1b63da86ff
2 changed files with 6 additions and 10 deletions

View File

@ -13,7 +13,6 @@ import datetime, os, re, sys, json, hashlib
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 @@ class KINDLE2(KINDLE):
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

View File

@ -37,12 +37,8 @@ def synchronous(tlockname):
def _synched(func):
@wraps(func)
def _synchronizer(self, *args, **kwargs):
tlock = self.__getattribute__( tlockname)
tlock.acquire()
try:
with self.__getattribute__(tlockname):
return func(self, *args, **kwargs)
finally:
tlock.release()
return _synchronizer
return _synched
@ -466,12 +462,12 @@ class SMART_DEVICE_APP(DeviceConfig, DevicePlugin):
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