password = arguments['--password']

if login is None:
    login = raw_input('Login: '******'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'):
Beispiel #2
0
def initialize(url, username=None, password=None):

    if GLOBAL_DEBUG:
        debug('initialize')

    global GLOBAL_CLIENT

    global GLOBAL_CORPUS

    global GLOBAL_USERS
    global GLOBAL_GROUPS

    global GLOBAL_ME
    global GLOBAL_TEAM

    global GLOBAL_SUBMISSION_QUEUE

    # -------------------------------------------------------------------------
    # connect to Camomile server
    # -------------------------------------------------------------------------

    GLOBAL_CLIENT = Camomile(url)
    if username is None:
        username = raw_input('Login: '******'Unable to connect to %s with login %s' % (url, username))

    # -------------------------------------------------------------------------
    # find corpus identifier (development or test set)
    # -------------------------------------------------------------------------

    try:
        name = (CORPUS_NAME_DEV
                if GLOBAL_DEV_OR_TEST == "dev"
                else CORPUS_NAME_TEST)
        corpora = GLOBAL_CLIENT.getCorpora(name=name)
        GLOBAL_CORPUS = corpora[0]._id
    except Exception:
        reportErrorAndExit(
            'Unable to identify %s corpus.' % GLOBAL_DEV_OR_TEST)

    # -------------------------------------------------------------------------
    # get list of users and groups
    # -------------------------------------------------------------------------

    try:
        GLOBAL_GROUPS = GLOBAL_CLIENT.getGroups()
        GLOBAL_USERS = GLOBAL_CLIENT.getUsers()
    except Exception:
        reportErrorAndExit('Unable to obtain list of users and groups.')

    # -------------------------------------------------------------------------
    # get (supposedly unique) team of current user
    # -------------------------------------------------------------------------

    try:
        GLOBAL_TEAM = None
        userGroups = GLOBAL_CLIENT.getMyGroups()
        for group in GLOBAL_GROUPS:
            if group._id in userGroups and group.name.startswith('team_'):
                GLOBAL_TEAM = group
                break
    except Exception:
        pass

    if GLOBAL_TEAM is None:
        reportErrorAndExit('Unable to identify your team.')

    # -------------------------------------------------------------------------
    # identify submission queue
    # -------------------------------------------------------------------------

    if GLOBAL_DEBUG:
        debug('locate submission queue.')

    try:
        queues = [queue._id
                  for queue in GLOBAL_CLIENT.getQueues()
                  if queue.name == QUEUE_SUBMISSION]
        GLOBAL_SUBMISSION_QUEUE = queues[0]

    except Exception:
        reportErrorAndExit('Unable to locate submission queue.')