Also import `.m3u8` playlists

This commit is contained in:
Deluan 2020-07-23 03:24:33 -04:00
parent 60178c264d
commit 93626129b6
2 changed files with 6 additions and 2 deletions

View File

@ -23,6 +23,6 @@ func IsImageFile(filePath string) bool {
}
func IsPlaylist(filePath string) bool {
extension := filepath.Ext(filePath)
return strings.ToLower(extension) == ".m3u"
extension := strings.ToLower(filepath.Ext(filePath))
return extension == ".m3u" || extension == ".m3u8"
}

View File

@ -49,6 +49,10 @@ var _ = Describe("Files", func() {
Expect(IsPlaylist(filepath.Join("path", "to", "test.m3u"))).To(BeTrue())
})
It("returns true for a M3U8 file", func() {
Expect(IsPlaylist(filepath.Join("path", "to", "test.m3u8"))).To(BeTrue())
})
It("returns false for a non-playlist file", func() {
Expect(IsPlaylist("testm3u")).To(BeFalse())
})