From 59220b0aed2381eca416ce4788c1c8ac32ab6222 Mon Sep 17 00:00:00 2001 From: GRiker Date: Fri, 18 Jan 2013 06:59:54 -0700 Subject: [PATCH 1/4] Cleaned up ITUNES driver diagnostics --- src/calibre/devices/apple/driver.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/calibre/devices/apple/driver.py b/src/calibre/devices/apple/driver.py index eacb143790..e6932c6850 100644 --- a/src/calibre/devices/apple/driver.py +++ b/src/calibre/devices/apple/driver.py @@ -7,7 +7,7 @@ __docformat__ = 'restructuredtext en' import cStringIO, ctypes, datetime, os, platform, re, shutil, sys, tempfile, time -from calibre.constants import __appname__, __version__, DEBUG +from calibre.constants import __appname__, __version__, DEBUG as CALIBRE_DEBUG from calibre import fit_image, confirm_config_name, strftime as _strftime from calibre.constants import isosx, iswindows from calibre.devices.errors import OpenFeedback, UserFeedback @@ -20,6 +20,8 @@ from calibre.utils.config import config_dir, dynamic, prefs from calibre.utils.date import now, parse_date from calibre.utils.zipfile import ZipFile +DEBUG = False +#DEBUG = CALIBRE_DEBUG def strftime(fmt='%Y/%m/%d %H:%M:%S', dt=None): @@ -881,8 +883,9 @@ class ITUNES(DriverBase): logger().info(" %s" % self.UNSUPPORTED_DIRECT_CONNECT_MODE_MESSAGE) # Log supported DEVICE_IDs and BCDs - logger().info(" BCD: %s" % ['0x%x' % x for x in sorted(self.BCD)]) - logger().info(" PRODUCT_ID: %s" % ['0x%x' % x for x in sorted(self.PRODUCT_ID)]) + if DEBUG: + logger().info(" BCD: %s" % ['0x%x' % x for x in sorted(self.BCD)]) + logger().info(" PRODUCT_ID: %s" % ['0x%x' % x for x in sorted(self.PRODUCT_ID)]) # Confirm/create thumbs archive if not os.path.exists(self.cache_dir): @@ -1667,7 +1670,8 @@ class ITUNES(DriverBase): except: self.manual_sync_mode = False - logger().info(" iTunes.manual_sync_mode: %s" % self.manual_sync_mode) + if DEBUG: + logger().info(" iTunes.manual_sync_mode: %s" % self.manual_sync_mode) def _dump_booklist(self, booklist, header=None, indent=0): ''' From be2315d9513d72cc8cbfe31f4fc0546415a85262 Mon Sep 17 00:00:00 2001 From: GRiker Date: Wed, 23 Jan 2013 13:02:24 -0700 Subject: [PATCH 2/4] Disabled extraneous DEBUG message in shutdown() --- src/calibre/devices/apple/driver.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/calibre/devices/apple/driver.py b/src/calibre/devices/apple/driver.py index e6932c6850..24ff0c7389 100644 --- a/src/calibre/devices/apple/driver.py +++ b/src/calibre/devices/apple/driver.py @@ -1032,7 +1032,7 @@ class ITUNES(DriverBase): self.plugboard_func = pb_func def shutdown(self): - if DEBUG: + if False and DEBUG: logger().info("%s.shutdown()\n" % self.__class__.__name__) def sync_booklists(self, booklists, end_session=True): From 7b293d3caacb00dbedc5b92b7959a6f2d39282fe Mon Sep 17 00:00:00 2001 From: GRiker Date: Wed, 23 Jan 2013 13:34:16 -0700 Subject: [PATCH 3/4] Provisional patch for relocated cache dir. Not fully tested. --- src/calibre/devices/apple/driver.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/calibre/devices/apple/driver.py b/src/calibre/devices/apple/driver.py index 55056238e6..d3fbaed121 100644 --- a/src/calibre/devices/apple/driver.py +++ b/src/calibre/devices/apple/driver.py @@ -9,7 +9,7 @@ import cStringIO, ctypes, datetime, os, platform, re, shutil, sys, tempfile, tim from calibre.constants import __appname__, __version__, DEBUG as CALIBRE_DEBUG from calibre import fit_image, confirm_config_name, strftime as _strftime -from calibre.constants import isosx, iswindows +from calibre.constants import isosx, iswindows, cache_dir as _cache_dir from calibre.devices.errors import OpenFeedback, UserFeedback from calibre.devices.usbms.deviceconfig import DeviceConfig from calibre.devices.interface import DevicePlugin @@ -291,6 +291,8 @@ class ITUNES(DriverBase): # Properties cached_books = {} + cache_dir = os.path.join(_cache_dir(), 'itunes') + archive_path = os.path.join(cache_dir, "thumbs.zip") calibre_library_path = prefs['library_path'] description_prefix = "added by calibre" ejected = False @@ -885,8 +887,6 @@ class ITUNES(DriverBase): logger().info(" BCD: %s" % ['0x%x' % x for x in sorted(self.BCD)]) logger().info(" PRODUCT_ID: %s" % ['0x%x' % x for x in sorted(self.PRODUCT_ID)]) - self.cache_dir = os.path.join(cache_dir(), 'itunes') - self.archive_path = os.path.join(self.cache_dir, "thumbs.zip") # Confirm/create thumbs archive if not os.path.exists(self.cache_dir): if DEBUG: From 5f6cfb3f2dec1efd5b0f228b268d25310ca2afd8 Mon Sep 17 00:00:00 2001 From: GRiker Date: Fri, 25 Jan 2013 04:37:24 -0700 Subject: [PATCH 4/4] Added local DEBUG option to disable ITUNES diagnostics while iDevice is connected --- src/calibre/devices/apple/driver.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/calibre/devices/apple/driver.py b/src/calibre/devices/apple/driver.py index f82cf08f0f..2ab9a11daa 100644 --- a/src/calibre/devices/apple/driver.py +++ b/src/calibre/devices/apple/driver.py @@ -7,7 +7,7 @@ __docformat__ = 'restructuredtext en' import cStringIO, ctypes, datetime, os, platform, re, shutil, sys, tempfile, time -from calibre.constants import __appname__, __version__, DEBUG as CALIBRE_DEBUG +from calibre.constants import __appname__, __version__, cache_dir, DEBUG as CALIBRE_DEBUG from calibre import fit_image, confirm_config_name, strftime as _strftime from calibre.constants import isosx, iswindows, cache_dir as _cache_dir from calibre.devices.errors import OpenFeedback, UserFeedback