From 7f5b8c01e1efd0838d1f7fcc09b1bc40947436ac Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 6 Jul 2011 16:04:16 -0600 Subject: [PATCH] ... --- src/calibre/gui2/metadata/bulk_download.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/calibre/gui2/metadata/bulk_download.py b/src/calibre/gui2/metadata/bulk_download.py index 2a307fc902..3461da8666 100644 --- a/src/calibre/gui2/metadata/bulk_download.py +++ b/src/calibre/gui2/metadata/bulk_download.py @@ -20,6 +20,7 @@ from calibre.ebooks.metadata.sources.covers import download_cover from calibre.ebooks.metadata.book.base import Metadata from calibre.customize.ui import metadata_plugins from calibre.ptempfile import PersistentTemporaryFile +from calibre.utils.date import as_utc # Start download {{{ def show_config(gui, parent): @@ -124,10 +125,18 @@ def merge_result(oldmi, newmi): for plugin in metadata_plugins(['identify']): fields |= plugin.touched_fields + def is_equal(x, y): + if hasattr(x, 'tzinfo'): + x = as_utc(x) + if hasattr(y, 'tzinfo'): + y = as_utc(y) + return x == y + for f in fields: # Optimize so that set_metadata does not have to do extra work later if not f.startswith('identifier:'): - if (not newmi.is_null(f) and getattr(newmi, f) == getattr(oldmi, f)): + if (not newmi.is_null(f) and is_equal(getattr(newmi, f), + getattr(oldmi, f))): setattr(newmi, f, getattr(dummy, f)) newmi.last_modified = oldmi.last_modified