diff --git a/internal/radio/playlist.go b/internal/radio/playlist.go index 173badc..87d86de 100644 --- a/internal/radio/playlist.go +++ b/internal/radio/playlist.go @@ -11,7 +11,7 @@ import ( // Playlist holds a list of paths to a song files. type Playlist struct { - mut sync.Mutex + sync.Mutex filePath string playlist []string cur int @@ -30,8 +30,8 @@ func NewPlaylist(filePath string, repeat bool) (*Playlist, error) { // Next returns the next song to play. Returns an empty string if repeat is // false and the end of a playlist was reached. func (p *Playlist) Next() (song string) { - p.mut.Lock() - defer p.mut.Unlock() + p.Lock() + defer p.Unlock() if p.cur == len(p.playlist) { // If the end of a playlist was reached and repeat is set to true, // then go back to the head of it, thus repeating it. Return an empty @@ -53,10 +53,10 @@ func (p *Playlist) load() error { if err != nil { return err } - p.mut.Lock() + p.Lock() p.playlist = strings.Split(string(data), "\n") p.cur = 0 - p.mut.Unlock() + p.Unlock() return nil }