From 039b0af446a306e0af19d17c607e9b1724f5efac Mon Sep 17 00:00:00 2001 From: gudzpoz Date: Thu, 27 Jun 2024 22:50:05 +0800 Subject: [PATCH] build: avoid downloading unused resources --- .github/workflows/build.yml | 2 ++ unpack/downloader.patch | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 unpack/downloader.patch diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0857651..1369785 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -52,7 +52,9 @@ jobs: run: | cd unpack source .venv/bin/activate + mkdir -p downloader/resdata cp gf-data-ch/resdata_no_hash.json downloader/resdata/ch_resdata.json + git apply ../downloader.patch cd downloader zip -j resdata.zip resdata/ch_resdata.json python downloader.py --downloadres 0 --abname diff --git a/unpack/downloader.patch b/unpack/downloader.patch new file mode 100644 index 0000000..41b1a54 --- /dev/null +++ b/unpack/downloader.patch @@ -0,0 +1,34 @@ +diff --git a/downloader.py b/downloader.py +index f81ca28..e5b6536 100644 +--- a/downloader.py ++++ b/downloader.py +@@ -139,6 +139,20 @@ if __name__ == "__main__": + res_path = os.path.join( + out_dir, abname if config["use_abname"] else resname + ) ++ if ( ++ abname == "asset_particlesother.ab" ++ or abname == "asset_fonts.ab" ++ or abname.startswith("asset_guide") ++ or abname.startswith("asset_map") ++ or abname.startswith("atlasclips_") ++ or abname.startswith("resource_icon_") ++ or abname.startswith("resource_card") ++ or abname.startswith("sprites_") ++ or abname.startswith("live2d") ++ or abname.endswith("_spine.ab") ++ or abname.endswith("_furniture.ab") ++ ): ++ continue + if os.path.exists(res_path): + if os.path.getsize(res_path) == size: + logger.info(f"File {resname} already exists, thus will be skipped") +@@ -155,6 +169,8 @@ if __name__ == "__main__": + res_path = os.path.join( + out_dir, abname if config["use_abname"] else resname + ) ++ if abname.endswith(".usm.dat"): ++ continue + if os.path.exists(res_path): + if os.path.getsize(res_path) == size: + logger.info(f"File {resname} already exists, thus will be skipped")