This repository has been archived by the owner on Sep 19, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #21 from RaenonX-DL/dev
v1.0.0 Release
- Loading branch information
Showing
68 changed files
with
2,204 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,159 @@ | ||
{ | ||
"$schema": "https://json-schema.org/draft/2020-12/schema", | ||
"$id": "https://raw.githubusercontent.com/RaenonX-DL/dragalia-asset-downloader-2/main/config.schema.json", | ||
"title": "Dragalia Lost Asset Downloader Config Schema", | ||
"description": "JSON Schema for the asset downloader config.", | ||
"type": "object", | ||
"properties": { | ||
"paths": { | ||
"type": "object", | ||
"description": "Various I/O paths.", | ||
"properties": { | ||
"downloaded": { | ||
"type": "string", | ||
"description": "Root directory for storing the downloaded/unextracted assets." | ||
}, | ||
"lib": { | ||
"type": "string", | ||
"description": "Root directory for the external libraries." | ||
}, | ||
"export": { | ||
"type": "string", | ||
"description": "Root directory for the exported files." | ||
}, | ||
"index": { | ||
"type": "string", | ||
"description": "Root directory for the indexing files." | ||
}, | ||
"log": { | ||
"type": "string", | ||
"description": "Root directory for the log files." | ||
} | ||
}, | ||
"required": [ | ||
"downloaded", | ||
"lib", | ||
"export", | ||
"index", | ||
"log" | ||
], | ||
"additionalProperties": false | ||
}, | ||
"assets": { | ||
"type": "array", | ||
"description": "Asset exporting tasks.", | ||
"items": { | ||
"type": "object", | ||
"description": "A single asset exporting task. Note that the objects will be exported only if it pass all the regex tests in its task.", | ||
"properties": { | ||
"task": { | ||
"type": "string", | ||
"description": "Name of the asset exporting task." | ||
}, | ||
"name": { | ||
"type": "string", | ||
"description": "Regex of the asset name to export. This has to be a full match. Note that the dependency assets of a main asset selected by a task always pass this test." | ||
}, | ||
"type": { | ||
"type": "string", | ||
"description": "Type of the export task.", | ||
"enum": [ | ||
"MonoBehaviour", | ||
"GameObject", | ||
"AnimatorController", | ||
"AnimatorOverrideController", | ||
"Texture2D", | ||
"Texture2D-Alpha", | ||
"Texture2D-Story", | ||
"Sprite" | ||
] | ||
}, | ||
"filter": { | ||
"type": "array", | ||
"description": "Export the objects that pass one of these filters and all the conditions of a filter. Note that these filters are only apply to the main asset. Dependency assets always pass the tests unless it is selected as main assets.", | ||
"items": { | ||
"type": "object", | ||
"description": "A single filter. Objects that pass all conditions of a filter will be exported.", | ||
"properties": { | ||
"container": { | ||
"type": "string", | ||
"description": "Regex test for the container name. This can be a partial match." | ||
}, | ||
"name": { | ||
"type": "string", | ||
"description": "Regex test for the object name. This can be a partial match." | ||
} | ||
}, | ||
"required": [ | ||
"container" | ||
], | ||
"additionalProperties": false | ||
}, | ||
"minItems": 1, | ||
"uniqueItems": true | ||
}, | ||
"isMultiLocale": { | ||
"type": "boolean", | ||
"description": "If true, the task will perform on all locale. Otherwise, the task only perform on the master (JP) locale.", | ||
"default": false | ||
}, | ||
"suppressWarnings": { | ||
"type": "array", | ||
"description": "Types of warning message to suppress.", | ||
"items": { | ||
"type": "string", | ||
"description": "Warning message type to suppress.", | ||
"enum": [ | ||
"nothingToExport", | ||
"noMainTexture" | ||
] | ||
} | ||
} | ||
}, | ||
"required": [ | ||
"task", | ||
"name", | ||
"type", | ||
"filter" | ||
], | ||
"additionalProperties": false | ||
}, | ||
"uniqueItems": true | ||
}, | ||
"raw": { | ||
"type": "array", | ||
"description": "Raw asset exporting tasks.", | ||
"items": { | ||
"type": "object", | ||
"description": "A single raw asset exporting task. Note that the objects will be exported only if it pass all the regex tests in its task.", | ||
"properties": { | ||
"task": { | ||
"type": "string", | ||
"description": "Name of the raw asset exporting task." | ||
}, | ||
"name": { | ||
"type": "string", | ||
"description": "Regex of the asset name to export. This has to be a full match." | ||
}, | ||
"isMultiLocale": { | ||
"type": "boolean", | ||
"description": "If true, the task will perform on all locale. Otherwise, the task only perform on the master (JP) locale.", | ||
"default": false | ||
} | ||
}, | ||
"required": [ | ||
"task", | ||
"name" | ||
], | ||
"additionalProperties": false | ||
}, | ||
"uniqueItems": true | ||
} | ||
}, | ||
"required": [ | ||
"paths", | ||
"assets", | ||
"raw" | ||
], | ||
"additionalProperties": false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
paths: | ||
downloaded: .exclude/downloaded | ||
lib: lib | ||
export: .exclude/media | ||
index: .exclude/index | ||
log: .exclude/logs | ||
|
||
assets: | ||
- task: Master Assets (all) | ||
name: master | ||
type: MonoBehaviour | ||
filter: | ||
- container: /resources/master/ | ||
|
||
- task: Master Assets (text label) | ||
name: master | ||
type: MonoBehaviour | ||
filter: | ||
- container: /resources/master/textlabel | ||
isMultiLocale: true | ||
|
||
- task: Action Scripts | ||
name: actions | ||
type: GameObject | ||
filter: | ||
- container: /resources/actions/ | ||
|
||
- task: Action Parts List | ||
name: actions | ||
type: MonoBehaviour | ||
filter: | ||
- container: /resources/actions/actionpartslist | ||
|
||
- task: Animation Data (Base Controller) | ||
name: ((characters|dragon)/motion/|meshes/dragon) | ||
type: AnimatorController | ||
filter: | ||
- container: /resources/characters/motion/(.*)\.controller | ||
suppressWarnings: | ||
- nothingToExport | ||
|
||
- task: Animation Data (Override Controller) | ||
name: ((characters|dragon)/motion/|meshes/dragon) | ||
type: AnimatorOverrideController | ||
filter: | ||
- container: /resources/characters/motion/(.*)\.overridecontroller | ||
suppressWarnings: | ||
- nothingToExport | ||
|
||
- task: UI Sprites | ||
name: images/ingame/ui | ||
type: Sprite | ||
filter: | ||
- container: /resources/images/ingame/ui/atlas/ui | ||
isMultiLocale: true | ||
|
||
- task: Icons | ||
name: images/icon/ | ||
type: Texture2D-Alpha | ||
filter: | ||
- container: /resources/images/icon/ | ||
isMultiLocale: true | ||
|
||
- task: Unit Image | ||
name: images/outgame/unitdetail/(amulet|chara|dragon) | ||
type: Texture2D | ||
filter: | ||
- container: /resources/images/outgame/unitdetail | ||
|
||
- task: Story Image | ||
name: emotion/story | ||
type: Texture2D-Story | ||
filter: | ||
- container: /resources/emotion/story | ||
|
||
- task: Story Content | ||
name: story/(unit|castle|quest)story/ | ||
type: MonoBehaviour | ||
filter: | ||
- container: /resources/story | ||
|
||
raw: [ ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1 @@ | ||
"""Implementations to download and pre-process the assets.""" | ||
from .dummy import workflow | ||
|
||
__all__ = ("workflow",) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
"""Implementations for the downloader config.""" | ||
from .load import load_config | ||
from .model import * # noqa |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
"""Implementations to load the config file.""" | ||
import json | ||
from typing import Any, cast | ||
|
||
import yaml | ||
from jsonschema import ValidationError, validate | ||
|
||
from .model import Config | ||
|
||
__all__ = ("load_config",) | ||
|
||
|
||
def load_config(path: str) -> Config: | ||
""" | ||
Load and validate the config. | ||
Raises :class:`ValueError` if the config schema doesn't match. | ||
""" | ||
with open(path, encoding="utf-8") as f: | ||
config = cast(dict[Any, Any], yaml.safe_load(f)) | ||
|
||
with open("config.schema.json", encoding="utf-8") as f: | ||
schema = cast(dict[Any, Any], json.load(f)) | ||
|
||
try: | ||
validate(instance=config, schema=schema) | ||
except ValidationError as ex: | ||
raise ValueError("Config validation failed") from ex | ||
|
||
return Config(config) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
"""Config data model classes.""" | ||
from .main import Config | ||
from .task import AssetRawTask, AssetTask, AssetTaskFilter | ||
from .types import ExportType, UnityType |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
"""Base config object class.""" | ||
from abc import ABC | ||
from dataclasses import dataclass | ||
|
||
from dlasset.model import JsonModel | ||
|
||
__all__ = ("ConfigBase",) | ||
|
||
|
||
# https://github.com/python/mypy/issues/5374 | ||
@dataclass # type: ignore | ||
class ConfigBase(JsonModel, ABC): | ||
"""Base class of a config data.""" |
Oops, something went wrong.