From 66b7082f5c738bce4789d368b39b2dfeb235a2f1 Mon Sep 17 00:00:00 2001 From: Hiroshiba Date: Sat, 14 May 2022 19:32:38 +0900 Subject: [PATCH 1/2] =?UTF-8?q?=E3=83=9E=E3=83=8B=E3=83=95=E3=82=A7?= =?UTF-8?q?=E3=82=B9=E3=83=88=E3=81=AE=E3=82=B3=E3=83=B3=E3=82=B9=E3=83=88?= =?UTF-8?q?=E3=83=A9=E3=82=AF=E3=83=88=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- manifest_assets/base_info.json | 6 +-- .../engine_manifest/EngineManifestLoader.py | 38 +++++++++---------- 2 files changed, 20 insertions(+), 24 deletions(-) diff --git a/manifest_assets/base_info.json b/manifest_assets/base_info.json index 5ff2fe36b..717ed0740 100644 --- a/manifest_assets/base_info.json +++ b/manifest_assets/base_info.json @@ -1,9 +1,5 @@ { "manifest_version": "0.12.0", "name": "dummy name", - "icon": "", - "default_sampling_rate": 24000, - "terms_of_service": "", - "update_infos": [], - "dependency_licenses": [] + "default_sampling_rate": 24000 } \ No newline at end of file diff --git a/voicevox_engine/engine_manifest/EngineManifestLoader.py b/voicevox_engine/engine_manifest/EngineManifestLoader.py index 82e94c422..60e40e1d8 100644 --- a/voicevox_engine/engine_manifest/EngineManifestLoader.py +++ b/voicevox_engine/engine_manifest/EngineManifestLoader.py @@ -11,24 +11,24 @@ def __init__(self, assets_dir: Path): def load_manifest(self) -> EngineManifest: manifest = EngineManifest( - **json.load((self.assets_dir / "base_info.json").open(encoding="utf-8")) + **json.load((self.assets_dir / "base_info.json").open(encoding="utf-8")), + icon=b64encode((self.assets_dir / "icon.png").read_bytes()).decode("utf-8"), + terms_of_service=(self.assets_dir / "terms_of_service.md").read_text( + encoding="utf-8" + ), + update_infos=[ + UpdateInfo(**update_info) + for update_info in json.load( + (self.assets_dir / "update_infos.json").open(encoding="utf-8") + ) + ], + dependency_licenses=[ + LicenseInfo(**license_info) + for license_info in json.load( + (self.assets_dir / "dependency_licenses.json").open( + encoding="utf-8" + ) + ) + ], ) - manifest.icon = b64encode((self.assets_dir / "icon.png").read_bytes()).decode( - "utf-8" - ) - manifest.terms_of_service = (self.assets_dir / "terms_of_service.md").read_text( - encoding="utf-8" - ) - manifest.update_infos = [ - UpdateInfo(**update_info) - for update_info in json.load( - (self.assets_dir / "update_infos.json").open(encoding="utf-8") - ) - ] - manifest.dependency_licenses = [ - LicenseInfo(**license_info) - for license_info in json.load( - (self.assets_dir / "dependency_licenses.json").open(encoding="utf-8") - ) - ] return manifest From bbd358793d315e1d54588f99ff3d61c3d72c450e Mon Sep 17 00:00:00 2001 From: takana-v <44311840+takana-v@users.noreply.github.com> Date: Sat, 14 May 2022 19:45:34 +0900 Subject: [PATCH 2/2] =?UTF-8?q?validate=5Fassignment=E3=82=92=E5=89=8A?= =?UTF-8?q?=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- voicevox_engine/engine_manifest/EngineManifest.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/voicevox_engine/engine_manifest/EngineManifest.py b/voicevox_engine/engine_manifest/EngineManifest.py index 90dd848bb..5d78a5d82 100644 --- a/voicevox_engine/engine_manifest/EngineManifest.py +++ b/voicevox_engine/engine_manifest/EngineManifest.py @@ -36,6 +36,3 @@ class EngineManifest(BaseModel): terms_of_service: str = Field(title="エンジンの利用規約") update_infos: List[UpdateInfo] = Field(title="エンジンのアップデート情報") dependency_licenses: List[LicenseInfo] = Field(title="依存関係のライセンス情報") - - class Config: - validate_assignment = True