diff --git a/fix_data.py b/fix_data.py index 0a08504..d539cb2 100644 --- a/fix_data.py +++ b/fix_data.py @@ -1,11 +1,12 @@ import asyncio -from res_func.avatar import fix_avatar_config +from res_func.avatar import fix_avatar_config, fetch_text_map from res_func.light_cone import fix_light_cone_config async def main(): - await fix_avatar_config() + text_map_data = await fetch_text_map() + await fix_avatar_config(text_map_data) await fix_light_cone_config() diff --git a/func/fetch_raiders.py b/func/fetch_raiders.py deleted file mode 100644 index da1463c..0000000 --- a/func/fetch_raiders.py +++ /dev/null @@ -1,49 +0,0 @@ -import asyncio - -import aiofiles -from pathlib import Path - -import ujson - -from func.fetch_all import get_list -from modules.apihelper.client.components.hyperion import Hyperion - -data_path = Path("data/raiders") -data_path.mkdir(exist_ok=True, parents=True) -hyperion = Hyperion() - - -async def fetch_and_save_photo(name: str, url: str): - print(f"Fetch raider photo: {name} {url}") - pid = int(url.split("/")[-1]) - img_list = await hyperion.get_images_by_post_id(6, pid) - if not img_list: - return - if len(img_list) < 3: - return - img = img_list[2] - async with aiofiles.open(data_path / f"{name}.png", "wb") as f: - await f.write(img.data) - - -async def get_raiders(): - lists = await get_list("63") - maps = {} - for children in lists: - char_name = children.name - final_content = None - for content in children.list: - if content.article_user_name == "初始镜像OriginMirror": - final_content = content - break - if not final_content: - continue - if not final_content.bbs_url: - continue - maps[char_name] = final_content.bbs_url - tasks = [] - for key, value in maps.items(): - tasks.append(fetch_and_save_photo(key, value)) - await asyncio.gather(*tasks) - async with aiofiles.open(data_path / "info.json", "w", encoding="utf-8") as f: - await f.write(ujson.dumps(list(maps.keys()), ensure_ascii=False, indent=4)) diff --git a/func/fetch_src.py b/func/fetch_src.py index 526b476..b9d18be 100644 --- a/func/fetch_src.py +++ b/func/fetch_src.py @@ -5,7 +5,7 @@ from pathlib import Path src_dir = Path("src") data_dir = Path("data") -pic_lists = ["avatar", "avatar_gacha", "destiny", "element"] +pic_lists = ["avatar_gacha", "destiny", "element"] async def move_files(): diff --git a/main.py b/main.py index d8b704c..8cabca8 100644 --- a/main.py +++ b/main.py @@ -6,7 +6,6 @@ from func.fetch_light_cones import fetch_light_cones, fetch_light_cones_infos, d from func.fetch_materials import fetch_materials, fetch_materials_infos, dump_materials, read_materials from func.fetch_monsters import fetch_monsters, fetch_monsters_infos, dump_monsters, read_monsters from func.fetch_relics import fetch_relics, fetch_relics_infos, dump_relics, read_relics -from func.fetch_raiders import get_raiders from func.fetch_src import move_files data_path = Path("data") @@ -58,7 +57,6 @@ async def wiki( async def bbs_photos(): - await get_raiders() await move_files() diff --git a/res_func/avatar.py b/res_func/avatar.py index 2b63ac8..6b34478 100644 --- a/res_func/avatar.py +++ b/res_func/avatar.py @@ -17,13 +17,13 @@ async def fetch_text_map() -> Dict[str, str]: return res.json() -async def fetch_config(text_map: Dict[str, str]) -> List[AvatarConfig]: +async def fetch_config(text_map_data: Dict[str, str]) -> List[AvatarConfig]: res = await client.get(avatar_config) data = res.json() datas = [] for i in data.values(): a = AvatarConfig(**i) - a.name = text_map[str(a.AvatarName.Hash)] + a.name = text_map_data[str(a.AvatarName.Hash)] datas.append(a) return datas @@ -76,8 +76,7 @@ async def fetch_station(configs_map: Dict[str, AvatarConfig]) -> List[AvatarIcon return datas -async def fix_avatar_config(): - text_map_data = await fetch_text_map() +async def fix_avatar_config(text_map_data: Dict[str, str]): configs = await fetch_config(text_map_data) configs_map: Dict[str, AvatarConfig] = {config.name: config for config in configs} configs_map["开拓者"] = configs_map["{NICKNAME}"] diff --git a/res_func/light_cone.py b/res_func/light_cone.py index 73398c4..4c95448 100644 --- a/res_func/light_cone.py +++ b/res_func/light_cone.py @@ -1,6 +1,6 @@ import asyncio from pathlib import Path -from typing import Dict, List +from typing import List import aiofiles import ujson diff --git a/src/avatar/三月七.png b/src/avatar/三月七.png deleted file mode 100644 index 84e261b..0000000 Binary files a/src/avatar/三月七.png and /dev/null differ diff --git a/src/avatar/丹恒.png b/src/avatar/丹恒.png deleted file mode 100644 index 3891fb8..0000000 Binary files a/src/avatar/丹恒.png and /dev/null differ diff --git a/src/avatar/佩拉.png b/src/avatar/佩拉.png deleted file mode 100644 index 2332256..0000000 Binary files a/src/avatar/佩拉.png and /dev/null differ diff --git a/src/avatar/停云.png b/src/avatar/停云.png deleted file mode 100644 index a81f3a4..0000000 Binary files a/src/avatar/停云.png and /dev/null differ diff --git a/src/avatar/克拉拉.png b/src/avatar/克拉拉.png deleted file mode 100644 index 8670452..0000000 Binary files a/src/avatar/克拉拉.png and /dev/null differ diff --git a/src/avatar/卡芙卡.png b/src/avatar/卡芙卡.png deleted file mode 100644 index 191c9c3..0000000 Binary files a/src/avatar/卡芙卡.png and /dev/null differ diff --git a/src/avatar/姬子.png b/src/avatar/姬子.png deleted file mode 100644 index 9913c3e..0000000 Binary files a/src/avatar/姬子.png and /dev/null differ diff --git a/src/avatar/娜塔莎.png b/src/avatar/娜塔莎.png deleted file mode 100644 index fe36f05..0000000 Binary files a/src/avatar/娜塔莎.png and /dev/null differ diff --git a/src/avatar/布洛妮娅.png b/src/avatar/布洛妮娅.png deleted file mode 100644 index 98f8671..0000000 Binary files a/src/avatar/布洛妮娅.png and /dev/null differ diff --git a/src/avatar/希儿.png b/src/avatar/希儿.png deleted file mode 100644 index 3c022b7..0000000 Binary files a/src/avatar/希儿.png and /dev/null differ diff --git a/src/avatar/希露瓦.png b/src/avatar/希露瓦.png deleted file mode 100644 index cf8e617..0000000 Binary files a/src/avatar/希露瓦.png and /dev/null differ diff --git a/src/avatar/开拓者_火.png b/src/avatar/开拓者_火.png deleted file mode 100644 index 5d9119f..0000000 Binary files a/src/avatar/开拓者_火.png and /dev/null differ diff --git a/src/avatar/开拓者_物理.png b/src/avatar/开拓者_物理.png deleted file mode 100644 index 5551b59..0000000 Binary files a/src/avatar/开拓者_物理.png and /dev/null differ diff --git a/src/avatar/彦卿.png b/src/avatar/彦卿.png deleted file mode 100644 index 0b5fe36..0000000 Binary files a/src/avatar/彦卿.png and /dev/null differ diff --git a/src/avatar/景元.png b/src/avatar/景元.png deleted file mode 100644 index c398854..0000000 Binary files a/src/avatar/景元.png and /dev/null differ diff --git a/src/avatar/杰帕德.png b/src/avatar/杰帕德.png deleted file mode 100644 index d56b99c..0000000 Binary files a/src/avatar/杰帕德.png and /dev/null differ diff --git a/src/avatar/桑博.png b/src/avatar/桑博.png deleted file mode 100644 index 22c2edb..0000000 Binary files a/src/avatar/桑博.png and /dev/null differ diff --git a/src/avatar/瓦尔特.png b/src/avatar/瓦尔特.png deleted file mode 100644 index d1a1ed2..0000000 Binary files a/src/avatar/瓦尔特.png and /dev/null differ diff --git a/src/avatar/白露.png b/src/avatar/白露.png deleted file mode 100644 index fc18afd..0000000 Binary files a/src/avatar/白露.png and /dev/null differ diff --git a/src/avatar/素裳.png b/src/avatar/素裳.png deleted file mode 100644 index 3dc8b08..0000000 Binary files a/src/avatar/素裳.png and /dev/null differ diff --git a/src/avatar/罗刹.png b/src/avatar/罗刹.png deleted file mode 100644 index c7a1ede..0000000 Binary files a/src/avatar/罗刹.png and /dev/null differ diff --git a/src/avatar/艾丝妲.png b/src/avatar/艾丝妲.png deleted file mode 100644 index 4d54031..0000000 Binary files a/src/avatar/艾丝妲.png and /dev/null differ diff --git a/src/avatar/虎克.png b/src/avatar/虎克.png deleted file mode 100644 index 30bc5ad..0000000 Binary files a/src/avatar/虎克.png and /dev/null differ diff --git a/src/avatar/银狼.png b/src/avatar/银狼.png deleted file mode 100644 index d90d6fe..0000000 Binary files a/src/avatar/银狼.png and /dev/null differ diff --git a/src/avatar/阿兰.png b/src/avatar/阿兰.png deleted file mode 100644 index 61fc860..0000000 Binary files a/src/avatar/阿兰.png and /dev/null differ diff --git a/src/avatar/青雀.png b/src/avatar/青雀.png deleted file mode 100644 index 367e8a1..0000000 Binary files a/src/avatar/青雀.png and /dev/null differ diff --git a/src/avatar/黑塔.png b/src/avatar/黑塔.png deleted file mode 100644 index c44966c..0000000 Binary files a/src/avatar/黑塔.png and /dev/null differ