summaryrefslogtreecommitdiff
path: root/src/file-hasher/walker.go
diff options
context:
space:
mode:
authorChristian Pointner <equinox@helsinki.at>2017-01-27 23:28:29 (GMT)
committerChristian Pointner <equinox@helsinki.at>2017-01-27 23:28:29 (GMT)
commit001a2fdead2ffb499e78dece93d7bbd027c3765c (patch)
treeb603835af452d28600f1613c03a914c3b62d8913 /src/file-hasher/walker.go
parentb79d589aad52792560eb8d42946cb96872973da2 (diff)
make valid extensions configurable as well
Diffstat (limited to 'src/file-hasher/walker.go')
-rw-r--r--src/file-hasher/walker.go24
1 files changed, 10 insertions, 14 deletions
diff --git a/src/file-hasher/walker.go b/src/file-hasher/walker.go
index cc543a2..602f974 100644
--- a/src/file-hasher/walker.go
+++ b/src/file-hasher/walker.go
@@ -26,23 +26,19 @@ import (
"strings"
)
+var validExtensions []string
+
func checkFileExt(path string) bool {
- switch strings.ToLower(filepath.Ext(path)) {
- case ".flac":
- return true
- case ".ogg":
- return true
- case ".wav":
- return true
- case ".mp3":
- return true
- case ".aac":
- return true
- case ".mp4":
- return true
- case ".m4a":
+ if len(validExtensions) == 0 {
return true
}
+
+ ext := strings.ToLower(filepath.Ext(path))
+ for _, e := range validExtensions {
+ if ext == "."+e {
+ return true
+ }
+ }
return false
}