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