fix plugin
This commit is contained in:
parent
b240c0c266
commit
e6d8587282
@ -24,12 +24,15 @@ def statistic(_: schemas.TokenPayload = Depends(verify_token)) -> Any:
|
|||||||
查询媒体数量统计信息
|
查询媒体数量统计信息
|
||||||
"""
|
"""
|
||||||
media_statistic = DashboardChain().media_statistic()
|
media_statistic = DashboardChain().media_statistic()
|
||||||
return schemas.Statistic(
|
if media_statistic:
|
||||||
movie_count=media_statistic.movie_count,
|
return schemas.Statistic(
|
||||||
tv_count=media_statistic.tv_count,
|
movie_count=media_statistic.movie_count,
|
||||||
episode_count=media_statistic.episode_count,
|
tv_count=media_statistic.tv_count,
|
||||||
user_count=media_statistic.user_count
|
episode_count=media_statistic.episode_count,
|
||||||
)
|
user_count=media_statistic.user_count
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
return schemas.Statistic()
|
||||||
|
|
||||||
|
|
||||||
@router.get("/storage", summary="存储空间", response_model=schemas.Storage)
|
@router.get("/storage", summary="存储空间", response_model=schemas.Storage)
|
||||||
|
@ -265,12 +265,12 @@ class AutoSignIn(_PluginBase):
|
|||||||
拼装插件详情页面,需要返回页面配置,同时附带数据
|
拼装插件详情页面,需要返回页面配置,同时附带数据
|
||||||
"""
|
"""
|
||||||
# 最近两天的日期数组
|
# 最近两天的日期数组
|
||||||
date_list = [str((datetime.now() - timedelta(days=i)).date()) for i in range(2)]
|
date_list = [(datetime.now() - timedelta(days=i)).date() for i in range(2)]
|
||||||
# 最近一天的签到数据
|
# 最近一天的签到数据
|
||||||
current_day = ""
|
current_day = ""
|
||||||
sign_data = []
|
sign_data = []
|
||||||
for day in date_list:
|
for day in date_list:
|
||||||
current_day = f"{datetime.now().month}月{datetime.now().day}日"
|
current_day = f"{day.month}月{day.day}日"
|
||||||
sign_data = self.get_data(current_day)
|
sign_data = self.get_data(current_day)
|
||||||
if sign_data:
|
if sign_data:
|
||||||
break
|
break
|
||||||
|
@ -258,6 +258,7 @@ class DoubanSync(_PluginBase):
|
|||||||
mtype = history.get("type")
|
mtype = history.get("type")
|
||||||
time_str = history.get("time")
|
time_str = history.get("time")
|
||||||
overview = history.get("overview")
|
overview = history.get("overview")
|
||||||
|
doubanid = history.get("doubanid")
|
||||||
contents.append(
|
contents.append(
|
||||||
{
|
{
|
||||||
'component': 'VCard',
|
'component': 'VCard',
|
||||||
@ -278,7 +279,7 @@ class DoubanSync(_PluginBase):
|
|||||||
'height': 120,
|
'height': 120,
|
||||||
'width': 80,
|
'width': 80,
|
||||||
'aspect-ratio': '2/3',
|
'aspect-ratio': '2/3',
|
||||||
'class': 'object-cover rounded shadow ring-gray-500',
|
'class': 'object-cover shadow ring-gray-500',
|
||||||
'cover': True
|
'cover': True
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -292,7 +293,16 @@ class DoubanSync(_PluginBase):
|
|||||||
'props': {
|
'props': {
|
||||||
'class': 'pa-2 font-bold break-words whitespace-break-spaces'
|
'class': 'pa-2 font-bold break-words whitespace-break-spaces'
|
||||||
},
|
},
|
||||||
'text': title
|
'content': [
|
||||||
|
{
|
||||||
|
'component': 'a',
|
||||||
|
'props': {
|
||||||
|
'href': f"https://movie.douban.com/subject/{doubanid}",
|
||||||
|
'target': '_blank'
|
||||||
|
},
|
||||||
|
'text': title
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'component': 'VCardText',
|
'component': 'VCardText',
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import warnings
|
import warnings
|
||||||
from datetime import datetime
|
from datetime import datetime, timedelta
|
||||||
from multiprocessing.dummy import Pool as ThreadPool
|
from multiprocessing.dummy import Pool as ThreadPool
|
||||||
from threading import Lock
|
from threading import Lock
|
||||||
from typing import Optional, Any, List, Dict, Tuple
|
from typing import Optional, Any, List, Dict, Tuple
|
||||||
@ -265,7 +265,320 @@ class SiteStatistic(_PluginBase):
|
|||||||
"""
|
"""
|
||||||
拼装插件详情页面,需要返回页面配置,同时附带数据
|
拼装插件详情页面,需要返回页面配置,同时附带数据
|
||||||
"""
|
"""
|
||||||
pass
|
#
|
||||||
|
# 最近两天的日期数组
|
||||||
|
date_list = [(datetime.now() - timedelta(days=i)).date() for i in range(2)]
|
||||||
|
# 最近一天的签到数据
|
||||||
|
stattistic_data: Dict[str, Dict[str, Any]] = {}
|
||||||
|
for day in date_list:
|
||||||
|
current_day = day.strftime("%Y-%m-%d")
|
||||||
|
stattistic_data = self.get_data(current_day)
|
||||||
|
if stattistic_data:
|
||||||
|
break
|
||||||
|
if not stattistic_data:
|
||||||
|
return [
|
||||||
|
{
|
||||||
|
'component': 'div',
|
||||||
|
'text': '暂无数据',
|
||||||
|
'props': {
|
||||||
|
'class': 'text-center',
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
# 总上传量
|
||||||
|
total_upload = sum([data.get("upload")
|
||||||
|
for data in stattistic_data.values() if data.get("upload")])
|
||||||
|
# 总下载量
|
||||||
|
total_download = sum([data.get("download")
|
||||||
|
for data in stattistic_data.values() if data.get("download")])
|
||||||
|
# 总做种数
|
||||||
|
total_seed = sum([data.get("seeding")
|
||||||
|
for data in stattistic_data.values() if data.get("seeding")])
|
||||||
|
# 总做种体积
|
||||||
|
total_seed_size = sum([data.get("seeding_size")
|
||||||
|
for data in stattistic_data.values() if data.get("seeding_size")])
|
||||||
|
|
||||||
|
# 拼装页面
|
||||||
|
return [
|
||||||
|
{
|
||||||
|
'component': 'VRow',
|
||||||
|
'content': [
|
||||||
|
# 总上传量
|
||||||
|
{
|
||||||
|
'component': 'VCol',
|
||||||
|
'props': {
|
||||||
|
'cols': 12,
|
||||||
|
'md': 3,
|
||||||
|
'sm': 6
|
||||||
|
},
|
||||||
|
'content': [
|
||||||
|
{
|
||||||
|
'component': 'VCard',
|
||||||
|
'props': {
|
||||||
|
'variant': 'tonal',
|
||||||
|
},
|
||||||
|
'content': [
|
||||||
|
{
|
||||||
|
'component': 'VCardText',
|
||||||
|
'props': {
|
||||||
|
'class': 'd-flex align-center',
|
||||||
|
},
|
||||||
|
'content': [
|
||||||
|
{
|
||||||
|
'component': 'VAvatar',
|
||||||
|
'props': {
|
||||||
|
'rounded': True,
|
||||||
|
'variant': 'text',
|
||||||
|
'class': 'me-3'
|
||||||
|
},
|
||||||
|
'content': [
|
||||||
|
{
|
||||||
|
'component': 'VIcon',
|
||||||
|
'html': '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><title>upload</title><path d="M9,16V10H5L12,3L19,10H15V16H9M5,20V18H19V20H5Z" /></svg>'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'component': 'div',
|
||||||
|
'content': [
|
||||||
|
{
|
||||||
|
'component': 'span',
|
||||||
|
'props': {
|
||||||
|
'class': 'text-caption'
|
||||||
|
},
|
||||||
|
'text': '总上传量'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'component': 'div',
|
||||||
|
'props': {
|
||||||
|
'class': 'd-flex align-center flex-wrap'
|
||||||
|
},
|
||||||
|
'content': [
|
||||||
|
{
|
||||||
|
'component': 'span',
|
||||||
|
'props': {
|
||||||
|
'class': 'text-h6'
|
||||||
|
},
|
||||||
|
'text': StringUtils.str_filesize(total_upload)
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
]
|
||||||
|
},
|
||||||
|
# 总下载量
|
||||||
|
{
|
||||||
|
'component': 'VCol',
|
||||||
|
'props': {
|
||||||
|
'cols': 12,
|
||||||
|
'md': 3,
|
||||||
|
'sm': 6
|
||||||
|
},
|
||||||
|
'content': [
|
||||||
|
{
|
||||||
|
'component': 'VCard',
|
||||||
|
'props': {
|
||||||
|
'variant': 'tonal',
|
||||||
|
},
|
||||||
|
'content': [
|
||||||
|
{
|
||||||
|
'component': 'VCardText',
|
||||||
|
'props': {
|
||||||
|
'class': 'd-flex align-center',
|
||||||
|
},
|
||||||
|
'content': [
|
||||||
|
{
|
||||||
|
'component': 'VAvatar',
|
||||||
|
'props': {
|
||||||
|
'rounded': True,
|
||||||
|
'variant': 'text',
|
||||||
|
'class': 'me-3'
|
||||||
|
},
|
||||||
|
'content': [
|
||||||
|
{
|
||||||
|
'component': 'VIcon',
|
||||||
|
'html': '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><title>download</title><path d="M5,20H19V18H5M19,9H15V3H9V9H5L12,16L19,9Z" /></svg>'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'component': 'div',
|
||||||
|
'content': [
|
||||||
|
{
|
||||||
|
'component': 'span',
|
||||||
|
'props': {
|
||||||
|
'class': 'text-caption'
|
||||||
|
},
|
||||||
|
'text': '总下载量'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'component': 'div',
|
||||||
|
'props': {
|
||||||
|
'class': 'd-flex align-center flex-wrap'
|
||||||
|
},
|
||||||
|
'content': [
|
||||||
|
{
|
||||||
|
'component': 'span',
|
||||||
|
'props': {
|
||||||
|
'class': 'text-h6'
|
||||||
|
},
|
||||||
|
'text': StringUtils.str_filesize(total_download)
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
]
|
||||||
|
},
|
||||||
|
# 总做种数
|
||||||
|
{
|
||||||
|
'component': 'VCol',
|
||||||
|
'props': {
|
||||||
|
'cols': 12,
|
||||||
|
'md': 3,
|
||||||
|
'sm': 6
|
||||||
|
},
|
||||||
|
'content': [
|
||||||
|
{
|
||||||
|
'component': 'VCard',
|
||||||
|
'props': {
|
||||||
|
'variant': 'tonal',
|
||||||
|
},
|
||||||
|
'content': [
|
||||||
|
{
|
||||||
|
'component': 'VCardText',
|
||||||
|
'props': {
|
||||||
|
'class': 'd-flex align-center',
|
||||||
|
},
|
||||||
|
'content': [
|
||||||
|
{
|
||||||
|
'component': 'VAvatar',
|
||||||
|
'props': {
|
||||||
|
'rounded': True,
|
||||||
|
'variant': 'text',
|
||||||
|
'class': 'me-3'
|
||||||
|
},
|
||||||
|
'content': [
|
||||||
|
{
|
||||||
|
'component': 'VIcon',
|
||||||
|
'html': '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><title>seed</title><path d="M20.7,3.3C20.7,3.3 19.3,3 17.2,3C11.7,3 1.6,5.1 3.2,20.8C4.3,20.9 5.4,21 6.4,21C24.3,21 20.7,3.3 20.7,3.3M7,17C7,17 7,7 17,7C17,7 11,9 7,17Z" /></svg>'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'component': 'div',
|
||||||
|
'content': [
|
||||||
|
{
|
||||||
|
'component': 'span',
|
||||||
|
'props': {
|
||||||
|
'class': 'text-caption'
|
||||||
|
},
|
||||||
|
'text': '总做种数'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'component': 'div',
|
||||||
|
'props': {
|
||||||
|
'class': 'd-flex align-center flex-wrap'
|
||||||
|
},
|
||||||
|
'content': [
|
||||||
|
{
|
||||||
|
'component': 'span',
|
||||||
|
'props': {
|
||||||
|
'class': 'text-h6'
|
||||||
|
},
|
||||||
|
'text': f'{"{:,}".format(total_seed)}'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
]
|
||||||
|
},
|
||||||
|
# 总做种体积
|
||||||
|
{
|
||||||
|
'component': 'VCol',
|
||||||
|
'props': {
|
||||||
|
'cols': 12,
|
||||||
|
'md': 3,
|
||||||
|
'sm': 6
|
||||||
|
},
|
||||||
|
'content': [
|
||||||
|
{
|
||||||
|
'component': 'VCard',
|
||||||
|
'props': {
|
||||||
|
'variant': 'tonal',
|
||||||
|
},
|
||||||
|
'content': [
|
||||||
|
{
|
||||||
|
'component': 'VCardText',
|
||||||
|
'props': {
|
||||||
|
'class': 'd-flex align-center',
|
||||||
|
},
|
||||||
|
'content': [
|
||||||
|
{
|
||||||
|
'component': 'VAvatar',
|
||||||
|
'props': {
|
||||||
|
'rounded': True,
|
||||||
|
'variant': 'text',
|
||||||
|
'class': 'me-3'
|
||||||
|
},
|
||||||
|
'content': [
|
||||||
|
{
|
||||||
|
'component': 'VIcon',
|
||||||
|
'html': '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><title>database</title><path d="M12,3C7.58,3 4,4.79 4,7C4,9.21 7.58,11 12,11C16.42,11 20,9.21 20,7C20,4.79 16.42,3 12,3M4,9V12C4,14.21 7.58,16 12,16C16.42,16 20,14.21 20,12V9C20,11.21 16.42,13 12,13C7.58,13 4,11.21 4,9M4,14V17C4,19.21 7.58,21 12,21C16.42,21 20,19.21 20,17V14C20,16.21 16.42,18 12,18C7.58,18 4,16.21 4,14Z" /></svg>'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'component': 'div',
|
||||||
|
'content': [
|
||||||
|
{
|
||||||
|
'component': 'span',
|
||||||
|
'props': {
|
||||||
|
'class': 'text-caption'
|
||||||
|
},
|
||||||
|
'text': '总做种体积'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'component': 'div',
|
||||||
|
'props': {
|
||||||
|
'class': 'd-flex align-center flex-wrap'
|
||||||
|
},
|
||||||
|
'content': [
|
||||||
|
{
|
||||||
|
'component': 'span',
|
||||||
|
'props': {
|
||||||
|
'class': 'text-h6'
|
||||||
|
},
|
||||||
|
'text': StringUtils.str_filesize(total_seed_size)
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
def stop_service(self):
|
def stop_service(self):
|
||||||
"""
|
"""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user