From 2304e85b53e03fb7318cd4bde5d62831e096d231 Mon Sep 17 00:00:00 2001 From: omg-xtao <100690902+omg-xtao@users.noreply.github.com> Date: Wed, 20 Nov 2024 05:27:55 +0000 Subject: [PATCH] feat: add more icon asset url --- enkanetwork/model/utils.py | 4 ++++ enkanetwork/utils.py | 10 ++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/enkanetwork/model/utils.py b/enkanetwork/model/utils.py index 132529c..e7ae203 100644 --- a/enkanetwork/model/utils.py +++ b/enkanetwork/model/utils.py @@ -6,8 +6,12 @@ class IconAsset(BaseModel): filename: str = "" url: str = "" + url_png: str = "" + url_webp: str = "" def __init__(self, **data: Any) -> None: super().__init__(**data) self.url = create_ui_path(self.filename) + self.url_png = create_ui_path(self.filename, 1) + self.url_webp = create_ui_path(self.filename, 2) diff --git a/enkanetwork/utils.py b/enkanetwork/utils.py index 32a3371..b90ff0c 100644 --- a/enkanetwork/utils.py +++ b/enkanetwork/utils.py @@ -40,6 +40,8 @@ # Base URL BASE_URL = "https://enka.network/{PATH}" +YATTA_URL = "https://gi.yatta.moe/assets/UI/{PATH}" +HAKUSH_URL = "https://api.hakush.in/gi/UI/{PATH}" # Request CHUNK_SIZE = 5 * 2**20 @@ -50,8 +52,12 @@ def create_path(path: str) -> str: return BASE_URL.format(PATH=path) -def create_ui_path(filename: str) -> str: - return create_path(f"ui/{filename}.png") +def create_ui_path(filename: str, base: int = 0) -> str: + if base == 0: + return create_path(f"ui/{filename}.png") + elif base == 1: + return YATTA_URL.format(PATH=f"{filename}.png") + return HAKUSH_URL.format(PATH=f"{filename}.webp") def validate_uid(uid: str) -> bool: