From dc63c9bd017d5a1287cc6df6d0eb49d8c90c0f90 Mon Sep 17 00:00:00 2001 From: Ching L Date: Fri, 5 Sep 2025 11:42:18 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=AE=8C=E6=88=90=E6=AF=94?= =?UTF-8?q?=E8=B5=9B=E6=A0=87=E9=A2=98=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 比分移到✓符号后面:✓ 2-0 Team1 vs Team2 - 更新 run_sync.sh 说明文字 - 修复格式匹配逻辑 --- CHANGELOG.md | 4 ++-- run_sync.sh | 5 ++++- sync_dota2_matches.py | 13 ++++++++----- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cb5cc24..235bbe1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,9 +6,9 @@ - 现在: `Team1 vs Team2 [The International 2025]` - **简化的完成标记**: - 之前: `[COMPLETED] Dota 2 - Tournament: Team1 vs Team2` - - 现在: `✓ Team1 vs Team2 [Tournament] (2-0)` + - 现在: `✓ 2-0 Team1 vs Team2 [Tournament]` - 移除了 "Dota 2" 字样,让日历更简洁 -- 完成的比赛直接在标题显示比分 +- 比分紧跟在✓后面,更加紧凑 ## v3.0 - 时间变更检测 - 新增比赛时间变更自动检测 diff --git a/run_sync.sh b/run_sync.sh index d7c7ed2..1339583 100755 --- a/run_sync.sh +++ b/run_sync.sh @@ -18,4 +18,7 @@ python3 sync_dota2_matches.py --calendar-id "$CALENDAR_ID" echo "" echo "✅ 同步完成!" echo "📅 请在 Google Calendar 中查看更新的比赛" -echo "🏆 已完成的比赛会显示 [COMPLETED] 标记和比分" \ No newline at end of file +echo "" +echo "标题格式说明:" +echo " 未开始: Team1 vs Team2 [Tournament]" +echo " 已完成: ✓ 2-0 Team1 vs Team2 [Tournament]" \ No newline at end of file diff --git a/sync_dota2_matches.py b/sync_dota2_matches.py index b92b775..68b9833 100644 --- a/sync_dota2_matches.py +++ b/sync_dota2_matches.py @@ -249,9 +249,11 @@ class Dota2CalendarSync: # Also create key based on teams and tournament for matching summary = event.get('summary', '') - # Remove completed markers - summary = summary.replace('[COMPLETED] ', '').replace('✓ ', '') - # Remove score if present + # Remove completed markers and scores + summary = summary.replace('[COMPLETED] ', '') + # 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) # Try new format first: "Team1 vs Team2 [Tournament]" @@ -428,8 +430,9 @@ class Dota2CalendarSync: # Update the summary to show it's completed with result summary = event.get('summary', '') if '✓' not in summary: - # Add checkmark and score to the title - summary = f"✓ {summary} ({match_data.get('score', '?-?')})" + # Add checkmark and score right after it + score = match_data.get('score', '?-?') + summary = f"✓ {score} {summary}" # Update the event event['description'] = description