From 221c31f4814a60d9f2b73c62aa803b1b605087ca Mon Sep 17 00:00:00 2001 From: thsrite Date: Wed, 13 Sep 2023 10:37:13 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=E8=87=AA=E5=AE=9A=E4=B9=89=E8=AF=86?= =?UTF-8?q?=E5=88=AB=E8=AF=8D=E5=A2=9E=E5=8A=A0=E8=A7=84=E5=88=99=EF=BC=9A?= =?UTF-8?q?=E8=A2=AB=E6=9B=BF=E6=8D=A2=E8=AF=8D=20=3D>=20=E6=9B=BF?= =?UTF-8?q?=E6=8D=A2=E8=AF=8D=20&&=20=E5=81=8F=E7=A7=BB=E5=89=8D=20<>=20?= =?UTF-8?q?=E5=81=8F=E7=A7=BB=E5=90=8E=20>>=20=E9=9B=86=E5=81=8F=E7=A7=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/core/meta/words.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/app/core/meta/words.py b/app/core/meta/words.py index e0f466a7..213938ec 100644 --- a/app/core/meta/words.py +++ b/app/core/meta/words.py @@ -28,7 +28,23 @@ class WordsMatcher(metaclass=Singleton): if not word: continue try: - if word.count(" => "): + if word.count(" => ") and word.count(" && ") and word.count(" >> ") and word.count(" <> "): + # 替换词 + thc = re.findall(r'(.*?)\s*=>', word)[0] + # 被替换词 + bthc = re.findall(r'=>\s*(.*?)\s*&&', word)[0] + # 集偏移前字段 + pyq = re.findall(r'&&\s*(.*?)\s*<>', word)[0] + # 集偏移后字段 + pyh = re.findall(r'<>(.*?)\s*>>', word)[0] + # 集偏移 + offsets = re.findall(r'>>\s*(.*?)$', word)[0] + # 替换词 + title, message, state = self.__replace_regex(title, thc, bthc) + if state: + # 替换词成功再进行集偏移 + title, message, state = self.__episode_offset(title, pyq, pyh, offsets) + elif word.count(" => "): # 替换词 strings = word.split(" => ") title, message, state = self.__replace_regex(title, strings[0], strings[1])