def get_full_entity_name(entity_id): """ Get full entity name whether it's an asset or a shot. If it's a shot the result is "Episode name / Sequence name / Shot name". If it's an asset the result is "Asset type name / Asset name". """ entity = entities_service.get_entity(entity_id) episode_id = None if shots_service.is_shot(entity): sequence = entities_service.get_entity(entity["parent_id"]) if sequence["parent_id"] is None: name = "%s / %s" % (sequence["name"], entity["name"]) else: episode = entities_service.get_entity(sequence["parent_id"]) episode_id = episode["id"] name = "%s / %s / %s" % ( episode["name"], sequence["name"], entity["name"], ) else: asset_type = entities_service.get_entity_type(entity["entity_type_id"]) episode_id = entity["source_id"] name = "%s / %s" % (asset_type["name"], entity["name"]) return (name, episode_id)
def get_folder_from_temporal_entity_type(entity): if entity is not None: entity_type = entities_service.get_entity_type(entity["entity_type_id"]) folder = entity_type["name"].lower() else: raise MalformedFileTreeException("Given temporal entity type is null.") return folder
def get_full_task(task_id): task = get_task_with_relations(task_id) task_type = get_task_type(task["task_type_id"]) project = projects_service.get_project(task["project_id"]) task_status = get_task_status(task["task_status_id"]) entity = entities_service.get_entity(task["entity_id"]) entity_type = entities_service.get_entity_type(entity["entity_type_id"]) assignees = [ persons_service.get_person(assignee_id) for assignee_id in task["assignees"] ] task.update({ "entity": entity, "task_type": task_type, "task_status": task_status, "project": project, "entity_type": entity_type, "persons": assignees, "type": "Task", }) try: assigner = persons_service.get_person(task["assigner_id"]) task["assigner"] = assigner except PersonNotFoundException: pass if entity["parent_id"] is not None: if entity_type["name"] == "Edit": episode_id = entity["parent_id"] else: sequence = shots_service.get_sequence(entity["parent_id"]) task["sequence"] = sequence episode_id = sequence["parent_id"] if episode_id is not None: episode = shots_service.get_episode(episode_id) task["episode"] = episode return task
def get(self, task_id): task = tasks_service.get_task(task_id) if not permissions.has_manager_permissions(): user_service.check_has_task_related(task["project_id"]) task_type = tasks_service.get_task_type(task["task_type_id"]) project = projects_service.get_project(task["project_id"]) task_status = tasks_service.get_task_status(task["task_status_id"]) entity = entities_service.get_entity(task["entity_id"]) entity_type = entities_service.get_entity_type( entity["entity_type_id"]) assignees = [] for assignee_id in task["assignees"]: assignees.append(persons_service.get_person(assignee_id)) task.update({ "entity": entity, "task_type": task_type, "task_status": task_status, "project": project, "entity_type": entity_type, "persons": assignees, "type": "Task" }) try: assigner = persons_service.get_person(task["assigner_id"]) task["assigner"] = assigner except PersonNotFoundException: pass if entity["parent_id"] is not None: sequence = shots_service.get_sequence(entity["parent_id"]) task["sequence"] = sequence if sequence["parent_id"] is not None: episode = shots_service.get_episode(sequence["parent_id"]) task["episode"] = episode return task, 200
def test_get_entity_type(self): entity_type = entities_service.get_entity_type(self.asset_type.id) self.assertEquals(entity_type, self.asset_type.serialize())
def get_camera_type(): return entities_service.get_entity_type("Camera")
def get_scene_type(): return entities_service.get_entity_type("Scene")
def get_shot_type(): return entities_service.get_entity_type("Shot")
def get_sequence_type(): return entities_service.get_entity_type("Sequence")
def get_episode_type(): return entities_service.get_entity_type("Episode")