photoprism/pkg/txt/compare.go
Michael Mayer 92e6c4fe1e Download: Add Disabled, Originals, MediaRaw & MediaSidecar Flags #2234
Extends DownloadSettings with 4 additional options:
- Name: File name pattern for downloaded files (existed)
- Disabled: Disables downloads
- Originals: Only download files stored in "originals" folder
- MediaRaw: Include RAW image files
- MediaSidecar: Include metadata sidecar files (JSON, XMP, YAML)
2022-04-15 09:42:07 +02:00

49 lines
733 B
Go

package txt
import (
"strings"
)
// Bool casts a string to bool.
func Bool(s string) bool {
s = strings.TrimSpace(s)
if s == "" || No(s) {
return false
}
return true
}
// Yes tests if a string represents "yes".
func Yes(s string) bool {
if s == "" {
return false
}
s = strings.ToLower(strings.TrimSpace(s))
return strings.IndexAny(s, "ytjposiд") == 0
}
// No tests if a string represents "no".
func No(s string) bool {
if s == "" {
return false
}
s = strings.ToLower(strings.TrimSpace(s))
return strings.IndexAny(s, "0nhufeн") == 0
}
// New tests if a string represents "new".
func New(s string) bool {
if s == "" {
return false
}
s = strings.ToLower(strings.TrimSpace(s))
return s == EnNew
}