From 7b2a947a86b66612a9244d420d579dbfb76db5f3 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 1 Sep 2012 15:22:49 +0530 Subject: [PATCH] ... --- src/calibre/devices/mtp/driver.py | 2 ++ src/calibre/devices/mtp/filesystem_cache.py | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/calibre/devices/mtp/driver.py b/src/calibre/devices/mtp/driver.py index 385914a9c9..4b26e23ef8 100644 --- a/src/calibre/devices/mtp/driver.py +++ b/src/calibre/devices/mtp/driver.py @@ -129,6 +129,7 @@ class MTP_DEVICE(BASE): cached_metadata = bl[idx] del relpath_cache[relpath] if cached_metadata.size == mtp_file.size: + cached_metadata.datetime = mtp_file.last_modified.timetuple() debug('Using cached metadata for', '/'.join(mtp_file.full_path)) continue # No need to update metadata @@ -148,6 +149,7 @@ class MTP_DEVICE(BASE): '/'.join(mtp_file.full_path)) traceback.print_exc() book.size = mtp_file.size + book.datetime = mtp_file.last_modified.timetuple() # Remove books in the cache that no longer exist for idx in sorted(relpath_cache.itervalues(), reverse=True): diff --git a/src/calibre/devices/mtp/filesystem_cache.py b/src/calibre/devices/mtp/filesystem_cache.py index e4ef8ae898..6aab711199 100644 --- a/src/calibre/devices/mtp/filesystem_cache.py +++ b/src/calibre/devices/mtp/filesystem_cache.py @@ -14,7 +14,7 @@ from future_builtins import map from datetime import datetime from calibre import human_readable, prints, force_unicode -from calibre.utils.date import local_tz +from calibre.utils.date import local_tz, as_utc from calibre.utils.icu import sort_key, lower from calibre.ebooks import BOOK_EXTENSIONS @@ -40,6 +40,7 @@ class FileOrFolder(object): self.last_modified = datetime.fromtimestamp(md, local_tz) except: self.last_modified = datetime.fromtimestamp(0, local_tz) + self.last_modified = as_utc(self.last_modified) if self.storage_id not in self.all_storage_ids: raise ValueError('Storage id %s not valid for %s, valid values: %s'%(self.storage_id,