From d43b2fe8974e665d6fea8da20b036dd1e656e986 Mon Sep 17 00:00:00 2001 From: "Alexander \"Arav\" Andreev" Date: Mon, 29 Aug 2022 09:19:35 +0400 Subject: [PATCH] Removed handling of imposible cases. --- internal/radio/icecast.go | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/internal/radio/icecast.go b/internal/radio/icecast.go index f8a48a2..65c2aaa 100644 --- a/internal/radio/icecast.go +++ b/internal/radio/icecast.go @@ -137,9 +137,7 @@ func lastPlayedSong(playlistPath string) (*Song, error) { newline_end_pos := bytes.LastIndexByte(buf, '\n') - if newline_end_pos == -1 && !bytes.ContainsRune(buf, '|') { - return nil, nil - } else if newline_end_pos == -1 { + if newline_end_pos == -1 { newline_end_pos = len(buf) } @@ -147,10 +145,6 @@ func lastPlayedSong(playlistPath string) (*Song, error) { last_song_line = string(buf[newline_start_pos+1 : newline_end_pos-1]) - if strings.Count(last_song_line, "|") != 3 { - return nil, nil - } - fields := strings.Split(last_song_line, "|") tim, _ := time.Parse(IcecastPlaylistDateFormat, fields[0])