MCPcopy
hub / github.com/diffgram/diffgram / interpolate_api

Function interpolate_api

walrus/methods/video/interpolation.py:450–505  ·  view source on GitHub ↗

Uses new permission through regular list system (that way can support the multiple permissions ie task / project)

(task_id)

Source from the content-addressed store, hash-verified

448@routes.route('/api/walrus/video/interpolate',
449 methods = ['POST'])
450def interpolate_api(task_id):
451 """
452 Uses new permission through regular list system
453 (that way can support the multiple permissions ie task / project)
454 """
455
456 spec_list = [
457 {"task_id":
458 {
459 'kind': int,
460 'permission': 'task'
461 }
462 },
463 {"file_id":
464 {
465 'kind': int,
466 'permission': 'project'
467 }
468 },
469 {"sequence_id":
470 {
471 'kind': int,
472 }
473 }]
474
475 log, input, untrusted_input = regular_input.master(request = request,
476 spec_list = spec_list)
477 if len(log["error"].keys()) >= 1:
478 return jsonify(log = log), 400
479
480 with sessionMaker.session_scope() as session:
481
482 task = Task.get_by_id(
483 session = session,
484 task_id = task_id)
485
486 # TODO get get file by id untrusted (can't remember the name)
487 try:
488 file = File.get_by_id_untrusted(
489 project_string_id = task.project.project_string_id,
490 file_id = task.file.id,
491 with_for_update = True,
492 nowait = True
493 )
494 except Exception as e:
495 trace = traceback.format_exc()
496 logger.error(f"File {task.file.id} is Locked")
497 logger.error(trace)
498 log['error']['file_locked'] = 'File is being saved by another process, please try again later.'
499 return jsonify(log), 400
500 if file.type != "video":
501 return "File is not a video", 400
502
503 # TODO get sequence
504
505 return interpolate_api_shared(session, log, task.project, file)
506
507

Callers

nothing calls this directly

Calls 3

interpolate_api_sharedFunction · 0.85
get_by_id_untrustedMethod · 0.80
get_by_idMethod · 0.45

Tested by

no test coverage detected