2020-07-10 18:45:58 +02:00
|
|
|
package core
|
|
|
|
|
|
|
|
import (
|
2020-10-19 01:10:11 +02:00
|
|
|
"net/http"
|
|
|
|
|
|
|
|
"github.com/deluan/navidrome/conf"
|
|
|
|
"github.com/deluan/navidrome/core/lastfm"
|
|
|
|
"github.com/deluan/navidrome/core/spotify"
|
2020-07-10 18:45:58 +02:00
|
|
|
"github.com/deluan/navidrome/core/transcoder"
|
|
|
|
"github.com/google/wire"
|
|
|
|
)
|
|
|
|
|
|
|
|
var Set = wire.NewSet(
|
2020-07-31 15:31:19 +02:00
|
|
|
NewArtwork,
|
2020-07-10 18:45:58 +02:00
|
|
|
NewMediaStreamer,
|
2020-10-27 22:02:20 +01:00
|
|
|
GetTranscodingCache,
|
|
|
|
GetImageCache,
|
2020-08-04 18:34:40 +02:00
|
|
|
NewArchiver,
|
2020-10-27 15:19:58 +01:00
|
|
|
NewNowPlayingRepository,
|
2020-10-19 01:10:11 +02:00
|
|
|
NewExternalInfo,
|
2020-10-25 17:00:21 +01:00
|
|
|
NewCacheWarmer,
|
2020-10-27 18:52:01 +01:00
|
|
|
NewPlayers,
|
2020-10-19 01:10:11 +02:00
|
|
|
LastFMNewClient,
|
|
|
|
SpotifyNewClient,
|
2020-07-10 18:45:58 +02:00
|
|
|
transcoder.New,
|
|
|
|
)
|
2020-10-19 01:10:11 +02:00
|
|
|
|
2020-10-20 21:46:18 +02:00
|
|
|
func LastFMNewClient() *lastfm.Client {
|
2020-10-19 01:10:11 +02:00
|
|
|
if conf.Server.LastFM.ApiKey == "" {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
return lastfm.NewClient(conf.Server.LastFM.ApiKey, conf.Server.LastFM.Language, http.DefaultClient)
|
|
|
|
}
|
|
|
|
|
2020-10-20 21:46:18 +02:00
|
|
|
func SpotifyNewClient() *spotify.Client {
|
2020-10-19 01:10:11 +02:00
|
|
|
if conf.Server.Spotify.ID == "" || conf.Server.Spotify.Secret == "" {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
return spotify.NewClient(conf.Server.Spotify.ID, conf.Server.Spotify.Secret, http.DefaultClient)
|
|
|
|
}
|