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