mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Apple driver: Fix a regression in 0.9.31 that could cause sending books to the device to hang
This commit is contained in:
commit
98f1649075
@ -320,7 +320,7 @@ class ITUNES(DriverBase):
|
|||||||
self.verbose = self.settings().extra_customization[self.DEBUG_LOGGING]
|
self.verbose = self.settings().extra_customization[self.DEBUG_LOGGING]
|
||||||
if self.verbose:
|
if self.verbose:
|
||||||
logger().info("%s.__init__():" % self.__class__.__name__)
|
logger().info("%s.__init__():" % self.__class__.__name__)
|
||||||
logger().info(" Debug logging enabled in iTunes plugin settings")
|
logger().info(" Debug logging enabled")
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def cache_dir(self):
|
def cache_dir(self):
|
||||||
@ -1288,7 +1288,7 @@ class ITUNES(DriverBase):
|
|||||||
logger().error(" failed to add '%s' to Device|Books" % metadata.title)
|
logger().error(" failed to add '%s' to Device|Books" % metadata.title)
|
||||||
raise UserFeedback("Unable to add '%s' in direct connect mode" % metadata.title,
|
raise UserFeedback("Unable to add '%s' in direct connect mode" % metadata.title,
|
||||||
details=None, level=UserFeedback.ERROR)
|
details=None, level=UserFeedback.ERROR)
|
||||||
self._wait_for_writable_metadata(added)
|
#self._wait_for_writable_metadata(added)
|
||||||
return added
|
return added
|
||||||
|
|
||||||
elif iswindows:
|
elif iswindows:
|
||||||
@ -1471,6 +1471,7 @@ class ITUNES(DriverBase):
|
|||||||
|
|
||||||
if self.verbose:
|
if self.verbose:
|
||||||
logger().info(" %s._cover_to_thumb()" % self.__class__.__name__)
|
logger().info(" %s._cover_to_thumb()" % self.__class__.__name__)
|
||||||
|
#logger().info("db_added: %s lb_added: %s" % (db_added, lb_added))
|
||||||
|
|
||||||
thumb = None
|
thumb = None
|
||||||
if metadata.cover:
|
if metadata.cover:
|
||||||
@ -1514,13 +1515,13 @@ class ITUNES(DriverBase):
|
|||||||
'''
|
'''
|
||||||
if lb_added:
|
if lb_added:
|
||||||
delay = 2.0
|
delay = 2.0
|
||||||
self._wait_for_writable_metadata(db_added, delay=delay)
|
|
||||||
|
|
||||||
# Wait for updatable artwork
|
# Wait for updatable artwork
|
||||||
attempts = 9
|
attempts = 9
|
||||||
while attempts:
|
while attempts:
|
||||||
try:
|
try:
|
||||||
lb_added.artworks[1].data_.set(cover_data)
|
lb_added.artworks[1].data_.set(cover_data)
|
||||||
|
break
|
||||||
except:
|
except:
|
||||||
attempts -= 1
|
attempts -= 1
|
||||||
time.sleep(delay)
|
time.sleep(delay)
|
||||||
@ -3229,6 +3230,11 @@ class ITUNES(DriverBase):
|
|||||||
if self.verbose:
|
if self.verbose:
|
||||||
logger().info(" %s._wait_for_writable_metadata()" % self.__class__.__name__)
|
logger().info(" %s._wait_for_writable_metadata()" % self.__class__.__name__)
|
||||||
|
|
||||||
|
if not db_added:
|
||||||
|
if self.verbose:
|
||||||
|
logger().info("called from %s() with null db_added" % sys._getframe(1).f_code.co_name)
|
||||||
|
return
|
||||||
|
|
||||||
attempts = 9
|
attempts = 9
|
||||||
while attempts:
|
while attempts:
|
||||||
try:
|
try:
|
||||||
|
@ -533,7 +533,7 @@ class libiMobileDevice():
|
|||||||
else:
|
else:
|
||||||
if self.verbose:
|
if self.verbose:
|
||||||
self.log(" could not open file")
|
self.log(" could not open file")
|
||||||
raise libiMobileDeviceIOException("could not open file '%s' for reading" % path)
|
raise libiMobileDeviceIOException("could not open file %s for reading" % repr(path))
|
||||||
|
|
||||||
return data
|
return data
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user