v0.1.4.2,在展览列表中显示出场嘉宾(数据不全?),展览开始时间精确到秒

This commit is contained in:
Asankilp 2024-08-08 20:50:18 +08:00
parent 96514cde47
commit b5525ce662
4 changed files with 42 additions and 17 deletions

View File

@ -1,5 +1,6 @@
import json
import requests
from .util import *
CITY_API_ROOT="https://show.bilibili.com/api/ticket/city/list?channel=3"
SHOWS_API_ROOT="https://show.bilibili.com/api/ticket/project/listV2"
HEADERS = {
@ -54,7 +55,9 @@ def process_shows_data_to_text(shows_data: dict):
venue_name = i["venue_name"]
project_id = i["project_id"]
sale_flag = i["sale_flag"]
start_time = i["start_time"]
#start_time = i["start_time"]
start_unix = i["start_unix"]
start_time = convert_timestamp(start_unix)
end_time = i["end_time"]
price_low = i["price_low"] / 100
price_high = i["price_high"] / 100
@ -76,7 +79,9 @@ def process_shows_data_to_template(shows_data: dict):
venue_name = i["venue_name"]
project_id = i["project_id"]
sale_flag = i["sale_flag"]
start_time = i["start_time"]
#start_time = i["start_time"]
start_unix = i["start_unix"]
start_time = convert_timestamp(start_unix)
end_time = i["end_time"]
price_low = i["price_low"] / 100
price_high = i["price_high"] / 100
@ -84,6 +89,11 @@ def process_shows_data_to_template(shows_data: dict):
wish = i["wish"]
cover = "https:" + i["cover"]
if district_name == None : district_name = ""
guests_list = i["guests"]
guests = ""
if guests_list != None:
for n in guests_list:
guests += n["name"] + ","
item_dict = {
"name": name,
"location": district_name + venue_name,
@ -94,6 +104,7 @@ def process_shows_data_to_template(shows_data: dict):
"end_time": end_time,
"wish": wish,
"image_url": cover,
"guests": guests,
"page": page,
"total_pages": total_pages
}
@ -103,4 +114,4 @@ def process_shows_data_to_template(shows_data: dict):
"total_pages": total_pages,
"total_results": total_results
}
return [showlist, global_data_dict]
return [showlist, global_data_dict]

View File

@ -11,7 +11,6 @@
body {
font-family: 'Source Han Sans', sans-serif;
background-image: url('{{ bgimage }}');
}
.background {
position: fixed;
@ -19,7 +18,6 @@
left: 0;
width: 100%;
height: 100%;
/*background-image: url('{{ bgimage }}');*/
background-size: cover;
filter: blur(40%);
z-index: -1;
@ -53,7 +51,6 @@
height: 200px;
border: 1px solid black;
text-align: center;
/*padding: 10px; */
box-sizing: border-box;
}
.details {
@ -61,17 +58,29 @@
padding-left: 10px;
display: flex;
flex-direction: column;
justify-content: space-between;
justify-content: flex-start;
position: relative;
font-size: 10px;
}
.details .title {
font-size: 10px;
font-weight: bold;
margin-bottom: 5px;
}
.details .venue_name {
font-size: 10px;
font-weight: normal;
margin-bottom: 5px;
}
.details .guests {
font-size: 10px;
word-wrap: break-word;
white-space: pre-wrap; /* 自动换行 */
margin-bottom: 5px;
}
.details .placeholder {
font-size: 10px;
margin-bottom: 5px;
}
.details .sale_flag {
color: red;
@ -99,7 +108,7 @@
color: gray;
position: absolute;
bottom: 5px;
left: 60px;
left: 60px;
}
.details .start-time,
.details .end-time {
@ -161,12 +170,12 @@
<img src="{{ show.image_url }}" alt="Image" width="148" height="200">
</div>
<div class="details">
<div class="title">
<div>{{ show.name }}</div>
<div class="venue_name">
<div>举办地点:{{ show.location }}</div>
</div>
</div>
<div class="title">{{ show.name }}</div>
<div class="venue_name">举办地点:{{ show.location }}</div>
{% if show.guests != "" %}
<div class="guests">嘉宾:{{ show.guests }}</div>
{% endif %}
<div class="placeholder"></div>
<div class="sale_flag">{{ show.sale_flag }}</div>
<div class="id">ID:{{ show.id }}</div>
<div class="price">¥{{ show.price }}起</div>
@ -184,4 +193,4 @@
</div>
</div>
</body>
</html>
</html>

View File

@ -1,6 +1,11 @@
from .config import BGIMAGE_PATH
import random
import datetime
def choose_random_bgimage():
randomfile = random.choice(list(BGIMAGE_PATH.iterdir()))
randomurl = randomfile.as_uri()
return randomurl
return randomurl
def convert_timestamp(timestamp):
obj = datetime.datetime.fromtimestamp(timestamp)
formatted_time = obj.strftime('%Y-%m-%d %H:%M:%S')
return formatted_time

View File

@ -1,6 +1,6 @@
[project]
name = "nonebot-plugin-acgnshow"
version = "0.1.4.1"
version = "0.1.4.2"
description = "Nonebot2插件从哔哩哔哩会员购获取简易展览数据"
readme = "README.md"
requires-python = "<4.0,>=3.9"