mirror of
https://github.com/navidrome/navidrome.git
synced 2025-04-03 20:47:35 +03:00
107 lines
3.2 KiB
Go
107 lines
3.2 KiB
Go
// Code generated by Wire. DO NOT EDIT.
|
|
|
|
//go:generate go run github.com/google/wire/cmd/wire
|
|
//go:build !wireinject
|
|
// +build !wireinject
|
|
|
|
package cmd
|
|
|
|
import (
|
|
"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/ffmpeg"
|
|
"github.com/navidrome/navidrome/core/scrobbler"
|
|
"github.com/navidrome/navidrome/db"
|
|
"github.com/navidrome/navidrome/persistence"
|
|
"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/subsonic"
|
|
"sync"
|
|
)
|
|
|
|
// Injectors from wire_injectors.go:
|
|
|
|
func CreateServer(musicFolder string) *server.Server {
|
|
sqlDB := db.Db()
|
|
dataStore := persistence.New(sqlDB)
|
|
serverServer := server.New(dataStore)
|
|
return serverServer
|
|
}
|
|
|
|
func CreateNativeAPIRouter() *nativeapi.Router {
|
|
sqlDB := db.Db()
|
|
dataStore := persistence.New(sqlDB)
|
|
broker := events.GetBroker()
|
|
share := core.NewShare(dataStore)
|
|
router := nativeapi.New(dataStore, broker, share)
|
|
return router
|
|
}
|
|
|
|
func CreateSubsonicAPIRouter() *subsonic.Router {
|
|
sqlDB := db.Db()
|
|
dataStore := persistence.New(sqlDB)
|
|
fileCache := core.GetImageCache()
|
|
fFmpeg := ffmpeg.New()
|
|
artwork := core.NewArtwork(dataStore, fileCache, fFmpeg)
|
|
transcodingCache := core.GetTranscodingCache()
|
|
mediaStreamer := core.NewMediaStreamer(dataStore, fFmpeg, transcodingCache)
|
|
archiver := core.NewArchiver(mediaStreamer, dataStore)
|
|
players := core.NewPlayers(dataStore)
|
|
agentsAgents := agents.New(dataStore)
|
|
externalMetadata := core.NewExternalMetadata(dataStore, agentsAgents)
|
|
scanner := GetScanner()
|
|
broker := events.GetBroker()
|
|
playlists := core.NewPlaylists(dataStore)
|
|
playTracker := scrobbler.GetPlayTracker(dataStore, broker)
|
|
router := subsonic.New(dataStore, artwork, mediaStreamer, archiver, players, externalMetadata, scanner, broker, playlists, playTracker)
|
|
return router
|
|
}
|
|
|
|
func CreateLastFMRouter() *lastfm.Router {
|
|
sqlDB := db.Db()
|
|
dataStore := persistence.New(sqlDB)
|
|
router := lastfm.NewRouter(dataStore)
|
|
return router
|
|
}
|
|
|
|
func CreateListenBrainzRouter() *listenbrainz.Router {
|
|
sqlDB := db.Db()
|
|
dataStore := persistence.New(sqlDB)
|
|
router := listenbrainz.NewRouter(dataStore)
|
|
return router
|
|
}
|
|
|
|
func createScanner() scanner.Scanner {
|
|
sqlDB := db.Db()
|
|
dataStore := persistence.New(sqlDB)
|
|
playlists := core.NewPlaylists(dataStore)
|
|
fileCache := core.GetImageCache()
|
|
fFmpeg := ffmpeg.New()
|
|
artwork := core.NewArtwork(dataStore, fileCache, fFmpeg)
|
|
cacheWarmer := core.NewArtworkCacheWarmer(artwork)
|
|
broker := events.GetBroker()
|
|
scannerScanner := scanner.New(dataStore, playlists, cacheWarmer, broker)
|
|
return scannerScanner
|
|
}
|
|
|
|
// wire_injectors.go:
|
|
|
|
var allProviders = wire.NewSet(core.Set, subsonic.New, nativeapi.New, persistence.New, lastfm.NewRouter, listenbrainz.NewRouter, events.GetBroker, db.Db)
|
|
|
|
// Scanner must be a Singleton
|
|
var (
|
|
onceScanner sync.Once
|
|
scannerInstance scanner.Scanner
|
|
)
|
|
|
|
func GetScanner() scanner.Scanner {
|
|
onceScanner.Do(func() {
|
|
scannerInstance = createScanner()
|
|
})
|
|
return scannerInstance
|
|
}
|