mirror of
https://github.com/Radiquum/anixart-patcher.git
synced 2025-09-05 10:45:32 +05:00
46 lines
1.5 KiB
Python
46 lines
1.5 KiB
Python
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 log, console
|
|
|
|
from time import time
|
|
import math
|
|
|
|
if __name__ == "__main__":
|
|
check_and_download_all_tools()
|
|
check_java_version()
|
|
|
|
apks = get_apks()
|
|
if not apks:
|
|
log.fatal(f"apks folder is empty")
|
|
exit(1)
|
|
|
|
apk = select_apk(apks)
|
|
|
|
start_time = time()
|
|
decompile_apk(apk)
|
|
|
|
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")
|
|
statuses_ok.append(status["name"])
|
|
else:
|
|
console.print(f"{status['name']}: ✘", style="bold red")
|
|
statuses_err.append(status["name"])
|
|
|
|
compile_apk(f"{apk.removesuffix(".apk")}-patched.apk")
|
|
sign_apk(f"{apk.removesuffix(".apk")}-patched.apk")
|
|
end_time = time()
|
|
|
|
log.info("Finished")
|
|
log.info(f"install this apk file: {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")
|