Give warning when playlists are not imported due to not having an admin user
This commit is contained in:
@@ -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"
|
||||
}
|
||||
|
||||
@@ -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())
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user