コード例 #1
0
def insert_video_detection():
    payload = request.get_json()
    if None in (payload['id'], payload['datetime'], payload['checksum'],
                payload['status']):
        return 'All args not specified'
    get_model().add_video_detection(payload)
    return 'Inserted'
コード例 #2
0
def insert_video_metadata():
    id = request.args.get('id')
    datetime = request.args.get('datetime')
    checksum = request.args.get('checksum')
    videoUrl = request.args.get('videoUrl')
    if None in (id, datetime, checksum, videoUrl):
        return 'All args not specified'

    db_object = {
        'id': id,
        'datetime': datetime,
        'checksum': checksum,
        'videoUrl': videoUrl
    }
    get_model().add_video_metadata(db_object)
    return 'Inserted'
コード例 #3
0
def update_jamcam_res():
    res = requests.get("https://api.tfl.gov.uk/Place/Type/JamCam").json()
    for camera in res:
        for property in camera['additionalProperties']:
            if property['key'] == 'videoUrl':
                property['checksum'], property['value'] = get_model(
                ).find_latest_video(camera['id'])
                break
    global JamCam_res
    JamCam_res = res
    print('Response object updated!')
    return 'Updated'
コード例 #4
0
def update_video_details():
    checksum = request.args.get('checksum')
    debug_url = request.args.get('debug_url')
    get_model().add_debug_video(checksum, debug_url)
    return 'Updated'
コード例 #5
0
def checksum_detection_exists(checksum):
    response = {'result': get_model().checksum_detection_exists(checksum)}
    return Response(JSONEncoder().encode(response),
                    mimetype='application/json')
コード例 #6
0
def videos(camera_id):
    latest_videos = get_model().find_latest_videos(camera_id)
    return Response(JSONEncoder().encode(latest_videos),
                    mimetype='application/json')
コード例 #7
0
def video_details(checksum):
    video_dets = get_model().get_video_details(checksum)
    return Response(JSONEncoder().encode(video_dets),
                    mimetype='application/json')
コード例 #8
0
def camera_detection(camera_id):
    latest_detection = get_model().find_latest_detection(camera_id)
    return Response(JSONEncoder().encode(latest_detection),
                    mimetype='application/json')