mirror of
https://github.com/Murasame-Dev/McStatus-Img.git
synced 2025-12-15 12:47:58 +00:00
fix: image_data is not defined
This commit is contained in:
parent
1d3b58b670
commit
2e11b7f83e
3 changed files with 12 additions and 14 deletions
|
|
@ -89,17 +89,17 @@ def create_image(background: bytes,
|
|||
text_list_size = len(text_list)
|
||||
motd_list_size = len(motd_list)
|
||||
start_posy = height / 2 - (text_list_size + motd_list_size) / 2 * font_size * 1.2
|
||||
for i in range(text_list_size):
|
||||
draw_text_with_shadow(image,
|
||||
text_list[i],
|
||||
width // 2.5,
|
||||
start_posy + font_size * 1.2 * i,
|
||||
font_size)
|
||||
for i in range(motd_list_size):
|
||||
draw_motd_text_with_shadow(image,
|
||||
motd_list[i],
|
||||
width // 2.5,
|
||||
start_posy + font_size * 1.2 * (i + text_list_size),
|
||||
start_posy + font_size * 1.2 * i,
|
||||
int(font_size * 0.8))
|
||||
for i in range(text_list_size):
|
||||
draw_text_with_shadow(image,
|
||||
text_list[i],
|
||||
width // 2.5,
|
||||
start_posy + font_size * 1.2 * (i + motd_list_size),
|
||||
font_size)
|
||||
|
||||
return image
|
||||
|
|
|
|||
10
main.py
10
main.py
|
|
@ -8,7 +8,7 @@ from mc_status_api.BedrockServerStatus import bedrock_status
|
|||
# 此API优先解析 srv 记录
|
||||
from mc_status_api.dnslookup import dns_lookup
|
||||
# 格式化文本
|
||||
from mc_status_api.FormatData import format_java_data, format_bedrock_data, format_index, format_java_index, format_bedrock_index
|
||||
from mc_status_api.FormatData import format_java_data, format_bedrock_data
|
||||
|
||||
import base64
|
||||
import asyncio
|
||||
|
|
@ -66,7 +66,7 @@ async def generate_java_status_image(addr: str):
|
|||
image = await loop.run_in_executor(None,
|
||||
create_image,
|
||||
background_data,
|
||||
image_data,
|
||||
icon_data,
|
||||
text_list,
|
||||
motd_list)
|
||||
return image
|
||||
|
|
@ -85,9 +85,7 @@ async def generate_bedrock_status_image(addr: str):
|
|||
if not background_data:
|
||||
background_data = None
|
||||
|
||||
image_data = await get_icon_image(DEFAULT_ICON)
|
||||
if not image_data:
|
||||
image_data = None
|
||||
icon_data = await get_icon_image(DEFAULT_ICON)
|
||||
|
||||
motd_list = data['motd'].split("\n")
|
||||
text_list = [
|
||||
|
|
@ -100,7 +98,7 @@ async def generate_bedrock_status_image(addr: str):
|
|||
image = await loop.run_in_executor(None,
|
||||
create_image,
|
||||
background_data,
|
||||
image_data,
|
||||
icon_data,
|
||||
text_list,
|
||||
motd_list)
|
||||
return image
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit 859b6b1c537a5104887db6835e4a08602cad8529
|
||||
Subproject commit 7346b1f7729c7d0884f5ba705420f8a6aeb643b8
|
||||
Loading…
Add table
Add a link
Reference in a new issue