Merge from trunk

This commit is contained in:
Charles Haley 2012-07-31 15:30:40 +02:00
commit 17eabd3e40
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.kindle.bookmark import Bookmark
from calibre.devices.usbms.driver import USBMS from calibre.devices.usbms.driver import USBMS
from calibre import strftime from calibre import strftime
from calibre.utils.logging import default_log
''' '''
Notes on collections: Notes on collections:
@ -389,6 +388,7 @@ class KINDLE2(KINDLE):
self.upload_apnx(path, filename, metadata, filepath) self.upload_apnx(path, filename, metadata, filepath)
def upload_kindle_thumbnail(self, metadata, filepath): def upload_kindle_thumbnail(self, metadata, filepath):
from calibre.utils.logging import default_log
coverdata = getattr(metadata, 'thumbnail', None) coverdata = getattr(metadata, 'thumbnail', None)
if not coverdata or not coverdata[2]: if not coverdata or not coverdata[2]:
return return

View File

@ -37,12 +37,8 @@ def synchronous(tlockname):
def _synched(func): def _synched(func):
@wraps(func) @wraps(func)
def _synchronizer(self, *args, **kwargs): def _synchronizer(self, *args, **kwargs):
tlock = self.__getattribute__( tlockname) with self.__getattribute__(tlockname):
tlock.acquire()
try:
return func(self, *args, **kwargs) return func(self, *args, **kwargs)
finally:
tlock.release()
return _synchronizer return _synchronizer
return _synched return _synched
@ -466,12 +462,12 @@ class SMART_DEVICE_APP(DeviceConfig, DevicePlugin):
ans = select.select((self.listen_socket,), (), (), 0) ans = select.select((self.listen_socket,), (), (), 0)
if len(ans[0]) > 0: if len(ans[0]) > 0:
# timeout in 10 ms to detect rare case where the socket went # 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: try:
self.device_socket = None self.device_socket = None
self.listen_socket.settimeout(0.010) self.listen_socket.settimeout(0.010)
self.device_socket, ign = \ self.device_socket, ign = eintr_retry_call(
eintr_retry_call(self.listen_socket.accept) self.listen_socket.accept)
self.listen_socket.settimeout(None) self.listen_socket.settimeout(None)
self.device_socket.settimeout(None) self.device_socket.settimeout(None)
self.is_connected = True self.is_connected = True