Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/infoslicer/processing/Journal_Getter.py
blob: a4cb4f379887f68575639b486574f81bf006360b (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
# -*- coding: utf-8 -*-
# Copyright (C) Aneesh Dogra <lionaneesh@gmail.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# You should have received a copy of the GNU General Public License
# along with this library; if not, write to the Free Software
# Foundation, 51 Franklin Street, Suite 500 Boston, MA 02110-1335 USA

from sugar3.datastore import datastore

def get_starred_images():
    ''' Find all the Starred images in journal. '''
    images = []
    dsobjects, nobjects = datastore.find({'keep': '1'})
    print "Found %d starred images" % (nobjects,)
    for dsobj in dsobjects:
        if hasattr(dsobj, 'metadata') and 'mime_type' in dsobj.metadata and \
            dsobj.metadata['mime_type'][0:5] == 'image':
            if 'title' in dsobj.metadata:
                title = dsobj.metadata['title']
            else:
                title = ''
            images.append((str(dsobj.file_path), str(title)))

    return images