diff --git a/GenshinUID/utils/resource/download_from_miniggicu.py b/GenshinUID/utils/resource/download_from_miniggicu.py index 140687f8..64988813 100644 --- a/GenshinUID/utils/resource/download_from_miniggicu.py +++ b/GenshinUID/utils/resource/download_from_miniggicu.py @@ -8,8 +8,9 @@ import aiohttp from bs4 import BeautifulSoup from aiohttp import TCPConnector from gsuid_core.logger import logger -from aiohttp.client import ClientSession +from aiohttp.client import ClientSession, ClientTimeout +from .RESOURCE_PATH import CHAR_PATH from .download_url import PATH_MAP, download_file # MINIGG_FILE = 'http://file.microgg.cn/KimigaiiWuyi/resource/' @@ -126,7 +127,10 @@ async def download_all_file_from_miniggicu(): failed_list: List[Tuple[str, int, str]] = [] TASKS = [] - async with ClientSession(connector=TCPConnector(verify_ssl=False)) as sess: + async with ClientSession( + connector=TCPConnector(verify_ssl=False), + timeout=ClientTimeout(total=None, sock_connect=20, sock_read=200), + ) as sess: for file in [ NAMECARD_FILE, SIDE_FILE, @@ -201,3 +205,8 @@ async def download_all_file_from_miniggicu(): await _download(TASKS) if count := len(failed_list): logger.error(f'{BASE_TAG}仍有{count}个文件未下载,请使用命令 `下载全部资源` 重新下载') + + for d_files in ['100000067.png', '100000068.png']: + path = CHAR_PATH / d_files + if path.exists(): + path.unlink() diff --git a/GenshinUID/utils/resource/generate_char_card.py b/GenshinUID/utils/resource/generate_char_card.py index 2dcf37f2..afc99b03 100644 --- a/GenshinUID/utils/resource/generate_char_card.py +++ b/GenshinUID/utils/resource/generate_char_card.py @@ -43,7 +43,7 @@ async def create_single_char_card(char_id: Union[str, int]) -> Image.Image: if not path.exists(): logger.warning(f'资源文件夹未发现图片{char_id}....忽略加载...') return Image.new('RGBA', (256, 310)) - char_img = Image.open(path) + char_img = Image.open(path).convert('RGBA') char_star = avatarId2Star_data[str(char_id)] char_frame = Image.open(texture2d_path / 'frame.png') char_bg = Image.open(texture2d_path / f'star{char_star}bg.png')