refactor scrobblers (#383)
- no need to explicitly pass api key - move packages up a level - catch more errors by extended scrobbler interface with IsUserAuthenticated - move interface to server - delete scrobbber package, clients implicitly satisfy Scrobble this also helps with gonic-lastfm-sync
This commit is contained in:
@@ -74,6 +74,9 @@ func (c *Controller) ServeScrobble(r *http.Request) *spec.Response {
|
||||
|
||||
var scrobbleErrs []error
|
||||
for _, scrobbler := range c.Scrobblers {
|
||||
if !scrobbler.IsUserAuthenticated(user) {
|
||||
continue
|
||||
}
|
||||
if err := scrobbler.Scrobble(user, track, optStamp, optSubmission); err != nil {
|
||||
scrobbleErrs = append(scrobbleErrs, err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user