photoprism/pkg/list/contains.go
Michael Mayer 529103462c Index: Add native support for MP4 and Samsung/Google Motion Photos #439
Related Issues:
- Samsung: Initial support for Motion Photos (#439)
- Google: Initial support for Motion Photos (#1739)
- Metadata: Flag Samsung/Google Motion Photos as Live Photos (#2788)

Related Pull Requests:
- Live Photos: Add Support for Samsung Motion Photos (#3588)
- Samsung: Improved support for Motion Photos (#3660)
- Google: Initial support for Motion Photos (#3709)
- Google: Add support for Motion Photos (#3722)

Signed-off-by: Michael Mayer <michael@photoprism.app>
2023-09-22 23:59:56 +02:00

42 lines
690 B
Go

package list
const All = "*"
// Contains tests if a string is contained in the list.
func Contains(list []string, s string) bool {
if len(list) == 0 || s == "" {
return false
} else if s == All {
return true
}
// Find matches.
for i := range list {
if s == list[i] || list[i] == All {
return true
}
}
return false
}
// ContainsAny tests if two lists have at least one common entry.
func ContainsAny(l, s []string) bool {
if len(l) == 0 || len(s) == 0 {
return false
} else if s[0] == All {
return true
}
// Find matches.
for i := range l {
for j := range s {
if s[j] == l[i] || s[j] == All {
return true
}
}
}
// Not found.
return false
}