Example #1
0
def fillWithNoise():
    fileServer = model.FileServer('', False)
    soundServer = model.SoundServer(False)
    database = model.Database(config.mongoConnect(), config.mongoDatabaseName())
    with open("white_noise.ogg", "rb") as soundfile:
        for i in range(1000000):
            model.simpleSubmit(
                {
                    'attribute1': ''.join(random.sample(string.lowercase, random.randint(3, 7))),
                    'attribute2': ''.join(random.sample(string.lowercase, random.randint(3, 7)))
                },
                soundfile, 
                fileServer, 
                soundServer, 
                database)
Example #2
0
File: web.py Project: hyps/soundex
import model
import config

from gevent import monkey; 
monkey.patch_all()
from bottle import route, run, template, request, abort, redirect, static_file


fileServer = model.FileServer(config.fileStorePath());
soundServer = model.SoundServer();
database = model.Database(config.mongoConnect(), config.mongoDatabaseName());

@route('/view/<skip:int>')
def view(skip):
    rows = [['file', 'attributes', 'transcriptions']]
    limit = 20
    for record in database.getRecords(skip, limit):
        if record.has_key('file'):
            rows.append(
                ['<a href="/soundfiles/{0}">play</a>'.format(record.get('file')), 
                 record.get('attributes'), 
                 record.get('transcriptions')])

    return template(
        'templates/view', 
        count = database.recordsCount(),
        rows = rows, 
        left = max(skip - limit, 0), 
        right = max(skip + limit, limit))

@route('/soundfiles/<filepath:path>')
Example #3
0
        'key': 'Lrzu8gKFu3Q9346pEgcE4eFBrFYsE95JS6Zsgecu6LFYa7yr2D',
        'code': 'USER00001',
        'firstName': 'jnpl',
        'lastName': 'onte',
        'email': '*****@*****.**'
    }, {
        'key': 'CUNcbvFasENq69kRpxx8femgLj4LUZDnYsAt7HYWFT7ZMjeuvL',
        'code': 'SPIDERMAN',
        'firstName': 'peter',
        'lastName': 'parker',
        'email': '*****@*****.**'
    }]


def seed(mongo):
    users = Users(mongo, True)

    document = users.saveAll(data())
    return document


if __name__ == '__main__':
    mongoClient = config.mongoConnect()

    print('start seed')

    document = seed(mongoClient)
    print(document)

    print('end seed')