From 9c9b529a8c21f7cde1b9de8eca5e8a6a2c1cc23f Mon Sep 17 00:00:00 2001 From: Beni Katznelson Date: Tue, 17 Nov 2020 20:44:30 -0500 Subject: [PATCH] added additional check to decode info line to ignore lines that only contain EXTINF:-1 and nothing else --- m3u/main.go | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/m3u/main.go b/m3u/main.go index ee33ce7..afa9981 100644 --- a/m3u/main.go +++ b/m3u/main.go @@ -115,12 +115,14 @@ func decodeInfoLine(line string) (float64, string, map[string]string) { keyMap := make(map[string]string) - for _, match := range matches[1 : len(matches)-1] { - val := match[2] - if val == "" { // If empty string find a number in [3] - val = match[3] + if len(matches) > 1 { + for _, match := range matches[1 : len(matches)-1] { + val := match[2] + if val == "" { // If empty string find a number in [3] + val = match[3] + } + keyMap[match[1]] = val } - keyMap[match[1]] = val } return durationFloat, title, keyMap