aboutsummaryrefslogtreecommitdiffstats
path: root/apiv1.go
diff options
context:
space:
mode:
Diffstat (limited to 'apiv1.go')
-rw-r--r--apiv1.go13
1 files changed, 3 insertions, 10 deletions
diff --git a/apiv1.go b/apiv1.go
index 592e7de..a23780b 100644
--- a/apiv1.go
+++ b/apiv1.go
@@ -158,10 +158,10 @@ func parseScrobbles(values url.Values, session *Session) ([]Scrobble, int) {
if part, ok := parts[i]; ok {
c++
if scrobble, err := parsePart(part); err != nil {
- fmt.Printf("%v\n", err)
+ log.Println(err)
ignored++
} else {
- scrobble.Session = session.Key
+ scrobble.SessionKey = session.Key
scrobble.UserId = session.UserId
scrobbles = append(scrobbles, scrobble)
}
@@ -180,15 +180,8 @@ func (app *App) scrobbleHandler(w http.ResponseWriter, r *http.Request) {
scrobbles, _ := parseScrobbles(r.Form, session)
for i, s := range scrobbles {
- t := app.TrackInfo(s.TrackName.Name, s.Artist.Name)
- s.MbidComp = t.Mbid
+ app.GetSong(&s)
scrobbles[i] = s
- _, err = app.DB.Exec("INSERT INTO songs VALUES ($1, $2) "+
- "ON CONFLICT (mbid) DO UPDATE SET mbid=$1, image=$2",
- t.Mbid, t.GetImage("medium"))
- if err != nil {
- log.Println(err)
- }
}
err = app.PutScrobbles(scrobbles)