From 4faf2a030920e2d39400b33f0e302532f1c9f091 Mon Sep 17 00:00:00 2001 From: "Alexander \"Arav\" Andreev" Date: Sun, 1 Oct 2023 06:40:05 +0400 Subject: [PATCH] In Playlist a method Load() was renamed into load(), and a public Reload() method created. --- internal/radio/playlist.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) 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() +}