media: merge tvdb and trakt languages
This commit is contained in:
@@ -10,3 +10,34 @@ func StringSliceContains(slice []string, val string) bool {
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func StringSliceMergeUnique(existingSlice []string, mergeSlice []string) []string {
|
||||
// add existing
|
||||
data := make([]string, 0)
|
||||
for _, es := range existingSlice {
|
||||
if es == "" {
|
||||
continue
|
||||
}
|
||||
data = append(data, es)
|
||||
}
|
||||
|
||||
// add merge items (unique)
|
||||
for _, ms := range mergeSlice {
|
||||
if ms == "" {
|
||||
continue
|
||||
}
|
||||
|
||||
merge := true
|
||||
for _, es := range data {
|
||||
if strings.EqualFold(es, ms) {
|
||||
merge = false
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if merge {
|
||||
data = append(data, ms)
|
||||
}
|
||||
}
|
||||
return data
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user