mirror of
https://github.com/zhenxun-org/zhenxun_bot.git
synced 2025-12-15 14:22:55 +08:00
Update query_resource.py
This commit is contained in:
parent
3ad955abf9
commit
4b1821ce42
@ -164,40 +164,18 @@ async def download_map_init(
|
|||||||
if not _map.exists():
|
if not _map.exists():
|
||||||
# padding_w, padding_h = data['padding']
|
# padding_w, padding_h = data['padding']
|
||||||
data = data["slices"]
|
data = data["slices"]
|
||||||
idx = 0
|
map_url = data[0][0]['url']
|
||||||
for x in data:
|
|
||||||
idj = 0
|
|
||||||
for j in x:
|
|
||||||
await download_image(
|
await download_image(
|
||||||
j["url"],
|
map_url,
|
||||||
f"{map_path}/{idx}_{idj}.png",
|
f"{map_path}/map.png",
|
||||||
session,
|
session,
|
||||||
semaphore,
|
semaphore,
|
||||||
force_flag=flag,
|
force_flag=flag,
|
||||||
)
|
)
|
||||||
idj += 1
|
map_file = CreateImg(
|
||||||
idx += 1
|
0, 0, background=f"{map_path}/map.png", ratio=MAP_RATIO
|
||||||
map_width, map_height = CreateImg(
|
|
||||||
0, 0, background=f"{map_path}/0_0.png"
|
|
||||||
).size
|
|
||||||
map_width = map_width * MAP_RATIO
|
|
||||||
map_height = map_height * MAP_RATIO
|
|
||||||
lens = len(
|
|
||||||
[x for x in os.listdir(f"{map_path}") if x.startswith("0")]
|
|
||||||
)
|
)
|
||||||
background_image = CreateImg(
|
map_file.save(f"{map_path}/map.png")
|
||||||
map_width * lens, map_height * lens, map_width, map_height
|
|
||||||
)
|
|
||||||
for i in range(idx):
|
|
||||||
for j in range(idj):
|
|
||||||
x = CreateImg(
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
background=f"{map_path}/{i}_{j}.png",
|
|
||||||
ratio=MAP_RATIO,
|
|
||||||
)
|
|
||||||
background_image.paste(x)
|
|
||||||
background_image.save(f"{map_path}/map.png")
|
|
||||||
else:
|
else:
|
||||||
logger.warning(f'获取原神地图失败 msg: {data["message"]}')
|
logger.warning(f'获取原神地图失败 msg: {data["message"]}')
|
||||||
else:
|
else:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user