Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrés Ambrois <andresambrois@gmail.com>2010-07-02 06:36:56 (GMT)
committer Andrés Ambrois <andresambrois@gmail.com>2010-08-24 07:58:43 (GMT)
commit5e2ec829b70aba6c15b6780e4fbaebcbb562965f (patch)
treef297e89526bc60622a95936baf08454bb77904b4
parent688c84e1d6e00f4d7da040617d1883bc483a25f4 (diff)
Check filesize property on index rebuild.
This will ensure it gets set when upgrading from older datastores.
-rw-r--r--src/carquinyol/datastore.py8
1 files changed, 8 insertions, 0 deletions
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)