fix: address code review findings
This commit is contained in:
@@ -37,8 +37,13 @@ func NormalizeString(s string) string {
|
||||
// Remove parenthesized content (e.g., (Deluxe), (Remastered))
|
||||
s = parenRe.ReplaceAllString(s, "")
|
||||
|
||||
// Remove years (4-digit numbers between 1000-2999)
|
||||
s = yearRe.ReplaceAllString(s, "")
|
||||
// Remove years (4-digit numbers between 1000-2999). If stripping the
|
||||
// year would empty the entire string (e.g. an album literally titled
|
||||
// "1989" or "2112"), keep the original form so the title can still match.
|
||||
stripped := yearRe.ReplaceAllString(s, "")
|
||||
if strings.TrimSpace(stripped) != "" {
|
||||
s = stripped
|
||||
}
|
||||
|
||||
// Replace common separators with spaces before stripping other special chars
|
||||
s = strings.ReplaceAll(s, "-", " ")
|
||||
|
||||
Reference in New Issue
Block a user