Skip to content

Commit f46b050

Browse files
committed
strictly compare title
1 parent a124006 commit f46b050

File tree

1 file changed

+10
-12
lines changed

1 file changed

+10
-12
lines changed

LyricsFinder/SourcePrivoder/Base/SourceProviderBase.cs

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -133,21 +133,19 @@ public virtual void FuckSearchFilte(string artist, string title, int time, ref L
133133

134134
string check_Str = $"{title.Trim()}".ToLower();
135135

136-
if (Setting.StrictMatch)
136+
//删除标题看起来不匹配的(超过1/3内容不对就出局),严格模式就要全匹配(防止 https://puu.sh/D0FCB/53ac51f034.png )
137+
float threhold_length = Setting.StrictMatch?0:check_Str.Length*(1.0f/3);
138+
139+
search_result.RemoveAll((r) =>
137140
{
138-
//删除标题看起来不匹配的(超过1/3内容不对就出局),当然开头相同除外
139-
float threhold_length = check_Str.Length*(1.0f/3);
140-
search_result.RemoveAll((r) =>
141-
{
142-
//XXXX和XXXXX(Full version)这种情况可以跳过
143-
if (r.Title.Trim().ToLower().StartsWith(check_Str))
144-
return false;//不用删除,通过
141+
//XXXXX和XXXXX(Full version)这种情况可以跳过
142+
if (r.Title.Trim().ToLower().StartsWith(check_Str))
143+
return false;//不用删除,通过
145144

146-
var distance = _GetEditDistance(r);
147-
return distance>threhold_length;
148-
}
149-
);
145+
var distance = _GetEditDistance(r);
146+
return distance>threhold_length;
150147
}
148+
);
151149

152150
//search_result.Sort((a, b) => Math.Abs(a.Duration - time) - Math.Abs(b.Duration - time));
153151
search_result.Sort((a, b) => _GetEditDistance(a)-_GetEditDistance(b));

0 commit comments

Comments
 (0)