File tree Expand file tree Collapse file tree
backend/src/module/notification Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -45,12 +45,23 @@ def _format_message(self, notify: Notification) -> str:
4545 Formatted message string.
4646 """
4747 import os
48- # If official_title contains a path separator, extract just the folder name
48+ import re
49+ # If official_title contains a full path like "D:\server\QB\Bangumi\", strip it
4950 title = notify .official_title
5051 if os .sep in title or (os .altsep and os .altsep in title ):
51- title = os .path .basename (os .path .normpath (title ))
52+ # Try to find the bangumi folder name (the folder before "Season X")
53+ # Strip drive letter and base paths
54+ normalized = os .path .normpath (title )
55+ parts = normalized .split (os .sep )
56+ # Find the part that looks like a bangumi title (not "Season X")
57+ bangumi_parts = []
58+ for part in parts :
59+ if re .match (r'^Season\s*\d+$' , part , re .IGNORECASE ):
60+ break
61+ bangumi_parts .append (part )
62+ title = os .sep .join (bangumi_parts ) if bangumi_parts else parts [- 1 ]
5263 return (
64+ f"最新一集更新啦\n "
5365 f"番剧名称:{ title } \n "
54- f"季度: 第{ notify .season } 季\n "
5566 f"更新集数: 第{ notify .episode } 集"
5667 )
You can’t perform that action at this time.
0 commit comments