From 663f59366a2dec658149299271f83354cc29735f Mon Sep 17 00:00:00 2001 From: GuGuMur <2221533105@qq.com> Date: Fri, 10 Oct 2025 10:34:51 +0800 Subject: [PATCH 1/2] feat: expose client --- torappu/config.py | 8 ++++---- torappu/core/__init__.py | 1 + torappu/core/client.py | 3 ++- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/torappu/config.py b/torappu/config.py index a40e4b2..c387659 100644 --- a/torappu/config.py +++ b/torappu/config.py @@ -3,16 +3,16 @@ from pydantic_settings import BaseSettings, SettingsConfigDict -from torappu.consts import MACOS, WINDOWS +from torappu.consts import BASE_DIR, MACOS, WINDOWS def get_flatc_path(): if WINDOWS: - return Path("bin/flatc.exe") + return Path(BASE_DIR / "bin/flatc.exe") elif MACOS: - return Path("bin/macos/flatc") + return Path(BASE_DIR / "bin/macos/flatc") else: - return Path("bin/flatc") + return Path(BASE_DIR / "bin/flatc") class Config(BaseSettings): diff --git a/torappu/core/__init__.py b/torappu/core/__init__.py index a17a97b..22d4336 100644 --- a/torappu/core/__init__.py +++ b/torappu/core/__init__.py @@ -75,3 +75,4 @@ async def main( continue tg.start_soon(check_and_run_task, task(client), diff) + return client diff --git a/torappu/core/client.py b/torappu/core/client.py index e8d112c..97ea952 100644 --- a/torappu/core/client.py +++ b/torappu/core/client.py @@ -14,6 +14,7 @@ from torappu.config import Config from torappu.consts import ( + BASE_DIR, GAMEDATA_DIR, HEADERS, HG_CN_BASEURL, @@ -224,7 +225,7 @@ def load_idx(self, idx_path: str, decoded_path: Path): "--natural-utf8", "--defaults-json", "--raw-binary", - "assets/ResourceManifest.fbs", + str(Path(BASE_DIR / "assets/ResourceManifest.fbs")), "--", flatbuffer_data_path, ] From 7452d95c0a44db149317fdf2997feb19f65d88ee Mon Sep 17 00:00:00 2001 From: HevCateon <44727214+GuGuMur@users.noreply.github.com> Date: Sun, 19 Oct 2025 09:28:39 +0000 Subject: [PATCH 2/2] fix: using separate function --- torappu/core/__init__.py | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/torappu/core/__init__.py b/torappu/core/__init__.py index 22d4336..4a6be38 100644 --- a/torappu/core/__init__.py +++ b/torappu/core/__init__.py @@ -75,4 +75,36 @@ async def main( continue tg.start_soon(check_and_run_task, task(client), diff) + + +async def export_client( + version: Version, + prev: Version | None, + exclude: list[str], + include: list[str], +): + if prev == version: + logger.info("Version did not change, skipping running") + return + + client = Client(version, prev, config) + try: + await client.init() + except Exception as e: + logger.opt(exception=e).error("Failed to init client") + return + + diff = client.diff() + for priority in sorted(registry.keys()): + logger.info(f"Checking for tasks in priority {priority}...") + + async with anyio.create_task_group() as tg: + for task in registry[priority]: + input_name = task.__name__ + if (exclude and input_name in exclude) or ( + include and input_name not in include + ): + continue + + tg.start_soon(check_and_run_task, task(client), diff) return client