🎧 Your Personal Streaming Service
Go airsonicmadsonicmedia-servermusicmusic-servernavidromeopensubsonicraspberry-piself-hostedstreamerstreaming-apistreaming-audiosubsonicsubsonic-server
Remove redundant interfaces
Deluana289a1945f01
diff --git a/cmd/wire_gen.go b/cmd/wire_gen.goindex d7a7e89ff..dbef00dea 100644--- a/cmd/wire_gen.go+++ b/cmd/wire_gen.go@@ -50,9 +50,9 @@ func CreateSubsonicAPIRouter() (*subsonic.Router, error) {mediaStreamer := core.NewMediaStreamer(dataStore, transcoderTranscoder, transcodingCache)archiver := core.NewArchiver(dataStore)players := engine.NewPlayers(dataStore)- lastFMClient := core.LastFMNewClient()+ client := core.LastFMNewClient()spotifyClient := core.SpotifyNewClient()- externalInfo := core.NewExternalInfo(dataStore, lastFMClient, spotifyClient)+ externalInfo := core.NewExternalInfo(dataStore, client, spotifyClient)router := subsonic.New(artwork, listGenerator, playlists, mediaStreamer, archiver, players, externalInfo, dataStore)return router, nil}diff --git a/core/external_info.go b/core/external_info.goindex 288c91f41..523445312 100644--- a/core/external_info.go+++ b/core/external_info.go@@ -26,23 +26,14 @@ type ExternalInfo interface {SimilarSongs(ctx context.Context, id string, count int) (model.MediaFiles, error)}-type LastFMClient interface {- ArtistGetInfo(ctx context.Context, name string) (*lastfm.Artist, error)- ArtistGetSimilar(ctx context.Context, name string, limit int) ([]lastfm.Artist, error)-}--type SpotifyClient interface {- SearchArtists(ctx context.Context, name string, limit int) ([]spotify.Artist, error)-}--func NewExternalInfo(ds model.DataStore, lfm LastFMClient, spf SpotifyClient) ExternalInfo {+func NewExternalInfo(ds model.DataStore, lfm *lastfm.Client, spf *spotify.Client) ExternalInfo {return &externalInfo{ds: ds, lfm: lfm, spf: spf}}type externalInfo struct {ds model.DataStore- lfm LastFMClient- spf SpotifyClient+ lfm *lastfm.Client+ spf *spotify.Client}func (e *externalInfo) getArtist(ctx context.Context, id string) (artist *model.Artist, err error) {diff --git a/core/wire_providers.go b/core/wire_providers.goindex f0ee4f1f2..c16f4d1cc 100644--- a/core/wire_providers.go+++ b/core/wire_providers.go@@ -22,7 +22,7 @@ var Set = wire.NewSet(transcoder.New,)-func LastFMNewClient() LastFMClient {+func LastFMNewClient() *lastfm.Client {if conf.Server.LastFM.ApiKey == "" {return nil}@@ -30,7 +30,7 @@ func LastFMNewClient() LastFMClient {return lastfm.NewClient(conf.Server.LastFM.ApiKey, conf.Server.LastFM.Language, http.DefaultClient)}-func SpotifyNewClient() SpotifyClient {+func SpotifyNewClient() *spotify.Client {if conf.Server.Spotify.ID == "" || conf.Server.Spotify.Secret == "" {return nil}