mirror of
https://github.com/LiteyukiStudio/nonebot-plugin-acgnshow.git
synced 2024-11-11 01:27:39 +08:00
✨v0.1.4.2,在展览列表中显示出场嘉宾(数据不全?),展览开始时间精确到秒
This commit is contained in:
parent
96514cde47
commit
b5525ce662
@ -1,5 +1,6 @@
|
|||||||
import json
|
import json
|
||||||
import requests
|
import requests
|
||||||
|
from .util import *
|
||||||
CITY_API_ROOT="https://show.bilibili.com/api/ticket/city/list?channel=3"
|
CITY_API_ROOT="https://show.bilibili.com/api/ticket/city/list?channel=3"
|
||||||
SHOWS_API_ROOT="https://show.bilibili.com/api/ticket/project/listV2"
|
SHOWS_API_ROOT="https://show.bilibili.com/api/ticket/project/listV2"
|
||||||
HEADERS = {
|
HEADERS = {
|
||||||
@ -54,7 +55,9 @@ def process_shows_data_to_text(shows_data: dict):
|
|||||||
venue_name = i["venue_name"]
|
venue_name = i["venue_name"]
|
||||||
project_id = i["project_id"]
|
project_id = i["project_id"]
|
||||||
sale_flag = i["sale_flag"]
|
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"]
|
end_time = i["end_time"]
|
||||||
price_low = i["price_low"] / 100
|
price_low = i["price_low"] / 100
|
||||||
price_high = i["price_high"] / 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"]
|
venue_name = i["venue_name"]
|
||||||
project_id = i["project_id"]
|
project_id = i["project_id"]
|
||||||
sale_flag = i["sale_flag"]
|
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"]
|
end_time = i["end_time"]
|
||||||
price_low = i["price_low"] / 100
|
price_low = i["price_low"] / 100
|
||||||
price_high = i["price_high"] / 100
|
price_high = i["price_high"] / 100
|
||||||
@ -84,6 +89,11 @@ 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 = ""
|
||||||
|
guests_list = i["guests"]
|
||||||
|
guests = ""
|
||||||
|
if guests_list != None:
|
||||||
|
for n in guests_list:
|
||||||
|
guests += n["name"] + ","
|
||||||
item_dict = {
|
item_dict = {
|
||||||
"name": name,
|
"name": name,
|
||||||
"location": district_name + venue_name,
|
"location": district_name + venue_name,
|
||||||
@ -94,6 +104,7 @@ def process_shows_data_to_template(shows_data: dict):
|
|||||||
"end_time": end_time,
|
"end_time": end_time,
|
||||||
"wish": wish,
|
"wish": wish,
|
||||||
"image_url": cover,
|
"image_url": cover,
|
||||||
|
"guests": guests,
|
||||||
"page": page,
|
"page": page,
|
||||||
"total_pages": total_pages
|
"total_pages": total_pages
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,6 @@
|
|||||||
body {
|
body {
|
||||||
font-family: 'Source Han Sans', sans-serif;
|
font-family: 'Source Han Sans', sans-serif;
|
||||||
background-image: url('{{ bgimage }}');
|
background-image: url('{{ bgimage }}');
|
||||||
|
|
||||||
}
|
}
|
||||||
.background {
|
.background {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
@ -19,7 +18,6 @@
|
|||||||
left: 0;
|
left: 0;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
/*background-image: url('{{ bgimage }}');*/
|
|
||||||
background-size: cover;
|
background-size: cover;
|
||||||
filter: blur(40%);
|
filter: blur(40%);
|
||||||
z-index: -1;
|
z-index: -1;
|
||||||
@ -53,7 +51,6 @@
|
|||||||
height: 200px;
|
height: 200px;
|
||||||
border: 1px solid black;
|
border: 1px solid black;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
/*padding: 10px; */
|
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
.details {
|
.details {
|
||||||
@ -61,17 +58,29 @@
|
|||||||
padding-left: 10px;
|
padding-left: 10px;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
justify-content: space-between;
|
justify-content: flex-start;
|
||||||
position: relative;
|
position: relative;
|
||||||
font-size: 10px;
|
font-size: 10px;
|
||||||
}
|
}
|
||||||
.details .title {
|
.details .title {
|
||||||
font-size: 10px;
|
font-size: 10px;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
|
margin-bottom: 5px;
|
||||||
}
|
}
|
||||||
.details .venue_name {
|
.details .venue_name {
|
||||||
font-size: 10px;
|
font-size: 10px;
|
||||||
font-weight: normal;
|
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 {
|
.details .sale_flag {
|
||||||
color: red;
|
color: red;
|
||||||
@ -161,12 +170,12 @@
|
|||||||
<img src="{{ show.image_url }}" alt="Image" width="148" height="200">
|
<img src="{{ show.image_url }}" alt="Image" width="148" height="200">
|
||||||
</div>
|
</div>
|
||||||
<div class="details">
|
<div class="details">
|
||||||
<div class="title">
|
<div class="title">{{ show.name }}</div>
|
||||||
<div>{{ show.name }}</div>
|
<div class="venue_name">举办地点:{{ show.location }}</div>
|
||||||
<div class="venue_name">
|
{% if show.guests != "" %}
|
||||||
<div>举办地点:{{ show.location }}</div>
|
<div class="guests">嘉宾:{{ show.guests }}</div>
|
||||||
</div>
|
{% endif %}
|
||||||
</div>
|
<div class="placeholder"></div>
|
||||||
<div class="sale_flag">{{ show.sale_flag }}</div>
|
<div class="sale_flag">{{ show.sale_flag }}</div>
|
||||||
<div class="id">ID:{{ show.id }}</div>
|
<div class="id">ID:{{ show.id }}</div>
|
||||||
<div class="price">¥{{ show.price }}起</div>
|
<div class="price">¥{{ show.price }}起</div>
|
||||||
|
@ -1,6 +1,11 @@
|
|||||||
from .config import BGIMAGE_PATH
|
from .config import BGIMAGE_PATH
|
||||||
import random
|
import random
|
||||||
|
import datetime
|
||||||
def choose_random_bgimage():
|
def choose_random_bgimage():
|
||||||
randomfile = random.choice(list(BGIMAGE_PATH.iterdir()))
|
randomfile = random.choice(list(BGIMAGE_PATH.iterdir()))
|
||||||
randomurl = randomfile.as_uri()
|
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
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
[project]
|
[project]
|
||||||
name = "nonebot-plugin-acgnshow"
|
name = "nonebot-plugin-acgnshow"
|
||||||
version = "0.1.4.1"
|
version = "0.1.4.2"
|
||||||
description = "Nonebot2插件,从哔哩哔哩会员购获取简易展览数据"
|
description = "Nonebot2插件,从哔哩哔哩会员购获取简易展览数据"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
requires-python = "<4.0,>=3.9"
|
requires-python = "<4.0,>=3.9"
|
||||||
|
Loading…
Reference in New Issue
Block a user