mirror of
https://github.com/RedDeadDepresso/KKAFIO.git
synced 2025-12-22 17:30:01 +00:00
refactor: use pathlib instead of os.path
This commit is contained in:
@@ -1,14 +1,13 @@
|
||||
import os
|
||||
import codecs
|
||||
from util.logger import logger
|
||||
|
||||
|
||||
class RemoveChara:
|
||||
def __init__(self, config, file_manager):
|
||||
"""Initializes the Bounty module.
|
||||
"""Initializes the RemoveChara module.
|
||||
|
||||
Args:
|
||||
config (Config): BAAuto Config instance
|
||||
config (Config): KKAFIO Config instance
|
||||
"""
|
||||
self.config = config
|
||||
self.file_manager = file_manager
|
||||
@@ -18,23 +17,24 @@ class RemoveChara:
|
||||
def resolve_png(self, image_path):
|
||||
with codecs.open(image_path[0], "rb") as card:
|
||||
data = card.read()
|
||||
if data.find(b"KoiKatuChara") != -1:
|
||||
if data.find(b"KoiKatuCharaSP") != -1 or data.find(b"KoiKatuCharaSun") != -1:
|
||||
if b"KoiKatuChara" in data:
|
||||
if b"KoiKatuCharaSP" in data or b"KoiKatuCharaSun" in data:
|
||||
return
|
||||
self.file_manager.find_and_remove("CHARA", image_path, self.game_path["chara"])
|
||||
elif data.find(b"KoiKatuClothes") != -1:
|
||||
self.file_manager.find_and_remove("COORD",image_path, self.game_path["coordinate"])
|
||||
elif b"KoiKatuClothes" in data:
|
||||
self.file_manager.find_and_remove("COORD", image_path, self.game_path["coordinate"])
|
||||
else:
|
||||
self.file_manager.find_and_remove("OVERLAYS", image_path, self.game_path["Overlays"])
|
||||
|
||||
def logic_wrapper(self):
|
||||
foldername = os.path.basename(self.input_path)
|
||||
def run(self):
|
||||
foldername = self.input_path.name
|
||||
logger.info("FOLDER", foldername)
|
||||
|
||||
file_list, archive_list = self.file_manager.find_all_files(self.input_path)
|
||||
|
||||
for file in file_list:
|
||||
file_extension = file[2]
|
||||
match file_extension:
|
||||
extension = file[2]
|
||||
match extension:
|
||||
case ".zipmod":
|
||||
self.file_manager.find_and_remove("MODS", file, self.game_path["mods"])
|
||||
case ".png":
|
||||
@@ -42,7 +42,3 @@ class RemoveChara:
|
||||
case _:
|
||||
pass
|
||||
logger.line()
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user