mirror of
https://github.com/LiteyukiStudio/nonebot-plugin-acgnshow.git
synced 2024-11-11 01:27:39 +08:00
✨0.1.4,显示页码,总条目数,项目名称
This commit is contained in:
parent
7cbdba0bea
commit
7b972fe59f
@ -46,7 +46,10 @@ def get_shows_data(region_id: int, page=1, pagesize=20):
|
||||
return shows_data
|
||||
def process_shows_data_to_text(shows_data: dict):
|
||||
showlist = []
|
||||
for i in shows_data["data"]["result"]:
|
||||
data = shows_data["data"]
|
||||
total_pages = data["numPages"]
|
||||
result = data["result"]
|
||||
for i in result:
|
||||
name = i["project_name"]
|
||||
venue_name = i["venue_name"]
|
||||
project_id = i["project_id"]
|
||||
@ -62,8 +65,13 @@ def process_shows_data_to_text(shows_data: dict):
|
||||
|
||||
def process_shows_data_to_template(shows_data: dict):
|
||||
showlist = []
|
||||
data = shows_data["data"]
|
||||
page = data["page"]
|
||||
total_pages = data["numPages"]
|
||||
total_results = data["total"]
|
||||
result = data["result"]
|
||||
# show_template = read_template_file('/home/asankilp/LiteyukiBot/src/plugins/acgnshow/res/template.html')
|
||||
for i in shows_data["data"]["result"]:
|
||||
for i in result:
|
||||
name = i["project_name"]
|
||||
venue_name = i["venue_name"]
|
||||
project_id = i["project_id"]
|
||||
@ -76,7 +84,7 @@ def process_shows_data_to_template(shows_data: dict):
|
||||
wish = i["wish"]
|
||||
cover = "https:" + i["cover"]
|
||||
if district_name == None : district_name = ""
|
||||
dicts = {
|
||||
item_dict = {
|
||||
"name": name,
|
||||
"location": district_name + venue_name,
|
||||
"sale_flag": sale_flag,
|
||||
@ -85,7 +93,14 @@ def process_shows_data_to_template(shows_data: dict):
|
||||
"start_time": start_time,
|
||||
"end_time": end_time,
|
||||
"wish": wish,
|
||||
"image_url": cover
|
||||
"image_url": cover,
|
||||
"page": page,
|
||||
"total_pages": total_pages
|
||||
}
|
||||
showlist.append(dicts)
|
||||
return showlist
|
||||
showlist.append(item_dict)
|
||||
global_data_dict = {
|
||||
"page": page,
|
||||
"total_pages": total_pages,
|
||||
"total_results": total_results
|
||||
}
|
||||
return [showlist, global_data_dict]
|
@ -37,9 +37,11 @@ async def find_show(
|
||||
shows = get_shows_data(regionid,page=page,pagesize=config.acgnshow_pagesize)
|
||||
# print(shows)
|
||||
try:
|
||||
showsdata = process_shows_data_to_template(shows)
|
||||
template = {
|
||||
"shows":process_shows_data_to_template(shows),
|
||||
"bgimage": choose_random_bgimage()
|
||||
"shows": showsdata[0],
|
||||
"bgimage": choose_random_bgimage(),
|
||||
"global_data": showsdata[1]
|
||||
}
|
||||
pic = await template_to_pic(RES_PATH,TEMPLATE_NAME,template)
|
||||
except:
|
||||
|
@ -115,6 +115,41 @@
|
||||
bottom: 5px;
|
||||
right: 5px;
|
||||
}
|
||||
.footer {
|
||||
border: 1px solid black;
|
||||
flex: 1;
|
||||
padding-left: 10px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
position: relative;
|
||||
font-size: 10px;
|
||||
}
|
||||
.footer .designer {
|
||||
text-align: center;
|
||||
font-weight: bold;
|
||||
padding: 5px;
|
||||
margin-bottom: 10px;
|
||||
margin-top: 10px;
|
||||
}
|
||||
.footer .pages {
|
||||
position: absolute;
|
||||
bottom: 5px;
|
||||
right: 5px;
|
||||
font-size: 10px;
|
||||
}
|
||||
.footer .total_results {
|
||||
position: absolute;
|
||||
bottom: 5px;
|
||||
left: 5px;
|
||||
font-size: 10px;
|
||||
}
|
||||
.footer .project_name {
|
||||
position: relative;
|
||||
font-size: 10px;
|
||||
text-align: center;
|
||||
color: rgb(50, 227, 227);
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
@ -141,8 +176,11 @@
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
<div class="header">
|
||||
Designed by Asankilp?
|
||||
<div class="footer">
|
||||
<div class="designer"> Designed by Asankilp? </div>
|
||||
<div class="total_results">共 {{ global_data.total_results }} 个结果</div>
|
||||
<div class="pages">{{ global_data.page }} / {{ global_data.total_pages }} 页</div>
|
||||
<div class="project_name">nonebot-plugin-acgnshow</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
@ -1,6 +1,6 @@
|
||||
[project]
|
||||
name = "nonebot-plugin-acgnshow"
|
||||
version = "0.1.3.2"
|
||||
version = "0.1.4"
|
||||
description = "Nonebot2插件,从哔哩哔哩会员购获取简易展览数据"
|
||||
readme = "README.md"
|
||||
requires-python = "<4.0,>=3.9"
|
||||
@ -11,8 +11,6 @@ dependencies = [
|
||||
"nonebot2>=2.2.0",
|
||||
"nonebot-plugin-alconna>=0.48.0",
|
||||
"nonebot-plugin-htmlrender>=0.3.2",
|
||||
"nonebot-adapter-satori>=0.12",
|
||||
"nonebot-adapter-onebot>=2.4.3",
|
||||
"jinja2>=3.1.4",
|
||||
"requests>=2.32.3"
|
||||
]
|
||||
|
Loading…
Reference in New Issue
Block a user