diff options
| -rw-r--r-- | main.go | 21 |
1 files changed, 7 insertions, 14 deletions
@@ -6,7 +6,6 @@ import ( "net/http" "net/http/httputil" "net/url" - "sort" "strconv" "time" ) @@ -103,21 +102,15 @@ func parseScrobbles(values url.Values, session *Session) []Scrobble { scrobbles := make([]Scrobble, 0, 1) parts := parseValues(values) keys := make([]int, len(parts)) - i := 0 - for key := range parts { - keys[i] = key - i++ - } - sort.Ints(keys) - for _, key := range keys { - scrobble, err := parsePart(parts[key]) - if err != nil { - continue + for i, c := 0, 0; i < 50 && c < len(parts); i++ { + if part, ok := parts[i]; ok { + c++ + if scrobble, err := parsePart(part); err != nil { + scrobble.Session = session.Key + scrobbles = append(scrobbles, scrobble) + } } - scrobble.Session = session.Key - scrobbles = append(scrobbles, scrobble) } - return scrobbles } |
