Исправление патчей, реализация базвого функционала для сборки apk

This commit is contained in:
2025-09-08 13:07:46 +03:00
parent 0f53c836ae
commit 8a74245c9c
10 changed files with 185 additions and 41 deletions
+5 -6
View File
@@ -6,15 +6,15 @@ import os
import subprocess
def compress_pngs(root_dir):
def compress_pngs(root_dir: str, verbose: bool = False):
compressed_files = []
for dirpath, _, filenames in os.walk(root_dir):
for filename in filenames:
if filename.lower().endswith(".png"):
filepath = os.path.join(dirpath, filename)
tqdm.write(f"Сжимаю: {filepath}")
if verbose: tqdm.write(f"Сжимаю: {filepath}")
try:
subprocess.run(
assert subprocess.run(
[
"pngquant",
"--force",
@@ -23,9 +23,8 @@ def compress_pngs(root_dir):
"--quality=65-90",
filepath,
],
check=True,
capture_output=True,
)
).returncode in [0, 99]
compressed_files.append(filepath)
except subprocess.CalledProcessError as e:
tqdm.write(f"Ошибка при сжатии {filepath}: {e}")
@@ -33,5 +32,5 @@ def compress_pngs(root_dir):
def apply(config: dict) -> bool:
files = compress_pngs("./decompiled")
files = compress_pngs("./decompiled", config.get("verbose", False))
return len(files) > 0 and any(files)