From a778c530c2554ad530bb89bb186d78fe058d1477 Mon Sep 17 00:00:00 2001 From: mappu Date: Mon, 5 Dec 2016 19:47:24 +1300 Subject: [PATCH] add FiletypeSupported() function --- Thumbnailer.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Thumbnailer.go b/Thumbnailer.go index 913c7ee..043b067 100644 --- a/Thumbnailer.go +++ b/Thumbnailer.go @@ -49,6 +49,15 @@ func (this *Thumbnailer) RenderFile(absPath string) ([]byte, error) { return thumb.([]byte), nil } +func FiletypeSupported(ext string) bool { + switch strings.ToLower(ext) { + case ".jpg", ".jpeg", ".png", ".gif", ".avi", ".mkv", ".mp4", ".ogm", ".wmv": + return true + default: + return false + } +} + func (this *Thumbnailer) RenderFile_NoCache(absPath string) ([]byte, error) { fh, err := os.OpenFile(absPath, os.O_RDONLY, 0400)