Give warning when playlists are not imported due to not having an admin user

This commit is contained in:
Deluan
2020-07-19 13:58:46 -04:00
parent 41138bd665
commit feca030c6d
5 changed files with 71 additions and 30 deletions
+5
View File
@@ -21,3 +21,8 @@ func IsImageFile(filePath string) bool {
extension := filepath.Ext(filePath)
return strings.HasPrefix(mime.TypeByExtension(extension), "image/")
}
func IsPlaylist(filePath string) bool {
extension := filepath.Ext(filePath)
return strings.ToLower(extension) == ".m3u"
}
+10
View File
@@ -43,4 +43,14 @@ var _ = Describe("Files", func() {
Expect(IsImageFile("test.mp3")).To(BeFalse())
})
})
Describe("IsPlaylist", func() {
It("returns true for a M3U file", func() {
Expect(IsPlaylist(filepath.Join("path", "to", "test.m3u"))).To(BeTrue())
})
It("returns false for a non-playlist file", func() {
Expect(IsPlaylist("testm3u")).To(BeFalse())
})
})
})