From f3f71c3dad6fdf3b69b3624a6a584002c4c4fb28 Mon Sep 17 00:00:00 2001 From: Andrés Ambrois Date: Fri, 02 Jul 2010 06:36:56 +0000 Subject: Check filesize property on index rebuild. This will ensure it gets set when upgrading from older datastores. --- diff --git a/src/carquinyol/datastore.py b/src/carquinyol/datastore.py index 44df5a2..2c0a7f0 100644 --- a/src/carquinyol/datastore.py +++ b/src/carquinyol/datastore.py @@ -121,7 +121,15 @@ class DataStore(dbus.service.Object): if not self._index_store.contains(uid): try: + update_metadata = False props = self._metadata_store.retrieve(uid) + if 'filesize' not in props: + path = self._file_store.get_file_path(uid) + if os.path.exists(path): + props['filesize'] = os.stat(path).st_size + update_metadata = True + if update_metadata: + self._metadata_store.store(uid, props) self._index_store.store(uid, props) except Exception: logging.exception('Error processing %r', uid) -- cgit v0.9.1