mirror of
https://github.com/LiteyukiStudio/nonebot-plugin-acgnshow.git
synced 2024-11-30 09:04:50 +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
|
return shows_data
|
||||||
def process_shows_data_to_text(shows_data: dict):
|
def process_shows_data_to_text(shows_data: dict):
|
||||||
showlist = []
|
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"]
|
name = i["project_name"]
|
||||||
venue_name = i["venue_name"]
|
venue_name = i["venue_name"]
|
||||||
project_id = i["project_id"]
|
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):
|
def process_shows_data_to_template(shows_data: dict):
|
||||||
showlist = []
|
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')
|
# 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"]
|
name = i["project_name"]
|
||||||
venue_name = i["venue_name"]
|
venue_name = i["venue_name"]
|
||||||
project_id = i["project_id"]
|
project_id = i["project_id"]
|
||||||
@ -76,7 +84,7 @@ def process_shows_data_to_template(shows_data: dict):
|
|||||||
wish = i["wish"]
|
wish = i["wish"]
|
||||||
cover = "https:" + i["cover"]
|
cover = "https:" + i["cover"]
|
||||||
if district_name == None : district_name = ""
|
if district_name == None : district_name = ""
|
||||||
dicts = {
|
item_dict = {
|
||||||
"name": name,
|
"name": name,
|
||||||
"location": district_name + venue_name,
|
"location": district_name + venue_name,
|
||||||
"sale_flag": sale_flag,
|
"sale_flag": sale_flag,
|
||||||
@ -85,7 +93,14 @@ def process_shows_data_to_template(shows_data: dict):
|
|||||||
"start_time": start_time,
|
"start_time": start_time,
|
||||||
"end_time": end_time,
|
"end_time": end_time,
|
||||||
"wish": wish,
|
"wish": wish,
|
||||||
"image_url": cover
|
"image_url": cover,
|
||||||
|
"page": page,
|
||||||
|
"total_pages": total_pages
|
||||||
}
|
}
|
||||||
showlist.append(dicts)
|
showlist.append(item_dict)
|
||||||
return showlist
|
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)
|
shows = get_shows_data(regionid,page=page,pagesize=config.acgnshow_pagesize)
|
||||||
# print(shows)
|
# print(shows)
|
||||||
try:
|
try:
|
||||||
|
showsdata = process_shows_data_to_template(shows)
|
||||||
template = {
|
template = {
|
||||||
"shows":process_shows_data_to_template(shows),
|
"shows": showsdata[0],
|
||||||
"bgimage": choose_random_bgimage()
|
"bgimage": choose_random_bgimage(),
|
||||||
|
"global_data": showsdata[1]
|
||||||
}
|
}
|
||||||
pic = await template_to_pic(RES_PATH,TEMPLATE_NAME,template)
|
pic = await template_to_pic(RES_PATH,TEMPLATE_NAME,template)
|
||||||
except:
|
except:
|
||||||
|
@ -115,6 +115,41 @@
|
|||||||
bottom: 5px;
|
bottom: 5px;
|
||||||
right: 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>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
@ -141,8 +176,11 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
<div class="header">
|
<div class="footer">
|
||||||
Designed by Asankilp?
|
<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>
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
[project]
|
[project]
|
||||||
name = "nonebot-plugin-acgnshow"
|
name = "nonebot-plugin-acgnshow"
|
||||||
version = "0.1.3.2"
|
version = "0.1.4"
|
||||||
description = "Nonebot2插件,从哔哩哔哩会员购获取简易展览数据"
|
description = "Nonebot2插件,从哔哩哔哩会员购获取简易展览数据"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
requires-python = "<4.0,>=3.9"
|
requires-python = "<4.0,>=3.9"
|
||||||
@ -11,8 +11,6 @@ dependencies = [
|
|||||||
"nonebot2>=2.2.0",
|
"nonebot2>=2.2.0",
|
||||||
"nonebot-plugin-alconna>=0.48.0",
|
"nonebot-plugin-alconna>=0.48.0",
|
||||||
"nonebot-plugin-htmlrender>=0.3.2",
|
"nonebot-plugin-htmlrender>=0.3.2",
|
||||||
"nonebot-adapter-satori>=0.12",
|
|
||||||
"nonebot-adapter-onebot>=2.4.3",
|
|
||||||
"jinja2>=3.1.4",
|
"jinja2>=3.1.4",
|
||||||
"requests>=2.32.3"
|
"requests>=2.32.3"
|
||||||
]
|
]
|
||||||
|
Loading…
Reference in New Issue
Block a user