construct subsonic models elsewhere

This commit is contained in:
sentriz
2019-05-28 14:22:44 +01:00
parent 6eb1041ad8
commit 74c55bd509
13 changed files with 243 additions and 192 deletions

View File

@@ -96,14 +96,14 @@ func (c *Controller) Scrobble(w http.ResponseWriter, r *http.Request) {
// fetch user to get lastfm session
user := r.Context().Value(contextUserKey).(*model.User)
if user.LastFMSession == "" {
respondError(w, r, 0, fmt.Sprintf("no last.fm session for this user: %v", err))
respondError(w, r, 0, "you don't have a last.fm session")
return
}
// fetch track for getting info to send to last.fm function
var track model.Track
c.DB.
Preload("Album").
Preload("AlbumArtist").
Preload("Artist").
First(&track, id)
// scrobble with above info
err = lastfm.Scrobble(