aboutsummaryrefslogtreecommitdiffstats
path: root/modern.go
diff options
context:
space:
mode:
authorGuillaume Horel <guillaume.horel@gmail.com>2018-01-20 18:35:24 -0500
committerGuillaume Horel <guillaume.horel@gmail.com>2018-01-20 18:35:24 -0500
commita50512ff3ffa46f71b4e39f72b1a5102fd75a928 (patch)
tree06ed8146da526098f3b60827085a3b46bf2a64e0 /modern.go
parent340f6d43455b405e6441a77d3f6ee020ce2a0c5d (diff)
downloadlastfm-api-a50512ff3ffa46f71b4e39f72b1a5102fd75a928.tar.gz
add song_id to scrobblesHEADmaster
Diffstat (limited to 'modern.go')
-rw-r--r--modern.go12
1 files changed, 8 insertions, 4 deletions
diff --git a/modern.go b/modern.go
index 019c2c3..0ed387b 100644
--- a/modern.go
+++ b/modern.go
@@ -17,7 +17,7 @@ type Api interface {
AuthGetToken(*http.Request) (ApiResponse, error)
AuthGetSession(*http.Request) (ApiResponse, error)
AuthGetMobileSession(*http.Request) (ApiResponse, error)
- TrackScrobble(*http.Request) (ApiResponse, error)
+ //TrackScrobble(*http.Request) (ApiResponse, error)
UpdateNowPlaying(*http.Request) (ApiResponse, error)
}
@@ -149,12 +149,16 @@ func (store *SqlStore) AuthGetSession(r *http.Request) (ApiResponse, error) {
}
}
-func (store *SqlStore) TrackScrobble(r *http.Request) (ApiResponse, error) {
- if session, err := store.GetSession(r.FormValue("sk")); err != nil {
+func (app *App) TrackScrobble(r *http.Request) (ApiResponse, error) {
+ if session, err := app.GetSession(r.FormValue("sk")); err != nil {
return nil, err
} else {
scrobbles, ignored := parseScrobbles(r.Form, session)
- if err := store.PutScrobbles(scrobbles); err != nil {
+ for i, s := range scrobbles {
+ app.GetScrobbleSong(&s)
+ scrobbles[i] = s
+ }
+ if err := app.PutScrobbles(scrobbles); err != nil {
return nil, err
} else {
return Scrobbles{Scrobbles: scrobbles,