diff options
Diffstat (limited to 'src/carquinyol/datastore.py')
-rw-r--r-- | src/carquinyol/datastore.py | 8 |
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) |