mirror of
https://github.com/idanoo/autobrr
synced 2025-07-23 08:49:13 +00:00
fix(releases): check for duplicate tags (#681)
* fix(releases): don't store duplicate tags * Update release.go
This commit is contained in:
parent
2d2ddb45bd
commit
6e85ec52e3
1 changed files with 24 additions and 3 deletions
|
@ -233,8 +233,29 @@ func (r *Release) ParseReleaseTagsString(tags string) {
|
|||
|
||||
t := ParseReleaseTagString(cleanTags)
|
||||
|
||||
f := func(target *[]string, source []string) {
|
||||
toappend := make([]string, 0, len(source))
|
||||
for _, t := range *target {
|
||||
found := false
|
||||
norm := rls.MustNormalize(t)
|
||||
|
||||
for _, s := range source {
|
||||
if rls.MustNormalize(s) == norm {
|
||||
found = true
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if !found {
|
||||
toappend = append(toappend, t)
|
||||
}
|
||||
}
|
||||
|
||||
*target = append(*target, toappend...)
|
||||
}
|
||||
|
||||
if len(t.Audio) > 0 {
|
||||
r.Audio = append(r.Audio, t.Audio...)
|
||||
f(&r.Audio, t.Audio)
|
||||
}
|
||||
if len(t.Bonus) > 0 {
|
||||
if sliceContainsSlice([]string{"Freeleech"}, t.Bonus) {
|
||||
|
@ -245,10 +266,10 @@ func (r *Release) ParseReleaseTagsString(tags string) {
|
|||
r.Bonus = append(r.Bonus, t.Bonus...)
|
||||
}
|
||||
if len(t.Codec) > 0 {
|
||||
r.Codec = append(r.Codec, t.Codec)
|
||||
f(&r.Codec, append(make([]string, 0, 1), t.Codec))
|
||||
}
|
||||
if len(t.Other) > 0 {
|
||||
r.Other = append(r.Other, t.Other...)
|
||||
f(&r.Other, t.Other)
|
||||
}
|
||||
if r.Origin == "" && t.Origin != "" {
|
||||
r.Origin = t.Origin
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue