Пример #1
0
    def test_get_preview_file_name(self):
        preview_file = files_service.create_preview_file("main",
                                                         3,
                                                         self.shot_task["id"],
                                                         self.user["id"],
                                                         source="webgui")
        name = names_service.get_preview_file_name(preview_file["id"])
        self.assertEqual(name, "cosmos_landromat_e01_s01_p01_animation_v3.mp4")

        preview_file = files_service.create_preview_file("main",
                                                         3,
                                                         self.asset_task["id"],
                                                         self.user["id"],
                                                         source="webgui")
        name = names_service.get_preview_file_name(preview_file["id"])
        self.assertEqual(name, "cosmos_landromat_props_tree_shaders_v3.mp4")

        preview_file = files_service.create_preview_file(
            "main",
            4,
            self.asset_task["id"],
            self.user["id"],
            source="webgui",
            position=5,
        )
        name = names_service.get_preview_file_name(preview_file["id"])
        self.assertEqual(name, "cosmos_landromat_props_tree_shaders_v4-5.mp4")
Пример #2
0
    def post(self, task_id, comment_id):
        is_movie = self.get_arguments()

        task = tasks_service.get_task(task_id)
        if not permissions.has_manager_permissions():
            user_service.check_assigned(task_id)

        comment = tasks_service.get_comment(comment_id)
        task_status = tasks_service.get_task_status(comment.task_status_id)
        person = persons_service.get_current_user()

        if not task_status["is_reviewable"]:
            return {
                "error":
                "Comment status is not reviewable, you cannot link a "
                "preview to it."
            }, 400

        revision = tasks_service.get_next_preview_revision(task_id)
        preview = files_service.create_preview_file(task["name"], revision,
                                                    task["id"], person["id"],
                                                    is_movie)
        comment.update({"preview_file_id": preview["id"]})
        events.emit("preview:add", {
            "comment_id": comment_id,
            "task_id": task_id,
            "preview": preview
        })

        return preview, 201
Пример #3
0
    def post(self, task_id, comment_id):
        is_movie = self.get_arguments()

        task = tasks_service.get_task(task_id)
        user_service.check_project_access(task["project_id"])

        comment = tasks_service.get_comment_raw(comment_id)
        task_status = tasks_service.get_task_status(
            comment.task_status_id
        )
        person = persons_service.get_current_user()

        if not task_status["is_reviewable"]:
            return {
                "error": "Comment status is not reviewable, you cannot link a "
                         "preview to it."
            }, 400

        revision = tasks_service.get_next_preview_revision(task_id)
        preview = files_service.create_preview_file(
            task["name"],
            revision,
            task["id"],
            person["id"],
            is_movie
        )
        comment.update({"preview_file_id": preview["id"]})

        return preview, 201