Ejemplo n.º 1
0
    outQueueEvidence = Config.get('ressourceSection', 'outQueueEvidence')

    client = Camomile(server)
    client.login(userAdmin, pwdAdmin)

    # create queue
    id_queueIn = client.createQueue(inQueueEvidence, returns_id=True)
    id_queueOut = client.createQueue(outQueueEvidence, returns_id=True)

    id_corpus = client.getCorpora(corpusName, returns_id=True)
    if id_corpus == []:
        print args['<corpusName>'], 'is not found in the database'
        sys.exit(0)
    id_corpus = id_corpus[0]

    id_layerEvidence = client.getLayers(corpus=id_corpus, name=submissionName+".evidence", returns_id=True)
    if id_layerEvidence == []:
        print shotLayerName, 'is not found in the database'
        sys.exit(0)
    id_layerEvidence = id_layerEvidence[0]

    # add annotation in inQueue
    le = []
    for media in client.getMedia(corpus=id_corpus):
        for a in client.getAnnotations(layer=id_layerEvidence, medium=media['_id']):
            shot = client.getAnnotation(a['fragment'])
            e = {"fragment":{"id_medium": media['_id'], "start":shot['fragment']['segment']['start'] , "end":shot['fragment']['segment']['end'] },
                 "data":{"person_name": a['data']['person_name'], "source": a['data']['source']},
                 "id_evidence": id_layerEvidence
                }
            le.append(e)
    password = getpass()

client = Camomile(url)
client.login(login, password)

# test corpus
test = client.getCorpora(name = 'mediaeval.test', returns_id=True)[0]

# teams
teams = {team._id: team.name
         for team in client.getGroups()
         if team.name.startswith('team_') or team.name == 'organizer'}

media = {medium._id: medium.name for medium in client.getMedia(test)}

shotLayer = client.getLayers(test, name='mediaeval.submission_shot')[0]._id

print "get the shot number"
shots = {}
for a in client.getAnnotations(shotLayer):
    shots.setdefault(a.id_medium, {})
    shots[a.id_medium][a._id] = a.fragment.shot_number

# evaluate every original submissions
for labelLayer in client.getLayers(
        test, data_type='mediaeval.persondiscovery.label'):

    # we are only looking for original submissions (not copies)
    if 'copy' in labelLayer.description:
        continue
Ejemplo n.º 3
0
    shotLayerName = Config.get('ressourceSection', 'shotLayerName')    
    submissionName = Config.get('ressourceSection', 'submissionName')
    labelFile = Config.get('ressourceSection', 'label')
    evidenceFile = Config.get('ressourceSection', 'evidence')

    client = Camomile(server)
    client.login(user1, pwdUser1)
    
    # find id corpus and id layer
    id_corpus = client.getCorpora(corpusName, returns_id=True)
    if id_corpus == []:
        print args['<corpusName>'], 'is not found in the database'
        sys.exit(0)
    id_corpus = id_corpus[0]

    id_layer = client.getLayers(corpus=id_corpus, name=shotLayerName, returns_id=True)
    if id_layer == []:
        print shotLayerName, 'is not found in the database'
        sys.exit(0)
    id_layer = id_layer[0]

    
    # create layer
    id_layer_label = client.createLayer(id_corpus, 
                                        submissionName+".label",
                                        description={"id_label": "", "submission": "primary", "status": "workInProgress"},
                                        fragment_type='mediaeval.persondiscovery._id_shot',
                                        data_type='mediaeval.persondiscovery.evidence',
                                        returns_id=True)

    id_layer_evidence = client.createLayer(id_corpus, 
Ejemplo n.º 4
0
    server = Config.get('mainSection', 'url')+":"+Config.get('mainSection', 'port')
    userAdmin = Config.get('userSection', 'userAdmin')
    pwdAdmin = Config.get('userSection', 'pwdAdmin')
    user1 = Config.get('userSection', 'user1')
    pwdUser1 = Config.get('userSection', 'pwdUser1')
    roleUser1 = Config.get('userSection', 'roleUser1')
    corpusName = Config.get('ressourceSection', 'corpusName')
    shotLayerName = Config.get('ressourceSection', 'shotLayerName')    

    client = Camomile(server)
    client.login(userAdmin, pwdAdmin)

    id_corpus = client.getCorpora(name=corpusName, returns_id=True)
    if id_corpus == []:
        print corpusName, 'is not found in the database'
        sys.exit(0)
    id_corpus = id_corpus[0]

    id_layer = client.getLayers(name=shotLayerName, returns_id=True)
    if id_layer == []:
        print shotLayerName, 'is not found in the database'
        sys.exit(0)
    id_layer = id_layer[0]

    id_user = client.createUser(user1, pwdUser1, role=roleUser1, returns_id=True)

    client.setCorpusRights(id_corpus, client.ADMIN, user=id_user)
    client.setLayerRights(id_layer, client.READ, user=id_user)

Ejemplo n.º 5
0
if __name__ == '__main__':
	# read config
    Config = ConfigParser.ConfigParser()
    Config.read("config.ini")

    server = Config.get('mainSection', 'url')+":"+Config.get('mainSection', 'port')
    corpusName = Config.get('ressourceSection', 'corpusName')

    userAdmin = sys.argv[1]
    pwdAdmin = sys.argv[2]

    client = Camomile(server)
    client.login(userAdmin, pwdAdmin)

    id_corpus = client.getCorpora(name=corpusName, returns_id=True)
    if id_corpus == []:
        print corpusName, 'is not found in the database'
        sys.exit(0)
    id_corpus = id_corpus[0]


    users = client.getUsers()
    layers = client.getLayers()
    
	for u in users:
		if u.role == 'user':
			for l in layers:
				client.setLayerPermissions(layer=l._id, permission=client.WRITE, user=u._id)

Ejemplo n.º 6
0
    # read config
    Config = ConfigParser.ConfigParser()
    Config.read("config.ini")

    server = Config.get('mainSection', 'url')+":"+Config.get('mainSection', 'port')
    userAdmin = Config.get('userSection', 'userAdmin')
    pwdAdmin = Config.get('userSection', 'pwdAdmin')

    client = Camomile(server)
    client.login(userAdmin, pwdAdmin)

    
    count = 0
    deleted = 0

    for l in client.getLayers():
        # if "annotateur" in l.name:
        print l.name
        annotations = client.getAnnotations(l._id)
        print('annotations : %d' % len(annotations))

        # tmp = [[(u'start', a['fragment']['start']), (u'end', a['fragment']['end']), (u'data', a['data'])] for a in annotations]
        # tmp = []
        # for a in annotations:
        #     tmp.append({'start': a['fragment']['start'], 'end': a['fragment']['end'], u'data': a['data']})

        tmp = [{'start': a['fragment']['start'], 'end': a['fragment']['end'], u'data': a['data'], 'id_medium': a['id_medium']} for a in annotations]

        cleaned = [dict(t) for t in set([tuple(d.items()) for d in tmp])]

        seen = set()