Skip to content

Commit

Permalink
feat(playlist): properly set M3U display name field
Browse files Browse the repository at this point in the history
  • Loading branch information
streambinder committed Sep 5, 2023
1 parent a4e61b7 commit 93817e7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
5 changes: 4 additions & 1 deletion entity/playlist/m3u.go
Expand Up @@ -18,7 +18,10 @@ type M3UEncoder struct {

func (encoder *M3UEncoder) init(name string) error {
encoder.target = slug.Make(name) + ".m3u"
encoder.data = []byte("#EXTM3U\n")
encoder.data = []byte(
fmt.Sprintf("#EXTM3U\n#PLAYLIST:%s\n", name),
)

return nil
}

Expand Down
1 change: 1 addition & 0 deletions entity/playlist/m3u_test.go
Expand Up @@ -30,6 +30,7 @@ func TestM3U(t *testing.T) {
assert.Nil(t, encoder.Add(testTrack))
assert.Nil(t, encoder.Close())
assert.Equal(t, `#EXTM3U
#PLAYLIST:Playlist
#EXTINF:0,Artist - Title
Artist - Title.mp3
`, string(output))
Expand Down

0 comments on commit 93817e7

Please sign in to comment.