mirror of
https://github.com/navidrome/navidrome.git
synced 2025-04-15 19:50:37 +03:00
Disable completely external scrobblers if feature is disabled (DevEnableScrobble
)
This commit is contained in:
parent
f4ddd201f2
commit
99be8444d3
@ -6,7 +6,6 @@ import (
|
||||
"encoding/hex"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"sort"
|
||||
@ -184,8 +183,7 @@ func (c *Client) makeRequest(method string, params url.Values, signed bool) (*Re
|
||||
}
|
||||
|
||||
defer resp.Body.Close()
|
||||
body, _ := ioutil.ReadAll(resp.Body)
|
||||
decoder := json.NewDecoder(strings.NewReader(string(body)))
|
||||
decoder := json.NewDecoder(resp.Body)
|
||||
|
||||
var response Response
|
||||
jsonErr := decoder.Decode(&response)
|
||||
|
@ -5,6 +5,8 @@ import (
|
||||
"sort"
|
||||
"time"
|
||||
|
||||
"github.com/navidrome/navidrome/conf"
|
||||
|
||||
"github.com/navidrome/navidrome/server/events"
|
||||
|
||||
"github.com/navidrome/navidrome/log"
|
||||
@ -172,6 +174,9 @@ func (p *playTracker) dispatchScrobble(ctx context.Context, t *model.MediaFile,
|
||||
var scrobblers map[string]Constructor
|
||||
|
||||
func Register(name string, init Constructor) {
|
||||
if !conf.Server.DevEnableScrobble {
|
||||
return
|
||||
}
|
||||
if scrobblers == nil {
|
||||
scrobblers = make(map[string]Constructor)
|
||||
}
|
||||
|
@ -5,6 +5,8 @@ import (
|
||||
"errors"
|
||||
"time"
|
||||
|
||||
"github.com/navidrome/navidrome/conf"
|
||||
|
||||
"github.com/navidrome/navidrome/server/events"
|
||||
|
||||
"github.com/navidrome/navidrome/model"
|
||||
@ -22,7 +24,9 @@ var _ = Describe("PlayTracker", func() {
|
||||
var album model.Album
|
||||
var artist model.Artist
|
||||
var fake *fakeScrobbler
|
||||
|
||||
BeforeEach(func() {
|
||||
conf.Server.DevEnableScrobble = true
|
||||
ctx = context.Background()
|
||||
ctx = request.WithUser(ctx, model.User{ID: "u-1"})
|
||||
ds = &tests.MockDataStore{}
|
||||
|
Loading…
x
Reference in New Issue
Block a user