コード例 #1
0
ファイル: services.py プロジェクト: dcaulton/thermal
def get_picture_objects_for_group(group_id):
    """
    Gets all the pictures belonging to a group, groups them in an array under the snaps they belong to
    """
    url_base = get_url_base()
    picture_links = []
    args_dict = {}
    snaps_dict = {}
    snaps = []
    args_dict["type"] = "picture"
    args_dict["group_id"] = group_id
    pictures_dict = get_documents_from_criteria(args_dict)
    for picture_id in pictures_dict:
        picture_link = url_base + url_for("picture.get_picture", picture_id=picture_id)
        snap_id = pictures_dict[picture_id]["snap_id"]
        if snap_id in snaps_dict:
            snaps_dict[snap_id]["picture_objects"].append(pictures_dict[picture_id])
        else:
            snaps_dict[snap_id] = {
                "created": pictures_dict[picture_id]["created"],
                "id": snap_id,
                "picture_objects": [pictures_dict[picture_id]],
            }
    snaps_array = snaps_dict.values()
    snaps_array.sort(key=lambda x: x["created"])
    return snaps_array
コード例 #2
0
def index():
    '''
    Lists top level endpoints for the merging app
    '''
    url_base = get_url_base()
    top_level_links = {
        'merge_images': url_base + url_for('merging.call_merge_images'),
    }
    return Response(json.dumps(top_level_links), status=200, mimetype='application/json')
コード例 #3
0
ファイル: views.py プロジェクト: dcaulton/thermal
def index():
    '''
    Lists top level endpoints for analysis
    '''
    url_base = get_url_base()
    top_level_links = { 
        'scale_image': url_base + url_for('analysis.call_scale_image'),
        'edge_detect': url_base + url_for('analysis.call_edge_detect'),
    }
    return Response(json.dumps(top_level_links), status=200, mimetype='application/json')
コード例 #4
0
ファイル: views.py プロジェクト: dcaulton/thermal
def index():
    '''
    Lists top level endpoints for camera
    '''
    url_base = get_url_base()
    top_level_links = {
        'picam_still': url_base + url_for('camera.picam_still'),
        'thermal_still': url_base + url_for('camera.thermal_still'),
        'both_still': url_base + url_for('camera.both_still'),
    }
    return Response(json.dumps(top_level_links), status=200, mimetype='application/json')
コード例 #5
0
ファイル: views.py プロジェクト: dcaulton/thermal
def index():
    '''
    Returns top level links to the 'get settings' and 'list groups' views 
    '''
    url_base = get_url_base()
    top_level_links = {
        'settings': url_base + url_for('admin.get_settings'),
        'snaps': url_base + url_for('admin.list_snaps'),
        'groups': url_base + url_for('admin.list_groups'),
    }
    return Response(json.dumps(top_level_links), status=200, mimetype='application/json')
コード例 #6
0
ファイル: views.py プロジェクト: dcaulton/thermal
def index():
    '''
    Lists top level endpoints for calibration
    '''
    url_base = get_url_base()
    top_level_links = { 
        'distortion_sets': url_base + url_for('calibration.list_distortion_sets'),
        'distortion_pairs': url_base + url_for('calibration.list_distortion_pairs'),
        'calibration_sessions': url_base + url_for('calibration.list_calibration_sessions'),
    }
    return Response(json.dumps(top_level_links), status=200, mimetype='application/json')
コード例 #7
0
ファイル: views.py プロジェクト: dcaulton/thermal
def index():
    url_base = get_url_base()
    top_level_links = {
        'admin': url_base + url_for('admin.index'),
        'camera': url_base + url_for('camera.index'),
        'pictures': url_base + url_for('picture.list_pictures'),
        'merging': url_base + url_for('merging.index'),
        'analysis': url_base + url_for('analysis.index'),
        'calibration': url_base + url_for('calibration.index'),
        'docs': url_base + '/docs/_build/html',
    }
    return Response(json.dumps(top_level_links), status=200, mimetype='application/json')
コード例 #8
0
ファイル: views.py プロジェクト: ibivibiv/thermal
def index():
    '''
    Lists top level endpoints for analysis
    '''
    url_base = get_url_base()
    top_level_links = {
        'scale_image': url_base + url_for('analysis.call_scale_image'),
        'edge_detect': url_base + url_for('analysis.call_edge_detect'),
    }
    return Response(json.dumps(top_level_links),
                    status=200,
                    mimetype='application/json')
コード例 #9
0
def index():
    '''
    Returns top level links to the 'get settings' and 'list groups' views 
    '''
    url_base = get_url_base()
    top_level_links = {
        'settings': url_base + url_for('admin.get_settings'),
        'snaps': url_base + url_for('admin.list_snaps'),
        'groups': url_base + url_for('admin.list_groups'),
    }
    return Response(json.dumps(top_level_links),
                    status=200,
                    mimetype='application/json')
コード例 #10
0
def index():
    '''
    Lists top level endpoints for camera
    '''
    url_base = get_url_base()
    top_level_links = {
        'picam_still': url_base + url_for('camera.picam_still'),
        'thermal_still': url_base + url_for('camera.thermal_still'),
        'both_still': url_base + url_for('camera.both_still'),
    }
    return Response(json.dumps(top_level_links),
                    status=200,
                    mimetype='application/json')
コード例 #11
0
def index():
    url_base = get_url_base()
    top_level_links = {
        'admin': url_base + url_for('admin.index'),
        'camera': url_base + url_for('camera.index'),
        'pictures': url_base + url_for('picture.list_pictures'),
        'merging': url_base + url_for('merging.index'),
        'analysis': url_base + url_for('analysis.index'),
        'calibration': url_base + url_for('calibration.index'),
        'docs': url_base + '/docs/_build/html',
    }
    return Response(json.dumps(top_level_links),
                    status=200,
                    mimetype='application/json')
コード例 #12
0
ファイル: services.py プロジェクト: ibivibiv/thermal
def get_picture_links_for_group(group_id):
    '''
    Gets all the pictures belonging to a given group id
    '''
    # TODO sort these ascending on time
    url_base = get_url_base()
    picture_links = []
    args_dict = {}
    args_dict['type'] = 'picture'
    args_dict['group_id'] = group_id
    pictures_dict = get_documents_from_criteria(args_dict)
    for picture_id in pictures_dict:
        picture_link = url_base + url_for('picture.get_picture', picture_id=picture_id)
        picture_links.append(picture_link)
    return picture_links
コード例 #13
0
ファイル: services.py プロジェクト: dcaulton/thermal
def get_picture_links_for_group(group_id):
    """
    Gets all the pictures belonging to a given group id
    """
    # TODO sort these ascending on time
    url_base = get_url_base()
    picture_links = []
    args_dict = {}
    args_dict["type"] = "picture"
    args_dict["group_id"] = group_id
    pictures_dict = get_documents_from_criteria(args_dict)
    for picture_id in pictures_dict:
        picture_link = url_base + url_for("picture.get_picture", picture_id=picture_id)
        picture_links.append(picture_link)
    return picture_links
コード例 #14
0
def index():
    '''
    Lists top level endpoints for calibration
    '''
    url_base = get_url_base()
    top_level_links = {
        'distortion_sets':
        url_base + url_for('calibration.list_distortion_sets'),
        'distortion_pairs':
        url_base + url_for('calibration.list_distortion_pairs'),
        'calibration_sessions':
        url_base + url_for('calibration.list_calibration_sessions'),
    }
    return Response(json.dumps(top_level_links),
                    status=200,
                    mimetype='application/json')
コード例 #15
0
ファイル: services.py プロジェクト: ibivibiv/thermal
def get_picture_objects_for_group(group_id):
    '''
    Gets all the pictures belonging to a group, groups them in an array under the snaps they belong to
    '''
    url_base = get_url_base()
    picture_links = []
    args_dict = {}
    snaps_dict = {}
    snaps = []
    args_dict['type'] = 'picture'
    args_dict['group_id'] = group_id
    pictures_dict = get_documents_from_criteria(args_dict)
    for picture_id in pictures_dict:
        picture_link = url_base + url_for('picture.get_picture', picture_id=picture_id)
        snap_id =  pictures_dict[picture_id]['snap_id']
        if snap_id in snaps_dict:
            snaps_dict[snap_id]['picture_objects'].append(pictures_dict[picture_id])
        else:
            snaps_dict[snap_id] = {'created': pictures_dict[picture_id]['created'],
                                   'id': snap_id,
                                   'picture_objects': [pictures_dict[picture_id]]}
    snaps_array = snaps_dict.values()
    snaps_array.sort(key=lambda x: x['created'])
    return snaps_array