Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/services/datastore/demodata.py
blob: 61e6a40ee82e4d43f810f868422b5495fb45a0de (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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
import time
import os

def insert_demo_data(data_store):
    home_dir = os.path.expanduser('~')
    journal_dir = os.path.join(home_dir, "Journal")
    if not os.path.exists(journal_dir):
        os.makedirs(journal_dir, 0755)

    data = [
        {   'file-path' : os.path.join(journal_dir, 'fishes_in_the_sea.rtf'),
            'object-type' : 'text',
            'date'    : str(time.time() - 100000),
            'title'   : 'Fishes in the Sea',
            'preview' : 'There are many fishes in the sea, and not only...',
            'icon'    : 'theme:object-text',
            'icon-color' : '#C2B00C,#785C78',
            'keep'    : '0',
            'buddies' : str([ { 'name'  : 'Marco',
                                'color' : '#C2B00C,#785C78' },
                              { 'name'  : 'Dan', 
                                'color' : '#75C228,#3A6E3A' } ])
        },
        {   'file-path' : os.path.join(journal_dir, 'my_cat_and_my_fishes.rtf'),
            'object-type' : 'text',
            'date'    : str(time.time() - 200000),
            'title'   : 'My cat and my fishes',
            'preview' : "Don't know why, but my cat looks to like my fishe...",
            'icon'    : 'theme:object-text',
            'icon-color' : '#C2B00C,#785C78',
            'keep'    : '1',
            'buddies' : str([ { 'name'  : 'Eben',
                                'color' : '#C2B00C,#785C78' },
                              { 'name'  : 'Dan', 
                                'color' : '#75C228,#3A6E3A' } ])
        },
        {   'file-path' : os.path.join(journal_dir, 'cat_browsing.hist'),
            'object-type' : 'link',
            'date'    : str(time.time() - 300000),
            'title'   : 'About cats',
            'preview' : "http://en.wikipedia.org/wiki/Cat",
            'icon'    : 'theme:object-link',
            'icon-color' : '#C2B00C,#785C78',
            'keep'    : '0',
            'buddies' : str([ { 'name'  : 'Dan',
                                'color' : '#C2B00C,#785C78' },
                              { 'name'  : 'Tomeu', 
                                'color' : '#75C228,#3A6E3A' } ])
        },
        {   'file-path' : os.path.join(journal_dir, 'our_school.jpeg'),
            'object-type' : 'picture',
            'date'    : str(time.time() - 400000),
            'title'   : 'Our school',
            'preview' : "Our school",
            'icon'    : 'theme:object-image',
            'icon-color' : '#C2B00C,#785C78',
            'keep'    : '0',
            'buddies' : str([ { 'name'  : 'Marco',
                                'color' : '#C2B00C,#785C78' },
                              { 'name'  : 'Eben', 
                                'color' : '#75C228,#3A6E3A' } ])
        },
        {   'file-path' : os.path.join(journal_dir, 'thai_story.abw'),
            'object-type' : 'text',
            'date'    : str(time.time() - 450000),
            'title'   : 'Thai history',
            'preview' : "The history of Thailand begins with the migration of the Thais from their ancestoral home in southern China into mainland southeast asia around the 10th century AD.",
            'icon'    : 'theme:object-text',
            'icon-color' : '#C2B00C,#785C78',
            'keep'    : '1',
            'buddies' : str([ { 'name'  : 'Marco',
                                'color' : '#C2B00C,#785C78' } ])
        },
        {   'file-path' : os.path.join(journal_dir, 'thai_prince.abw'),
            'object-type' : 'text',
            'date'    : str(time.time() - 450000),
            'title'   : 'The Thai Prince',
            'preview' : "Prince Dipangkara Rasmijoti of Thailand, (born 29 April 2005), is a member of the Thailand Royal Family, a grandson of King Bhumibol Adulyadej (Rama IX) of Thailand is the fifth son of Maha Vajiralongkorn, Crown Prince of Thailand.",
            'icon'    : 'theme:object-text',
            'icon-color' : '#C2B00C,#785C78',
            'keep'    : '0',
            'buddies' : str([ { 'name'  : 'Eben', 
                                'color' : '#75C228,#3A6E3A' } ])
        }
    ]
    for obj in data:
        data_store.create(obj)