From b0766bd2cb38826bdefb64fdedac7c90fcd38d0e Mon Sep 17 00:00:00 2001 From: GRiker Date: Fri, 24 Jun 2011 06:26:46 -0600 Subject: [PATCH] Cleaned up diagnostics printing when not in DEBUG mode. --- src/calibre/devices/apple/driver.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/calibre/devices/apple/driver.py b/src/calibre/devices/apple/driver.py index 144aa607df..a3b1d05950 100644 --- a/src/calibre/devices/apple/driver.py +++ b/src/calibre/devices/apple/driver.py @@ -1211,7 +1211,8 @@ def _add_library_book(self,file, metadata): ''' windows assumes pythoncom wrapper ''' - self.log.info(" ITUNES._add_library_book()") + if DEBUG: + self.log.info(" ITUNES._add_library_book()") if isosx: added = self.iTunes.add(appscript.mactypes.File(file)) @@ -1335,7 +1336,8 @@ def _cover_to_thumb(self, path, metadata, db_added, lb_added, format): assumes pythoncom wrapper for db_added as of iTunes 9.2, iBooks 1.1, can't set artwork for PDF files via automation ''' - self.log.info(" ITUNES._cover_to_thumb()") + if DEBUG: + self.log.info(" ITUNES._cover_to_thumb()") thumb = None if metadata.cover: @@ -2489,7 +2491,8 @@ def _remove_from_device(self, cached_book): ''' Windows assumes pythoncom wrapper ''' - self.log.info(" ITUNES._remove_from_device()") + if DEBUG: + self.log.info(" ITUNES._remove_from_device()") if isosx: if DEBUG: self.log.info(" deleting '%s' from iDevice" % cached_book['title']) @@ -2616,7 +2619,8 @@ def title_sorter(self, title): def _update_epub_metadata(self, fpath, metadata): ''' ''' - self.log.info(" ITUNES._update_epub_metadata()") + if DEBUG: + self.log.info(" ITUNES._update_epub_metadata()") # Fetch plugboard updates metadata_x = self._xform_metadata_via_plugboard(metadata, 'epub') @@ -2983,7 +2987,8 @@ def _xform_metadata_via_plugboard(self, book, format): self.log.info(" tags: %s %s" % (book.tags, ">>> %s" % newmi.tags if book.tags != newmi.tags else '')) else: - self.log(" matching plugboard not found") + if DEBUG: + self.log(" matching plugboard not found") else: newmi = book