Compare commits

..

2 Commits
v1.0 ... main

Author SHA1 Message Date
Andreas Schulte
6351ae863e
fixed typo 2023-10-25 22:57:37 +02:00
Andreas Schulte
94dcd08b69
Extended GetComparableWarezString 2023-10-25 22:55:08 +02:00
2 changed files with 17 additions and 16 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

@ -9,15 +9,16 @@ import (
func TestGetComparableWarezString(t *testing.T) { func TestGetComparableWarezString(t *testing.T) {
data := map[string]string{ data := map[string]string{
"8.Mile.2002.German.DL.1080p.BluRay.x264-DEFUSED.mkv": "8.mile.2002", "8.Mile.2002.German.DL.1080p.BluRay.x264-DEFUSED.mkv": "8.mile.2002",
"Krieg.der.Welten.2005.German.DL.1080p.BluRay.x264. iNTERNAL-VideoStar.mkv": "krieg.der.welten.2005", "Krieg.der.Welten.2005.German.DL.1080p.BluRay.x264.iNTERNAL-VideoStar.mkv": "krieg.der.welten.2005",
"28.Weeks.Later.2007.German.DTS.DL.1080p.BluRay.x26 4-c0nFuSed.mkv": "28.weeks.later.2007", "28.Weeks.Later.2007.German.DTS.DL.1080p.BluRay.x264-c0nFuSed.mkv": "28.weeks.later.2007",
"Aliens.3.1992.Special.Edition.GERMAN.DL.DTS.1080p. BluRay.x264-MOViESTARS.mkv": "aliens.3.1992", "Aliens.3.1992.Special.Edition.GERMAN.DL.DTS.1080p.BluRay.x264-MOViESTARS.mkv": "aliens.3.1992",
"Die.Frau.Im.Nebel.2023.German.1080p.BluRay.x264-DSFM.mkv": "die.frau.im.nebel.2023", "Die.Frau.Im.Nebel.2023.German.1080p.BluRay.x264-DSFM.mkv": "die.frau.im.nebel.2023",
"Stargate: Kommando SG-1 (1997)": "stargate.kommando.sg-1.1997", "Stargate: Kommando SG-1 (1997)": "stargate.kommando.sg-1.1997",
"Severance (2022)": "severance.2022", "Severance (2022)": "severance.2022",
"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 {