529103462c
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>
42 lines
690 B
Go
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
|
|
}
|