mirror of
https://github.com/d0zingcat/MoviePilot-Plugins.git
synced 2026-05-14 07:26:51 +00:00
Merge pull request #570 from zhi1ong/main
This commit is contained in:
@@ -3,11 +3,12 @@
|
||||
"name": "站点数据统计",
|
||||
"description": "站点统计数据图表。",
|
||||
"labels": "站点,仪表板",
|
||||
"version": "1.1",
|
||||
"version": "1.2",
|
||||
"icon": "statistic.png",
|
||||
"author": "lightolly,jxxghp",
|
||||
"level": 2,
|
||||
"history": {
|
||||
"v1.2": "继续修复增量数据统计问题",
|
||||
"v1.1": "修复增量数据统计问题",
|
||||
"v1.0": "MoviePilot V2 版本站点数据统计插件"
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ class SiteStatistic(_PluginBase):
|
||||
# 插件图标
|
||||
plugin_icon = "statistic.png"
|
||||
# 插件版本
|
||||
plugin_version = "1.1"
|
||||
plugin_version = "1.2"
|
||||
# 插件作者
|
||||
plugin_author = "lightolly,jxxghp"
|
||||
# 作者主页
|
||||
@@ -246,6 +246,18 @@ class SiteStatistic(_PluginBase):
|
||||
return value.isdigit()
|
||||
return False
|
||||
|
||||
def __to_numeric(value: any) -> int:
|
||||
"""
|
||||
将值转换为整数
|
||||
"""
|
||||
if isinstance(value, str):
|
||||
return int(float(value))
|
||||
elif isinstance(value, float) or isinstance(value, int):
|
||||
return int(value)
|
||||
else:
|
||||
logger.error(f'数据类型转换错误 ({value})')
|
||||
return 0
|
||||
|
||||
def __sub_data(d1: dict, d2: dict) -> dict:
|
||||
"""
|
||||
计算两个字典相同Key值的差值(如果值为数字),返回新字典
|
||||
@@ -254,7 +266,7 @@ class SiteStatistic(_PluginBase):
|
||||
return {}
|
||||
if not d2:
|
||||
return d1
|
||||
d = {k: d1.get(k) - d2.get(k) for k in d1
|
||||
d = {k: __to_numeric(d1.get(k)) - __to_numeric(d2.get(k)) for k in d1
|
||||
if k in d2 and __is_digit(d1.get(k)) and __is_digit(d2.get(k))}
|
||||
# 把小于0的数据变成0
|
||||
for k, v in d.items():
|
||||
|
||||
Reference in New Issue
Block a user