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 Aleksey Lim <alsroot@member.fsf.org>2010-08-24 16:01:47 (GMT)
commitf3f71c3dad6fdf3b69b3624a6a584002c4c4fb28 (patch)
treef297e89526bc60622a95936baf08454bb77904b4
parent089ba387eafec10734ce3023665a163c531b82b4 (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)