Skip to content

Commit

Permalink
マニフェストのコンストラクトを修正 (#404)
Browse files Browse the repository at this point in the history
* マニフェストのコンストラクトを修正

* validate_assignmentを削除

Co-authored-by: takana-v <44311840+takana-v@users.noreply.github.com>
  • Loading branch information
Hiroshiba and takana-v authored May 14, 2022
1 parent 01f1fd2 commit cf1c95e
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 27 deletions.
6 changes: 1 addition & 5 deletions manifest_assets/base_info.json
Original file line number Diff line number Diff line change
@@ -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
}
3 changes: 0 additions & 3 deletions voicevox_engine/engine_manifest/EngineManifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
38 changes: 19 additions & 19 deletions voicevox_engine/engine_manifest/EngineManifestLoader.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit cf1c95e

Please sign in to comment.