mirror of
https://github.com/navidrome/navidrome.git
synced 2025-07-13 23:21:21 +03:00
* fix(plugins): silence repeated “Plugin not found” spam for inactive Spotify/Last.fm plugins Navidrome was emitting a warning when the optional Spotify or Last.fm agents weren’t enabled, filling the journal with entries like: level=warning msg="Plugin not found" capability=MetadataAgent name=spotify Fixed by completely disable the plugin system when Plugins.Enabled = false. Signed-off-by: Deluan <deluan@navidrome.org> * style: update test description for clarity Signed-off-by: Deluan <deluan@navidrome.org> * fix: ensure plugin folder is created only if plugins are enabled Signed-off-by: Deluan <deluan@navidrome.org> --------- Signed-off-by: Deluan <deluan@navidrome.org>
132 lines
2.6 KiB
Go
132 lines
2.6 KiB
Go
//go:build wireinject
|
|
|
|
package cmd
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/google/wire"
|
|
"github.com/navidrome/navidrome/core"
|
|
"github.com/navidrome/navidrome/core/agents"
|
|
"github.com/navidrome/navidrome/core/agents/lastfm"
|
|
"github.com/navidrome/navidrome/core/agents/listenbrainz"
|
|
"github.com/navidrome/navidrome/core/artwork"
|
|
"github.com/navidrome/navidrome/core/metrics"
|
|
"github.com/navidrome/navidrome/core/playback"
|
|
"github.com/navidrome/navidrome/core/scrobbler"
|
|
"github.com/navidrome/navidrome/db"
|
|
"github.com/navidrome/navidrome/model"
|
|
"github.com/navidrome/navidrome/persistence"
|
|
"github.com/navidrome/navidrome/plugins"
|
|
"github.com/navidrome/navidrome/scanner"
|
|
"github.com/navidrome/navidrome/server"
|
|
"github.com/navidrome/navidrome/server/events"
|
|
"github.com/navidrome/navidrome/server/nativeapi"
|
|
"github.com/navidrome/navidrome/server/public"
|
|
"github.com/navidrome/navidrome/server/subsonic"
|
|
)
|
|
|
|
var allProviders = wire.NewSet(
|
|
core.Set,
|
|
artwork.Set,
|
|
server.New,
|
|
subsonic.New,
|
|
nativeapi.New,
|
|
public.New,
|
|
persistence.New,
|
|
lastfm.NewRouter,
|
|
listenbrainz.NewRouter,
|
|
events.GetBroker,
|
|
scanner.New,
|
|
scanner.NewWatcher,
|
|
plugins.GetManager,
|
|
metrics.GetPrometheusInstance,
|
|
db.Db,
|
|
wire.Bind(new(agents.PluginLoader), new(plugins.Manager)),
|
|
wire.Bind(new(scrobbler.PluginLoader), new(plugins.Manager)),
|
|
)
|
|
|
|
func CreateDataStore() model.DataStore {
|
|
panic(wire.Build(
|
|
allProviders,
|
|
))
|
|
}
|
|
|
|
func CreateServer() *server.Server {
|
|
panic(wire.Build(
|
|
allProviders,
|
|
))
|
|
}
|
|
|
|
func CreateNativeAPIRouter() *nativeapi.Router {
|
|
panic(wire.Build(
|
|
allProviders,
|
|
))
|
|
}
|
|
|
|
func CreateSubsonicAPIRouter(ctx context.Context) *subsonic.Router {
|
|
panic(wire.Build(
|
|
allProviders,
|
|
))
|
|
}
|
|
|
|
func CreatePublicRouter() *public.Router {
|
|
panic(wire.Build(
|
|
allProviders,
|
|
))
|
|
}
|
|
|
|
func CreateLastFMRouter() *lastfm.Router {
|
|
panic(wire.Build(
|
|
allProviders,
|
|
))
|
|
}
|
|
|
|
func CreateListenBrainzRouter() *listenbrainz.Router {
|
|
panic(wire.Build(
|
|
allProviders,
|
|
))
|
|
}
|
|
|
|
func CreateInsights() metrics.Insights {
|
|
panic(wire.Build(
|
|
allProviders,
|
|
))
|
|
}
|
|
|
|
func CreatePrometheus() metrics.Metrics {
|
|
panic(wire.Build(
|
|
allProviders,
|
|
))
|
|
}
|
|
|
|
func CreateScanner(ctx context.Context) scanner.Scanner {
|
|
panic(wire.Build(
|
|
allProviders,
|
|
))
|
|
}
|
|
|
|
func CreateScanWatcher(ctx context.Context) scanner.Watcher {
|
|
panic(wire.Build(
|
|
allProviders,
|
|
))
|
|
}
|
|
|
|
func GetPlaybackServer() playback.PlaybackServer {
|
|
panic(wire.Build(
|
|
allProviders,
|
|
))
|
|
}
|
|
|
|
func getPluginManager() plugins.Manager {
|
|
panic(wire.Build(
|
|
allProviders,
|
|
))
|
|
}
|
|
|
|
func GetPluginManager(ctx context.Context) plugins.Manager {
|
|
manager := getPluginManager()
|
|
manager.SetSubsonicRouter(CreateSubsonicAPIRouter(ctx))
|
|
return manager
|
|
}
|