diff --git a/internal/radio/playlist.go b/internal/radio/playlist.go index 65bd67a..e4791fc 100644 --- a/internal/radio/playlist.go +++ b/internal/radio/playlist.go @@ -19,7 +19,7 @@ type Playlist struct { // Returns an error if failed to load a playlist file. func NewPlaylist(filePath string, repeat bool) (*Playlist, error) { p := &Playlist{filePath: filePath, repeat: repeat} - return p, p.Load() + return p, p.load() } // Next returns the next song to play. Returns an empty string if repeat is @@ -42,8 +42,8 @@ func (p *Playlist) Next() (song string) { return } -// Load reads a playlist file and fills. -func (p *Playlist) Load() error { +// Load reads a playlist file. +func (p *Playlist) load() error { data, err := os.ReadFile(p.filePath) if err != nil { return err @@ -54,3 +54,7 @@ func (p *Playlist) Load() error { p.mut.Unlock() return nil } + +func (p *Playlist) Reload() error { + return p.load() +}