mirror of
https://github.com/RedDeadDepresso/KKAFIO.git
synced 2025-12-22 09:20:02 +00:00
feat: support male chara
This commit is contained in:
32
util/classifier.py
Normal file
32
util/classifier.py
Normal file
@@ -0,0 +1,32 @@
|
||||
from enum import Enum
|
||||
from pathlib import Path
|
||||
from typing import Union
|
||||
|
||||
|
||||
class CardType(Enum):
|
||||
UNKNOWN = "UNKNOWN"
|
||||
KK = "KK"
|
||||
KKSP = "KKSP"
|
||||
KKS = "KKS"
|
||||
|
||||
|
||||
def get_card_type(card: Union[str, Path, bytes]):
|
||||
if isinstance(card, (str, Path)):
|
||||
card = Path(card).read_bytes()
|
||||
|
||||
card_type = CardType.UNKNOWN
|
||||
if b"KoiKatuChara" in card:
|
||||
card_type = CardType.KK
|
||||
if b"KoiKatuCharaSP" in card:
|
||||
card_type = CardType.KKSP
|
||||
elif b"KoiKatuCharaSun" in card:
|
||||
card_type = CardType.KKS
|
||||
return card_type
|
||||
|
||||
|
||||
def is_male(image_bytes: bytes):
|
||||
return b'sex\x00' in image_bytes
|
||||
|
||||
|
||||
def is_coordinate(image_bytes: bytes):
|
||||
return 'b"KoiKatuClothes"' in image_bytes
|
||||
Reference in New Issue
Block a user