blob: f5db68a982328e74eb9f7e7939cb70e1803abffa (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
from sugar.datastore import datastore
def load_journal_table():
"""
Carga la metadata del Diario de Sugar
Retorna una lista de objetos de datastore
"""
ds_mounts = datastore.mounts()
mountpoint_id = None
if len(ds_mounts) == 1 and ds_mounts[0]['id'] == 1:
query = { 'sorting':'timestamp', 'keep':'1' }
else:
# we're in sugar 0.82
query = { 'order_by':'-timestamp' }
for mountpoint in ds_mounts:
id = mountpoint['id']
uri = mountpoint['uri']
if uri.startswith('/home'):
mountpoint_id = id
if mountpoint_id is not None:
query['mountpoints'] = [ mountpoint_id ]
ds_objects, num_objects = datastore.find(
query, properties=['title_set_by_user','activity',
'title', 'mime_type', 'mtime', 'share-scope','uid',
'keep', 'tags', 'description'])
return ds_objects
if __name__ == '__main__':
for obj in load_journal_table():
print obj.metadata.get_dictionary()['title']
|