feat(steam-info): 资料页状态/最近游玩/ban 描述增强,时长图渲染与定时任务迁移
- steam.py / draw.py / handlers 扩充:个人资料页状态构建、最近游玩、 游戏头像与中文游戏名查询、ban 描述 - 定时播报迁入 hexi.core.scheduler - 新增 tests/test_steam_profile_parse.py(资料 HTML/XML 解析) Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
1 parent
0ac1958932
commit
6af60a7d55
6 files changed
+1298
-125
No files matched your search
@@ -1,4 +1,4 @@
|
||||
from typing import TypedDict, List
|
||||
from typing import TypedDict, List, Optional, Dict
|
||||
|
||||
|
||||
class Player(TypedDict):
|
||||
@@ -57,9 +57,38 @@ class PlayerData(TypedDict):
|
||||
player_name: str
|
||||
background: bytes
|
||||
avatar: bytes
|
||||
avatar_frame: Optional[bytes] # 头像框(社区物品)PNG,无则 None
|
||||
description: str
|
||||
recent_2_week_play_time: str
|
||||
game_data: List[GameData]
|
||||
# 以下字段来自主页 HTML 解析 + 社区 ?xml=1(不占 API 配额),缺失时为默认值
|
||||
level: Optional[int]
|
||||
counts: Dict[str, int]
|
||||
member_since: Optional[str]
|
||||
online_state: Optional[str]
|
||||
state_message: Optional[str]
|
||||
current_game: Optional[str] # 资料页「当前正在游戏」的游戏名(已本地化)
|
||||
privacy_state: Optional[str]
|
||||
vac_banned: bool
|
||||
trade_ban_state: Optional[str]
|
||||
limited_account: bool
|
||||
hours_2wk: Optional[float]
|
||||
|
||||
|
||||
class ProfileCardExtra(TypedDict, total=False):
|
||||
"""信息卡头部增强字段(缺失的键不绘制对应元素)
|
||||
|
||||
status_kind / ban_kind 决定配色,取值见 draw.py 的 status_row_colors /
|
||||
ban_tag_colors;status_kind 为 private 时表示资料私密降级提示。
|
||||
"""
|
||||
|
||||
level: Optional[int]
|
||||
counts: Dict[str, int]
|
||||
member_since: Optional[str]
|
||||
status_text: Optional[str]
|
||||
status_kind: Optional[str]
|
||||
ban_text: Optional[str]
|
||||
ban_kind: Optional[str]
|
||||
|
||||
|
||||
class DrawPlayerStatusData(TypedDict):
|
||||
@@ -70,6 +99,7 @@ class DrawPlayerStatusData(TypedDict):
|
||||
achievements: List[Achievements]
|
||||
completed_achievement_number: int
|
||||
total_achievement_number: int
|
||||
two_week_time: Optional[str] # e.g. 近两周 3.2 小时,缺失为 None
|
||||
|
||||
|
||||
__all__ = [
|
||||
@@ -78,5 +108,6 @@ __all__ = [
|
||||
"PlayerSummariesResponse",
|
||||
"ProcessedPlayer",
|
||||
"PlayerSummariesProcessedResponse",
|
||||
"ProfileCardExtra",
|
||||
"DrawPlayerStatusData",
|
||||
]
|
||||
Reference in new issue
Block a user