Merge pull request #40 from s1204IT/main

This commit is contained in:
Howard Wu 2022-08-25 21:58:42 +08:00 committed by GitHub
commit 614d105e23
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -31,7 +31,7 @@ arch = sys.argv[1]
variant = sys.argv[2] variant = sys.argv[2]
download_dir = Path.cwd().parent / "download" if sys.argv[3] == "" else Path(sys.argv[3]).resolve() download_dir = Path.cwd().parent / "download" if sys.argv[3] == "" else Path(sys.argv[3]).resolve()
tempScript = sys.argv[4] tempScript = sys.argv[4]
print(f"Generating OpenGapps download link: arch={arch} variant={variant}", flush=True) print(f"Generating OpenGApps download link: arch={arch} variant={variant}", flush=True)
abi_map = {"x64": "x86_64", "arm64": "arm64"} abi_map = {"x64": "x86_64", "arm64": "arm64"}
# TODO: keep it 11.0 since opengapps does not support 12+ yet # TODO: keep it 11.0 since opengapps does not support 12+ yet
# As soon as opengapps is available for 12+, we need to get the sdk/release from build.prop and # As soon as opengapps is available for 12+, we need to get the sdk/release from build.prop and
@ -43,7 +43,7 @@ try:
link = {i["name"]: i for i in j["archs"][abi_map[arch]] link = {i["name"]: i for i in j["archs"][abi_map[arch]]
["apis"][release]["variants"]}[variant]["zip"] ["apis"][release]["variants"]}[variant]["zip"]
except Exception: except Exception:
print("Failed to fetch from opengapps api, fallbacking to sourceforge rss...") print("Failed to fetch from OpenGApps API, fallbacking to SourceForge RSS...")
res = requests.get( res = requests.get(
f'https://sourceforge.net/projects/opengapps/rss?path=/{abi_map[arch]}&limit=100') f'https://sourceforge.net/projects/opengapps/rss?path=/{abi_map[arch]}&limit=100')
link = re.search(f'https://.*{abi_map[arch]}/.*{release}.*{variant}.*\.zip/download', res.text).group().replace( link = re.search(f'https://.*{abi_map[arch]}/.*{release}.*{variant}.*\.zip/download', res.text).group().replace(