Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/src/carquinyol/datastore.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/carquinyol/datastore.py')
-rw-r--r--src/carquinyol/datastore.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/carquinyol/datastore.py b/src/carquinyol/datastore.py
index 82a6207..44df5a2 100644
--- a/src/carquinyol/datastore.py
+++ b/src/carquinyol/datastore.py
@@ -159,6 +159,12 @@ class DataStore(dbus.service.Object):
if not props.get('timestamp', ''):
props['timestamp'] = int(time.time())
+ if os.path.exists(file_path):
+ stat = os.stat(file_path)
+ props['filesize'] = stat.st_size
+ else:
+ props['filesize'] = 0
+
self._metadata_store.store(uid, props)
self._index_store.store(uid, props)
self._file_store.store(uid, file_path, transfer_ownership,
@@ -195,6 +201,12 @@ class DataStore(dbus.service.Object):
if not props.get('timestamp', ''):
props['timestamp'] = int(time.time())
+ if os.path.exists(file_path):
+ stat = os.stat(file_path)
+ props['filesize'] = stat.st_size
+ else:
+ props['filesize'] = 0
+
self._metadata_store.store(uid, props)
self._index_store.store(uid, props)