From ec9e51dc35274088ae8a5465398701d60e8634cb Mon Sep 17 00:00:00 2001 From: KimgiaiiWuyi <444835641@qq.com> Date: Sat, 2 Jul 2022 17:10:22 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=EF=BC=9A=E5=9B=A0=E4=B8=BA?= =?UTF-8?q?=E5=9C=B0=E8=84=89=E6=B4=BB=E5=8A=A8=E5=AF=BC=E8=87=B4=E7=9A=84?= =?UTF-8?q?`=E6=B4=BB=E5=8A=A8=E5=88=97=E8=A1=A8`=E9=94=99=E8=AF=AF?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mihoyo_libs/get_image.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/mihoyo_libs/get_image.py b/mihoyo_libs/get_image.py index 194398f4..2041dc0e 100644 --- a/mihoyo_libs/get_image.py +++ b/mihoyo_libs/get_image.py @@ -1650,6 +1650,7 @@ async def draw_info_pic(uid: str, image: Optional[Match] = None) -> str: async def draw_event_pic() -> None: async def get_month_and_time(time_data: str) -> List: time_data = time_data.split(' ') + time_data[0] = time_data[0].replace('-', '/') month = time_data[0].split('/', 1)[1] time = ':'.join(time_data[1].split(':')[:-1]) if int(time.split(':')[0]) <= 12: @@ -1774,6 +1775,10 @@ async def draw_event_pic() -> None: event_img.paste(img, (205, 10)) event_img_draw = ImageDraw.Draw(event_img) + if isinstance(value['start_time'], str): + value['start_time'] = await get_month_and_time(value['start_time']) + if isinstance(value['end_time'], str): + value['end_time'] = await get_month_and_time(value['end_time']) event_img_draw.rectangle([(0, 0), (950, 10)], fill = event_color) event_img_draw.polygon([(32, 150), (32, 176), (55,163)], fill = (243, 110, 110)) event_img_draw.text((8, 83), value['start_time'][0], text_color, font_l, anchor='lm')