From 699976da91abaea3f7064b3c6404afbcad3d36c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=81=8D=E5=85=AE=E6=83=9A=E5=85=AE?= <101191390+HIllya51@users.noreply.github.com> Date: Mon, 1 Jul 2024 02:21:03 +0800 Subject: [PATCH] url --- build.py | 80 +++++++++++++++++++++++++++----------------------------- 1 file changed, 39 insertions(+), 41 deletions(-) diff --git a/build.py b/build.py index 2a49ff3a..88da3870 100644 --- a/build.py +++ b/build.py @@ -25,6 +25,11 @@ curlFileName64 = "curl-8.7.1_7-win64-mingw.zip" ocrModelUrl = "https://github.com/HIllya51/RESOURCES/releases/download/ocr_models" availableLocales = ["cht", "en", "ja", "ko", "ru", "zh"] +LunaHook_latest = ( + "https://github.com/HIllya51/LunaHook/releases/download/latest/Release_English.zip" +) + +LocaleRe = "https://github.com/InWILL/Locale_Remulator/releases/download/v1.5.3-beta.1/Locale_Remulator.1.5.3-beta.1.zip" # rootDir = os.path.dirname(os.path.abspath(__file__)) # print(__file__) @@ -72,24 +77,20 @@ def downloadBrotli(): def downloadlr(): - for ass in get_url_as_json( - "https://api.github.com/repos/InWILL/Locale_Remulator/releases/latest" - )["assets"]: - if "browser_download_url" in ass: - os.chdir(rootDir + "\\temp") - subprocess.run(f"curl -LO {ass['browser_download_url']}") - subprocess.run(f"7z x {ass['name']} -oLR") - os.makedirs( - f"{rootDir}/LunaTranslator/files/plugins/Locale_Remulator", - exist_ok=True, - ) - for _dir, _, _fs in os.walk("LR"): - for f in _fs: - if f in ["LRHookx64.dll", "LRHookx32.dll"]: - shutil.move( - os.path.join(_dir, f), - f"{rootDir}/LunaTranslator/files/plugins/Locale_Remulator", - ) + os.chdir(rootDir + "\\temp") + subprocess.run(f"curl -LO {LocaleRe}") + subprocess.run(f"7z x {LocaleRe.split('/')[-1]} -oLR") + os.makedirs( + f"{rootDir}/LunaTranslator/files/plugins/Locale_Remulator", + exist_ok=True, + ) + for _dir, _, _fs in os.walk("LR"): + for f in _fs: + if f in ["LRHookx64.dll", "LRHookx32.dll"]: + shutil.move( + os.path.join(_dir, f), + f"{rootDir}/LunaTranslator/files/plugins/Locale_Remulator", + ) def move_directory_contents(source_dir, destination_dir): @@ -197,29 +198,26 @@ def get_url_as_json(url): def buildLunaHook(): - for ass in get_url_as_json( - "https://api.github.com/repos/HIllya51/LunaHook/releases/latest" - )["assets"]: - if ass["name"] == "Release_English.zip": - os.chdir(rootDir + "\\temp") - subprocess.run(f"curl -LO {ass['browser_download_url']}") - subprocess.run(f"7z x Release_English.zip") - shutil.move( - "Release_English/LunaHook32.dll", - f"{rootDir}/LunaTranslator/files/plugins/LunaHook", - ) - shutil.move( - "Release_English/LunaHost32.dll", - f"{rootDir}/LunaTranslator/files/plugins/LunaHook", - ) - shutil.move( - "Release_English/LunaHook64.dll", - f"{rootDir}/LunaTranslator/files/plugins/LunaHook", - ) - shutil.move( - "Release_English/LunaHost64.dll", - f"{rootDir}/LunaTranslator/files/plugins/LunaHook", - ) + + os.chdir(rootDir + "\\temp") + subprocess.run(f"curl -LO {LunaHook_latest}") + subprocess.run(f"7z x {LunaHook_latest.split('/')[-1]}") + shutil.move( + "Release_English/LunaHook32.dll", + f"{rootDir}/LunaTranslator/files/plugins/LunaHook", + ) + shutil.move( + "Release_English/LunaHost32.dll", + f"{rootDir}/LunaTranslator/files/plugins/LunaHook", + ) + shutil.move( + "Release_English/LunaHook64.dll", + f"{rootDir}/LunaTranslator/files/plugins/LunaHook", + ) + shutil.move( + "Release_English/LunaHost64.dll", + f"{rootDir}/LunaTranslator/files/plugins/LunaHook", + ) def buildPlugins():