def post(self, task_id, comment_id): """ Add a preview to given task. --- tags: - Tasks description: "Revision is automatically set: it is equal to last revision + 1." parameters: - in: path name: task_id required: True schema: type: UUID example: a24a6ea4-ce75-4665-a070-57453082c25 - in: path name: comment_id required: True schema: type: UUID example: a24a6ea4-ce75-4665-a070-57453082c25 responses: 201: description: Preview added to given task """ task = tasks_service.get_task(task_id) user_service.check_project_access(task["project_id"]) user_service.check_entity_access(task["entity_id"]) comment = tasks_service.get_comment(comment_id) tasks_service.get_task_status(comment["task_status_id"]) person = persons_service.get_current_user() preview_file = tasks_service.add_preview_file_to_comment( comment_id, person["id"], task_id) return preview_file, 201
def post(self, task_id, comment_id): task = tasks_service.get_task(task_id) user_service.check_project_access(task["project_id"]) comment = tasks_service.get_comment(comment_id) tasks_service.get_task_status(comment["task_status_id"]) person = persons_service.get_current_user() preview_file = tasks_service.add_preview_file_to_comment( comment_id, person["id"], task_id) return preview_file, 201
def post(self, task_id, comment_id, preview_file_id): task = tasks_service.get_task(task_id) user_service.check_project_access(task["project_id"]) tasks_service.get_comment(comment_id) person = persons_service.get_current_user() related_preview_file = files_service.get_preview_file(preview_file_id) preview_file = tasks_service.add_preview_file_to_comment( comment_id, person["id"], task_id, related_preview_file["revision"]) return preview_file, 201
def post(self, task_id, comment_id, preview_file_id): """ Add a preview to given comment. --- tags: - Tasks parameters: - in: path name: task_id required: True schema: type: UUID example: a24a6ea4-ce75-4665-a070-57453082c25 - in: path name: comment_id required: True schema: type: UUID example: a24a6ea4-ce75-4665-a070-57453082c25 - in: path name: preview_file_id required: True schema: type: UUID example: a24a6ea4-ce75-4665-a070-57453082c25 responses: 201: description: Preview added to given comment """ task = tasks_service.get_task(task_id) user_service.check_project_access(task["project_id"]) user_service.check_entity_access(task["entity_id"]) tasks_service.get_comment(comment_id) person = persons_service.get_current_user() related_preview_file = files_service.get_preview_file(preview_file_id) preview_file = tasks_service.add_preview_file_to_comment( comment_id, person["id"], task_id, related_preview_file["revision"]) return preview_file, 201
def post(self, task_id): person_id = self.get_arguments() gunicorn_logger.log(logging.ERROR, task_id) gunicorn_logger.log(logging.ERROR, person_id) task = tasks_service.get_task(task_id) working_file_name = re.sub( r'_v\d\d\d.\w\w\w', '', file_tree_service.get_working_file_name(task)) gunicorn_logger.log(logging.ERROR, working_file_name) next_revision = files_service.get_next_working_revision( task_id, working_file_name) working_file_path = file_tree_service.get_working_file_path( task, mode="working", revision=next_revision) working_file = files_service.create_new_working_revision( task_id, person_id, "edfd3a91-4d55-47a4-ae15-f2123c07edf6", working_file_name, working_file_path) comment = tasks_service.create_comment( task_id, '4f4256d0-72d9-4de5-bf71-a08209b56750', person_id, "Version %s created" % next_revision) preview_file = tasks_service.add_preview_file_to_comment( comment['id'], person_id, task_id, revision=next_revision) entities_service.update_entity_preview(task['entity_id'], preview_file['id']) output_preview_file_path = file_tree_service.get_working_file_path( task, mode="preview_output", revision=next_revision) output_slated_file_path = file_tree_service.get_working_file_path( task, mode="slated_output", revision=next_revision, frame="0001") movies_preview_file_path = '/opt/zou/previews/movies/previews/' + preview_file[ 'id'][:3] + '/' + preview_file['id'][3:6] + '/' pictures_original_file_path = '/opt/zou/previews/pictures/originals/' + preview_file[ 'id'][:3] + '/' + preview_file['id'][3:6] + '/' pictures_preview_file_path = '/opt/zou/previews/pictures/previews/' + preview_file[ 'id'][:3] + '/' + preview_file['id'][3:6] + '/' pictures_thumbnail_file_path = '/opt/zou/previews/pictures/thumbnails/' + preview_file[ 'id'][:3] + '/' + preview_file['id'][3:6] + '/' if not os.path.exists(movies_preview_file_path): os.makedirs(movies_preview_file_path) if not os.path.exists(pictures_original_file_path): os.makedirs(pictures_original_file_path) if not os.path.exists(pictures_preview_file_path): os.makedirs(pictures_preview_file_path) if not os.path.exists(pictures_thumbnail_file_path): os.makedirs(pictures_thumbnail_file_path) if not os.path.exists(os.path.dirname(working_file_path)): os.makedirs(os.path.dirname(working_file_path)) file = open(working_file_path, "w") file.close() os.symlink(output_preview_file_path, movies_preview_file_path + preview_file['id']) os.symlink(output_slated_file_path, pictures_original_file_path + preview_file['id']) os.symlink(output_slated_file_path, pictures_preview_file_path + preview_file['id']) os.symlink(output_slated_file_path, pictures_thumbnail_file_path + preview_file['id']) return working_file, 200