Removed handling of imposible cases.
This commit is contained in:
parent
1996743470
commit
d43b2fe897
@ -137,9 +137,7 @@ func lastPlayedSong(playlistPath string) (*Song, error) {
|
|||||||
|
|
||||||
newline_end_pos := bytes.LastIndexByte(buf, '\n')
|
newline_end_pos := bytes.LastIndexByte(buf, '\n')
|
||||||
|
|
||||||
if newline_end_pos == -1 && !bytes.ContainsRune(buf, '|') {
|
if newline_end_pos == -1 {
|
||||||
return nil, nil
|
|
||||||
} else if newline_end_pos == -1 {
|
|
||||||
newline_end_pos = len(buf)
|
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])
|
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, "|")
|
fields := strings.Split(last_song_line, "|")
|
||||||
|
|
||||||
tim, _ := time.Parse(IcecastPlaylistDateFormat, fields[0])
|
tim, _ := time.Parse(IcecastPlaylistDateFormat, fields[0])
|
||||||
|
Loading…
Reference in New Issue
Block a user