aboutsummaryrefslogtreecommitdiffstats
path: root/modern.go
diff options
context:
space:
mode:
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,