feat(builder): add rebuild option
This commit is contained in:
10
aklive2d.py
10
aklive2d.py
@@ -66,12 +66,20 @@ class AkLive2D:
|
|||||||
help="Operators to build"
|
help="Operators to build"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
build.add_argument(
|
||||||
|
"-r",
|
||||||
|
"--rebuild",
|
||||||
|
dest="rebuild",
|
||||||
|
action='store_true',
|
||||||
|
help="Rebuild assets"
|
||||||
|
)
|
||||||
|
|
||||||
self.args = parser.parse_args()
|
self.args = parser.parse_args()
|
||||||
if self.args.command == "server" or self.args.command == "s":
|
if self.args.command == "server" or self.args.command == "s":
|
||||||
self.running = Server(self.args.port, self.args.operator_name, self.config)
|
self.running = Server(self.args.port, self.args.operator_name, self.config)
|
||||||
|
|
||||||
if self.args.command == "build" or self.args.command == "b":
|
if self.args.command == "build" or self.args.command == "b":
|
||||||
self.running = Builder(self.config, self.args.operator_names)
|
self.running = Builder(self.config, self.args.operator_names, self.args.rebuild)
|
||||||
|
|
||||||
self.running.start()
|
self.running.start()
|
||||||
|
|
||||||
|
|||||||
@@ -8,10 +8,11 @@ from lib.html_processor import HtmlProcessor
|
|||||||
|
|
||||||
class Builder:
|
class Builder:
|
||||||
|
|
||||||
def __init__(self, config, operator_names=list()) -> None:
|
def __init__(self, config, operator_names=list(), rebuild=False) -> None:
|
||||||
self.operator_names = operator_names
|
self.operator_names = operator_names
|
||||||
self.config = config
|
self.config = config
|
||||||
self.html_processor = HtmlProcessor(config)
|
self.html_processor = HtmlProcessor(config)
|
||||||
|
self.rebuild = rebuild
|
||||||
|
|
||||||
def start(self):
|
def start(self):
|
||||||
if "all" in self.operator_names:
|
if "all" in self.operator_names:
|
||||||
@@ -38,7 +39,7 @@ class Builder:
|
|||||||
)
|
)
|
||||||
|
|
||||||
operator_file = pathlib.Path.cwd().joinpath(target_path, "..", "operator_assets.js")
|
operator_file = pathlib.Path.cwd().joinpath(target_path, "..", "operator_assets.js")
|
||||||
if operator_file.exists() is False:
|
if operator_file.exists() is False or self.rebuild is True:
|
||||||
print("Building operaotr data for {}...".format(operator_name))
|
print("Building operaotr data for {}...".format(operator_name))
|
||||||
|
|
||||||
alpha_composite_threads = list()
|
alpha_composite_threads = list()
|
||||||
|
|||||||
Reference in New Issue
Block a user