mirror of
https://github.com/Radiquum/anixart-patcher.git
synced 2025-09-05 10:45:32 +05:00
feat: introduce config path argument
This commit is contained in:
parent
8269d0d5b6
commit
bf59b2bbae
5 changed files with 23 additions and 21 deletions
18
main.py
18
main.py
|
@ -2,28 +2,20 @@ from scripts.download_tools import check_and_download_all_tools
|
|||
from scripts.select_apk import get_apks, select_apk
|
||||
from scripts.select_patches import apply_patches, get_patches, select_patches
|
||||
from scripts.utils import check_java_version, compile_apk, decompile_apk, sign_apk
|
||||
from config import config, log, console
|
||||
from config import args, config, log, console
|
||||
|
||||
from time import time
|
||||
import math
|
||||
import argparse
|
||||
import yaml
|
||||
|
||||
|
||||
parser = argparse.ArgumentParser(prog="anixart patcher")
|
||||
parser.add_argument("--no-decompile", action="store_true")
|
||||
parser.add_argument("--no-compile", action="store_true")
|
||||
parser.add_argument("--patch", action="store_true")
|
||||
parser.add_argument("--sign", action="store_true")
|
||||
|
||||
|
||||
def patch():
|
||||
patches = get_patches()
|
||||
patches = select_patches(patches)
|
||||
statuses = apply_patches(patches)
|
||||
|
||||
statuses_ok = []
|
||||
statuses_err = []
|
||||
|
||||
for status in statuses:
|
||||
if status["status"]:
|
||||
console.print(f"{status['name']}: ✔", style="bold green")
|
||||
|
@ -35,8 +27,6 @@ def patch():
|
|||
|
||||
|
||||
if __name__ == "__main__":
|
||||
args = parser.parse_args()
|
||||
|
||||
check_and_download_all_tools()
|
||||
check_java_version()
|
||||
|
||||
|
@ -78,7 +68,9 @@ if __name__ == "__main__":
|
|||
sign_apk(f"{apk.removesuffix(".apk")}-patched.apk")
|
||||
|
||||
log.info("Finished")
|
||||
log.info(f"install this apk file: `{config["folders"]["dist"]}/{apk.removesuffix(".apk")}-patched-aligned-signed.apk`")
|
||||
log.info(
|
||||
f"install this apk file: `{config["folders"]["dist"]}/{apk.removesuffix(".apk")}-patched-aligned-signed.apk`"
|
||||
)
|
||||
log.info(f"used and successful patches: {", ".join(statuses_ok)}")
|
||||
log.info(f"used and unsuccessful patches: {", ".join(statuses_err)}")
|
||||
log.info(f"time taken: {math.floor(end_time - start_time)}s")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue