Extended GetComparableWarezString

This commit is contained in:
Andreas Schulte 2023-10-25 22:55:08 +02:00
parent 3033b455c1
commit 94dcd08b69
Signed by: andreas
GPG Key ID: DCD1B6A247B69DB6
2 changed files with 7 additions and 6 deletions

View File

@ -19,12 +19,12 @@ func GetComparableWarezString(s string) (string, error) {
return "", err return "", err
} }
return utils.RemoveDoubledStrings( result := fmt.Sprintf("%s.%d", title, year)
strings.ToLower( result = strings.ToLower(result)
fmt.Sprintf("%s.%d", title, year), result = utils.RemoveDoubledStrings(result, ".")
), result = utils.RemoveLeadingStrings(result, ".")
".",
), nil return result, nil
} }
// GetTitleAndYearFromWarezString tries to get the title and year from a string in a warez context // GetTitleAndYearFromWarezString tries to get the title and year from a string in a warez context

View File

@ -18,6 +18,7 @@ func TestGetComparableWarezString(t *testing.T) {
"Little Britain (2003)": "little.britain.2003", "Little Britain (2003)": "little.britain.2003",
"Sons of Anarchy (2008)": "sons.of.anarchy.2008", "Sons of Anarchy (2008)": "sons.of.anarchy.2008",
"Love, Death & Robots (2019)": "love.death.robots.2019", "Love, Death & Robots (2019)": "love.death.robots.2019",
"...Jahr 2022... die überleben wollen... (1973)": "jahr.2022.die.ueberleben.wollen.1973",
} }
for d, expectedResult := range data { for d, expectedResult := range data {