diff --git a/internal/radio/icecast.go b/internal/radio/icecast.go index a3036c1..1511954 100644 --- a/internal/radio/icecast.go +++ b/internal/radio/icecast.go @@ -92,7 +92,7 @@ func IcecastLastPlayedSongs(lastNSongs int, playlistPath string) ([]Song, error) } } - songs, err := lastPlayedSongs(playlistPath, lastNSongs) + songs, err := icecastLastPlayedSongs(playlistPath, lastNSongs) if err != nil { return make([]Song, 0), err } @@ -109,7 +109,7 @@ func IcecastLastSong(playlistPath string) (Song, error) { } } - song, err := lastPlayedSongs(playlistPath, 1) + song, err := icecastLastPlayedSongs(playlistPath, 1) if err != nil { return Song{}, err } @@ -117,7 +117,7 @@ func IcecastLastSong(playlistPath string) (Song, error) { return song[0], nil } -func lastPlayedSongs(playlistPath string, n int) ([]Song, error) { +func icecastLastPlayedSongs(playlistPath string, n int) ([]Song, error) { songs := make([]Song, n) buf := make([]byte, bufferSize) @@ -167,7 +167,7 @@ func lastPlayedSongs(playlistPath string, n int) ([]Song, error) { } var playlistWatcher watcher.InotifyWatcher -var playlistFired chan uint32 = make(chan uint32) +var playlistChanged chan uint32 = make(chan uint32) func IcecastWatchPlaylist(playlistPath string, lastNSongs int) error { playlistWatcher, err := watcher.NewInotifyWatcher() @@ -180,15 +180,15 @@ func IcecastWatchPlaylist(playlistPath string, lastNSongs int) error { return errors.Wrap(err, "cannot set a playlist to watch") } - playlistWatcher.WatchForMask(playlistFired, watcher.ModIgnMask) + playlistWatcher.WatchForMask(playlistChanged, watcher.ModIgnMask) go func() { for { select { - case mask := <-playlistFired: + case mask := <-playlistChanged: if mask&syscall.IN_MODIFY > 0 { lastPlayedCacheMutex.Lock() - if songs, err := lastPlayedSongs(playlistPath, lastNSongs); err == nil { + if songs, err := icecastLastPlayedSongs(playlistPath, lastNSongs); err == nil { lastPlayedCache = songs } lastPlayedCacheMutex.Unlock()