diff options
| author | Thibaut Horel <thibaut.horel@gmail.com> | 2017-06-07 01:15:43 -0400 |
|---|---|---|
| committer | Thibaut Horel <thibaut.horel@gmail.com> | 2017-06-07 01:15:43 -0400 |
| commit | 3543fcb861a122fe3405bf42f83f6dbc56888b8c (patch) | |
| tree | 30ba1b2057e54754433b7ced0d90dc6993abf3f2 /apiv1.go | |
| parent | b235490206f5aea8b1c618e7ffdae20ef052e78d (diff) | |
| download | lastfm-api-3543fcb861a122fe3405bf42f83f6dbc56888b8c.tar.gz | |
Get additional song metadata from last.fm
Diffstat (limited to 'apiv1.go')
| -rw-r--r-- | apiv1.go | 13 |
1 files changed, 3 insertions, 10 deletions
@@ -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) |
