mirror of
https://github.com/Radiquum/anixart-patcher.git
synced 2025-09-06 11:13:51 +05:00
feat: initial commit
This commit is contained in:
commit
b6c058c40f
16 changed files with 400 additions and 0 deletions
25
patches/compress.py
Normal file
25
patches/compress.py
Normal file
|
@ -0,0 +1,25 @@
|
|||
"""Remove and Compress unnecessary resources"""
|
||||
|
||||
priority = 0
|
||||
from tqdm import tqdm
|
||||
|
||||
import os
|
||||
import shutil
|
||||
from typing import TypedDict
|
||||
|
||||
class PatchConfig_Compress(TypedDict):
|
||||
src: str
|
||||
keep_dirs: list[str]
|
||||
|
||||
def apply(config: PatchConfig_Compress) -> bool:
|
||||
for item in os.listdir(f"{config['src']}/unknown/"):
|
||||
item_path = os.path.join(f"{config['src']}/unknown/", item)
|
||||
|
||||
if os.path.isfile(item_path):
|
||||
os.remove(item_path)
|
||||
tqdm.write(f"removed file: {item_path}")
|
||||
elif os.path.isdir(item_path):
|
||||
if item not in config["keep_dirs"]:
|
||||
shutil.rmtree(item_path)
|
||||
tqdm.write(f"removed directory: {item_path}")
|
||||
return True
|
Loading…
Add table
Add a link
Reference in a new issue