优化完成比赛标题格式

- 比分移到✓符号后面:✓ 2-0 Team1 vs Team2
- 更新 run_sync.sh 说明文字
- 修复格式匹配逻辑
This commit is contained in:
Ching L 2025-09-05 11:42:18 +08:00
parent a1573a3f82
commit dc63c9bd01
3 changed files with 14 additions and 8 deletions

View File

@ -6,9 +6,9 @@
- 现在: `Team1 vs Team2 [The International 2025]` - 现在: `Team1 vs Team2 [The International 2025]`
- **简化的完成标记**: - **简化的完成标记**:
- 之前: `[COMPLETED] Dota 2 - Tournament: Team1 vs Team2` - 之前: `[COMPLETED] Dota 2 - Tournament: Team1 vs Team2`
- 现在: `✓ Team1 vs Team2 [Tournament] (2-0)` - 现在: `✓ 2-0 Team1 vs Team2 [Tournament]`
- 移除了 "Dota 2" 字样,让日历更简洁 - 移除了 "Dota 2" 字样,让日历更简洁
- 完成的比赛直接在标题显示比分 - 比分紧跟在✓后面,更加紧凑
## v3.0 - 时间变更检测 ## v3.0 - 时间变更检测
- 新增比赛时间变更自动检测 - 新增比赛时间变更自动检测

View File

@ -18,4 +18,7 @@ python3 sync_dota2_matches.py --calendar-id "$CALENDAR_ID"
echo "" echo ""
echo "✅ 同步完成!" echo "✅ 同步完成!"
echo "📅 请在 Google Calendar 中查看更新的比赛" echo "📅 请在 Google Calendar 中查看更新的比赛"
echo "🏆 已完成的比赛会显示 [COMPLETED] 标记和比分" echo ""
echo "标题格式说明:"
echo " 未开始: Team1 vs Team2 [Tournament]"
echo " 已完成: ✓ 2-0 Team1 vs Team2 [Tournament]"

View File

@ -249,9 +249,11 @@ class Dota2CalendarSync:
# Also create key based on teams and tournament for matching # Also create key based on teams and tournament for matching
summary = event.get('summary', '') summary = event.get('summary', '')
# Remove completed markers # Remove completed markers and scores
summary = summary.replace('[COMPLETED] ', '').replace('', '') summary = summary.replace('[COMPLETED] ', '')
# Remove score if present # Remove checkmark and score (format: "✓ 2-1 Team vs Team")
summary = re.sub(r'^✓\s+\d+[-:]\d+\s+', '', summary)
# Also handle old format with score at end
summary = re.sub(r'\s*\([0-9\-\?]+\)\s*$', '', summary) summary = re.sub(r'\s*\([0-9\-\?]+\)\s*$', '', summary)
# Try new format first: "Team1 vs Team2 [Tournament]" # Try new format first: "Team1 vs Team2 [Tournament]"
@ -428,8 +430,9 @@ class Dota2CalendarSync:
# Update the summary to show it's completed with result # Update the summary to show it's completed with result
summary = event.get('summary', '') summary = event.get('summary', '')
if '' not in summary: if '' not in summary:
# Add checkmark and score to the title # Add checkmark and score right after it
summary = f"{summary} ({match_data.get('score', '?-?')})" score = match_data.get('score', '?-?')
summary = f"{score} {summary}"
# Update the event # Update the event
event['description'] = description event['description'] = description