Эх сурвалжийг харах

修改歌词解析的标签检测逻辑:只有在[]中的标签才忽略

onecold 10 сар өмнө
parent
commit
6d017b67c4

+ 5 - 1
lib/src/main/ets/parse/LyricParser.ts

@@ -40,7 +40,11 @@ export class LyricParser implements IParser {
             }
 
             // 检查是否是需要忽略的标签
-            const shouldIgnore = ignoredTags.some(tag  => line.indexOf(tag)  > 0);
+            // 修改后的标签检测逻辑:只有在[]中的标签才忽略
+            const shouldIgnore = ignoredTags.some(tag  => {
+                const tagPattern = new RegExp(`\\[${tag}[^\\]]*\\]`, 'i'); // 匹配[tag...]格式,忽略大小写
+                return tagPattern.test(line);
+            });
             if (shouldIgnore) {
                 printW(`the lyric line contains ignored tag, line index= ${i}`);
                 continue;