mirror of
https://github.com/idanoo/autobrr
synced 2025-07-23 16:59:12 +00:00
feat(lists): add anilist support (#1949)
* fix(lists): clear selected list * chore(web): improve onChange set values for select_wide * feat(web): add anilist lists * feat(web): Filter is required on ListForm * fix(web): ListForm reset url when change type * feat(lists): add anilist support * feat(lists): filter duplicates for anilist * feat(anilist): handle special characters * fix(lists): better title matching fix(lists): add alternatives to apostrophe replacement * test(title): add some anime cases * feat(anilist): replace unicodes with regex * feat(lists): move additional anilist processing to autobrr instead of brr api * feat(lists): clean Unicode Block “Latin Extended-A” chars --------- Co-authored-by: martylukyy <35452459+martylukyy@users.noreply.github.com>
This commit is contained in:
parent
5e2769639f
commit
b724429b97
10 changed files with 257 additions and 55 deletions
|
@ -15,7 +15,7 @@ import (
|
|||
var (
|
||||
replaceRegexp = regexp.MustCompile(`[\p{P}\p{Z}\x{00C0}-\x{017E}\x{00AE}]`)
|
||||
questionmarkRegexp = regexp.MustCompile(`[?]{2,}`)
|
||||
regionCodeRegexp = regexp.MustCompile(`\(.+\)$`)
|
||||
regionCodeRegexp = regexp.MustCompile(`\(\S+\)`)
|
||||
parenthesesEndRegexp = regexp.MustCompile(`\)$`)
|
||||
)
|
||||
|
||||
|
@ -27,8 +27,8 @@ func processTitle(title string, matchRelease bool) []string {
|
|||
}
|
||||
|
||||
// cleans year like (2020) from arr title
|
||||
//var re = regexp.MustCompile(`(?m)\s(\(\d+\))`)
|
||||
//title = re.ReplaceAllString(title, "")
|
||||
// var re = regexp.MustCompile(`(?m)\s(\(\d+\))`)
|
||||
// title = re.ReplaceAllString(title, "")
|
||||
|
||||
t := NewTitleSlice()
|
||||
|
||||
|
@ -45,7 +45,7 @@ func processTitle(title string, matchRelease bool) []string {
|
|||
|
||||
// title with apostrophes removed and all non-alphanumeric characters replaced by "?"
|
||||
noApostropheTitle := parenthesesEndRegexp.ReplaceAllString(title, "?")
|
||||
noApostropheTitle = strings.ReplaceAll(noApostropheTitle, "'", "")
|
||||
noApostropheTitle = strings.NewReplacer("'", "", "´", "", "`", "", "‘", "", "’", "").Replace(noApostropheTitle)
|
||||
noApostropheTitle = replaceRegexp.ReplaceAllString(noApostropheTitle, "?")
|
||||
noApostropheTitle = questionmarkRegexp.ReplaceAllString(noApostropheTitle, "*")
|
||||
|
||||
|
@ -64,7 +64,7 @@ func processTitle(title string, matchRelease bool) []string {
|
|||
// title with regions in parentheses and apostrophes removed and all non-alphanumeric characters replaced by "?"
|
||||
removedRegionCodeNoApostrophe := regionCodeRegexp.ReplaceAllString(title, "")
|
||||
removedRegionCodeNoApostrophe = strings.TrimRight(removedRegionCodeNoApostrophe, " ")
|
||||
removedRegionCodeNoApostrophe = strings.ReplaceAll(removedRegionCodeNoApostrophe, "'", "")
|
||||
removedRegionCodeNoApostrophe = strings.NewReplacer("'", "", "´", "", "`", "", "‘", "", "’", "").Replace(removedRegionCodeNoApostrophe)
|
||||
removedRegionCodeNoApostrophe = replaceRegexp.ReplaceAllString(removedRegionCodeNoApostrophe, "?")
|
||||
removedRegionCodeNoApostrophe = questionmarkRegexp.ReplaceAllString(removedRegionCodeNoApostrophe, "*")
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue