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'
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'
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'
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'
def checksum_detection_exists(checksum): response = {'result': get_model().checksum_detection_exists(checksum)} return Response(JSONEncoder().encode(response), mimetype='application/json')
def videos(camera_id): latest_videos = get_model().find_latest_videos(camera_id) return Response(JSONEncoder().encode(latest_videos), mimetype='application/json')
def video_details(checksum): video_dets = get_model().get_video_details(checksum) return Response(JSONEncoder().encode(video_dets), mimetype='application/json')
def camera_detection(camera_id): latest_detection = get_model().find_latest_detection(camera_id) return Response(JSONEncoder().encode(latest_detection), mimetype='application/json')