diff --git a/config.yaml b/config.yaml index 47f51d8..cbbfa70 100644 --- a/config.yaml +++ b/config.yaml @@ -1,11 +1,12 @@ operators: chen: index.html: + id: char_1013_chen2 operator_logo: logo_rhodes_override title: Ch'en the Holungday version: __get_version fallback_name: char_1013_chen2_2 - operator_settings.js: + _operator_settings.js: fallbackImage_height: 2048 fallbackImage_width: 2048 filename: dyn_illust_char_1013_chen2 @@ -28,11 +29,12 @@ operators: workshopid: 2564643862 nian: index.html: + id: char_2014_nian operator_logo: logo_sui title: Nian version: __get_version fallback_name: char_2014_nian_2 - operator_settings.js: + _operator_settings.js: fallbackImage_height: 2048 fallbackImage_width: 2048 filename: dyn_illust_char_2014_nian @@ -54,11 +56,12 @@ operators: workshopid: 2564642594 skadi: index.html: + id: char_1012_skadi2 operator_logo: logo_egir title: Skadi the Corrupting Heart version: __get_version fallback_name: char_1012_skadi2_2 - operator_settings.js: + _operator_settings.js: fallbackImage_height: 2048 fallbackImage_width: 2048 filename: dyn_illust_char_1012_skadi2 diff --git a/lib/builder.py b/lib/builder.py index e265e92..7b4dcbb 100644 --- a/lib/builder.py +++ b/lib/builder.py @@ -60,15 +60,16 @@ class Builder: use_skel = self.config["operator"]["use_skel"] source_path = self.config["operator"]["source_folder"].format(name=operator_name) target_path = self.config["operator"]["target_folder"].format(name=operator_name) - common_name = self.config["operators"][operator_name]["operator_settings.js"]["filename"] + common_name = self.config["operators"][operator_name]["_operator_settings.js"]["filename"] fallback_name = self.config["operators"][operator_name]["index.html"]["fallback_name"] + id_name = self.config["operators"][operator_name]["index.html"]["id"] file_paths = dict( json=target_path + common_name + ".json", atlas=target_path + common_name + ".atlas", skel=target_path + common_name + ".skel", ) - operator_file = pathlib.Path.cwd().joinpath(target_path, "..", "operator_assets.js") + operator_file = pathlib.Path.cwd().joinpath(target_path, "..", "{}_assets.js".format(id_name)) if operator_file.exists() is False or self.rebuild is True: print("Building operator data for {}...".format(operator_name)) diff --git a/lib/config.py b/lib/config.py index 10c2683..a5c4ddb 100644 --- a/lib/config.py +++ b/lib/config.py @@ -17,7 +17,7 @@ class Config: ), operators={ "index.html": dict, - "operator_settings.js": dict, + "_operator_settings.js": dict, "project.json": dict }, operator=dict( @@ -29,12 +29,13 @@ class Config: ), operator_config={ "index.html": dict( + id=str, operator_logo=str, title=str, version=str, fallback_name=str, ), - "operator_settings.js": dict( + "_operator_settings.js": dict( fallbackImage_height=int, fallbackImage_width=int, filename=str, diff --git a/lib/content_processor.py b/lib/content_processor.py index 9dd32a6..93c84e0 100644 --- a/lib/content_processor.py +++ b/lib/content_processor.py @@ -5,7 +5,7 @@ class ContentProcessor: def __init__(self, config, operator_name): self.config = config["operators"][operator_name] - self.file_to_process = [key for key, value in self.config.items()] + self.file_to_process = [key for key, value in self.config.items() if key.startswith("_") is False] self.settings = self.config self.evalable = [ "__get_version" @@ -44,6 +44,10 @@ class ContentProcessor: else: raise Exception("Unsupported function name: {}".format(value)) self.settings[item_key][key] = replace_value + # copy dict value _operator_settings.js to {id}_settings.js + settings_filename = "{}_settings.js".format(self.settings["index.html"]["id"]) + self.settings[settings_filename] = self.settings["_operator_settings.js"] + self.file_to_process.append(settings_filename) def __get_version(self): with open(pathlib.Path.cwd().joinpath("Version"), "r") as f: diff --git a/template/index.html b/template/index.html index 487dc19..988d96d 100644 --- a/template/index.html +++ b/template/index.html @@ -21,8 +21,8 @@ - - + +