🎧 Your Personal Streaming Service
Go airsonicmadsonicmedia-servermusicmusic-servernavidromeopensubsonicraspberry-piself-hostedstreamerstreaming-apistreaming-audiosubsonicsubsonic-server
refactor(server): simplify lastfm agent initialization logic
Deluan6f52c0201cdc
diff --git a/core/agents/agents.go b/core/agents/agents.goindex 50a1e04ad..9814c9f18 100644--- a/core/agents/agents.go+++ b/core/agents/agents.go@@ -45,7 +45,7 @@ func createAgents(ds model.DataStore) *Agents {continue}enabled = append(enabled, name)- res = append(res, init(ds))+ res = append(res, agent)}log.Debug("List of agents enabled", "names", enabled)diff --git a/core/agents/lastfm/agent.go b/core/agents/lastfm/agent.goindex 0c8d290d4..78ed96678 100644--- a/core/agents/lastfm/agent.go+++ b/core/agents/lastfm/agent.go@@ -344,18 +344,10 @@ func (l *lastfmAgent) IsAuthorized(ctx context.Context, userId string) bool {func init() {conf.AddHook(func() {agents.Register(lastFMAgentName, func(ds model.DataStore) agents.Interface {- a := lastFMConstructor(ds)- if a != nil {- return a- }- return nil+ return lastFMConstructor(ds)})scrobbler.Register(lastFMAgentName, func(ds model.DataStore) scrobbler.Scrobbler {- a := lastFMConstructor(ds)- if a != nil {- return a- }- return nil+ return lastFMConstructor(ds)})})}