mirror of
https://github.com/navidrome/navidrome.git
synced 2025-04-03 20:47:35 +03:00
Moved ledis implementation to a new package
This commit is contained in:
parent
a4a8360a94
commit
018352463f
19 changed files with 56 additions and 56 deletions
|
@ -8,9 +8,9 @@ package api
|
|||
import (
|
||||
"github.com/cloudsonic/sonic-server/engine"
|
||||
"github.com/cloudsonic/sonic-server/itunesbridge"
|
||||
"github.com/cloudsonic/sonic-server/persistence"
|
||||
"github.com/cloudsonic/sonic-server/persistence/ledis"
|
||||
"github.com/deluan/gomate"
|
||||
"github.com/deluan/gomate/ledis"
|
||||
ledis2 "github.com/deluan/gomate/ledis"
|
||||
"github.com/google/wire"
|
||||
)
|
||||
|
||||
|
@ -22,21 +22,21 @@ func initSystemController() *SystemController {
|
|||
}
|
||||
|
||||
func initBrowsingController() *BrowsingController {
|
||||
propertyRepository := persistence.NewPropertyRepository()
|
||||
mediaFolderRepository := persistence.NewMediaFolderRepository()
|
||||
artistIndexRepository := persistence.NewArtistIndexRepository()
|
||||
artistRepository := persistence.NewArtistRepository()
|
||||
albumRepository := persistence.NewAlbumRepository()
|
||||
mediaFileRepository := persistence.NewMediaFileRepository()
|
||||
propertyRepository := ledis.NewPropertyRepository()
|
||||
mediaFolderRepository := ledis.NewMediaFolderRepository()
|
||||
artistIndexRepository := ledis.NewArtistIndexRepository()
|
||||
artistRepository := ledis.NewArtistRepository()
|
||||
albumRepository := ledis.NewAlbumRepository()
|
||||
mediaFileRepository := ledis.NewMediaFileRepository()
|
||||
browser := engine.NewBrowser(propertyRepository, mediaFolderRepository, artistIndexRepository, artistRepository, albumRepository, mediaFileRepository)
|
||||
browsingController := NewBrowsingController(browser)
|
||||
return browsingController
|
||||
}
|
||||
|
||||
func initAlbumListController() *AlbumListController {
|
||||
albumRepository := persistence.NewAlbumRepository()
|
||||
mediaFileRepository := persistence.NewMediaFileRepository()
|
||||
nowPlayingRepository := persistence.NewNowPlayingRepository()
|
||||
albumRepository := ledis.NewAlbumRepository()
|
||||
mediaFileRepository := ledis.NewMediaFileRepository()
|
||||
nowPlayingRepository := ledis.NewNowPlayingRepository()
|
||||
listGenerator := engine.NewListGenerator(albumRepository, mediaFileRepository, nowPlayingRepository)
|
||||
albumListController := NewAlbumListController(listGenerator)
|
||||
return albumListController
|
||||
|
@ -44,11 +44,11 @@ func initAlbumListController() *AlbumListController {
|
|||
|
||||
func initMediaAnnotationController() *MediaAnnotationController {
|
||||
itunesControl := itunesbridge.NewItunesControl()
|
||||
mediaFileRepository := persistence.NewMediaFileRepository()
|
||||
nowPlayingRepository := persistence.NewNowPlayingRepository()
|
||||
mediaFileRepository := ledis.NewMediaFileRepository()
|
||||
nowPlayingRepository := ledis.NewNowPlayingRepository()
|
||||
scrobbler := engine.NewScrobbler(itunesControl, mediaFileRepository, nowPlayingRepository)
|
||||
albumRepository := persistence.NewAlbumRepository()
|
||||
artistRepository := persistence.NewArtistRepository()
|
||||
albumRepository := ledis.NewAlbumRepository()
|
||||
artistRepository := ledis.NewArtistRepository()
|
||||
ratings := engine.NewRatings(itunesControl, mediaFileRepository, albumRepository, artistRepository)
|
||||
mediaAnnotationController := NewMediaAnnotationController(scrobbler, ratings)
|
||||
return mediaAnnotationController
|
||||
|
@ -56,17 +56,17 @@ func initMediaAnnotationController() *MediaAnnotationController {
|
|||
|
||||
func initPlaylistsController() *PlaylistsController {
|
||||
itunesControl := itunesbridge.NewItunesControl()
|
||||
playlistRepository := persistence.NewPlaylistRepository()
|
||||
mediaFileRepository := persistence.NewMediaFileRepository()
|
||||
playlistRepository := ledis.NewPlaylistRepository()
|
||||
mediaFileRepository := ledis.NewMediaFileRepository()
|
||||
playlists := engine.NewPlaylists(itunesControl, playlistRepository, mediaFileRepository)
|
||||
playlistsController := NewPlaylistsController(playlists)
|
||||
return playlistsController
|
||||
}
|
||||
|
||||
func initSearchingController() *SearchingController {
|
||||
artistRepository := persistence.NewArtistRepository()
|
||||
albumRepository := persistence.NewAlbumRepository()
|
||||
mediaFileRepository := persistence.NewMediaFileRepository()
|
||||
artistRepository := ledis.NewArtistRepository()
|
||||
albumRepository := ledis.NewAlbumRepository()
|
||||
mediaFileRepository := ledis.NewMediaFileRepository()
|
||||
db := newDB()
|
||||
search := engine.NewSearch(artistRepository, albumRepository, mediaFileRepository, db)
|
||||
searchingController := NewSearchingController(search)
|
||||
|
@ -79,22 +79,22 @@ func initUsersController() *UsersController {
|
|||
}
|
||||
|
||||
func initMediaRetrievalController() *MediaRetrievalController {
|
||||
mediaFileRepository := persistence.NewMediaFileRepository()
|
||||
albumRepository := persistence.NewAlbumRepository()
|
||||
mediaFileRepository := ledis.NewMediaFileRepository()
|
||||
albumRepository := ledis.NewAlbumRepository()
|
||||
cover := engine.NewCover(mediaFileRepository, albumRepository)
|
||||
mediaRetrievalController := NewMediaRetrievalController(cover)
|
||||
return mediaRetrievalController
|
||||
}
|
||||
|
||||
func initStreamController() *StreamController {
|
||||
mediaFileRepository := persistence.NewMediaFileRepository()
|
||||
mediaFileRepository := ledis.NewMediaFileRepository()
|
||||
streamController := NewStreamController(mediaFileRepository)
|
||||
return streamController
|
||||
}
|
||||
|
||||
// wire_injectors.go:
|
||||
|
||||
var allProviders = wire.NewSet(itunesbridge.NewItunesControl, persistence.Set, engine.Set, NewSystemController,
|
||||
var allProviders = wire.NewSet(itunesbridge.NewItunesControl, ledis.Set, engine.Set, NewSystemController,
|
||||
NewBrowsingController,
|
||||
NewAlbumListController,
|
||||
NewMediaAnnotationController,
|
||||
|
@ -107,5 +107,5 @@ var allProviders = wire.NewSet(itunesbridge.NewItunesControl, persistence.Set, e
|
|||
)
|
||||
|
||||
func newDB() gomate.DB {
|
||||
return ledis.NewEmbeddedDB(persistence.Db())
|
||||
return ledis2.NewEmbeddedDB(ledis.Db())
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@ package api
|
|||
import (
|
||||
"github.com/cloudsonic/sonic-server/engine"
|
||||
"github.com/cloudsonic/sonic-server/itunesbridge"
|
||||
"github.com/cloudsonic/sonic-server/persistence"
|
||||
ledis2 "github.com/cloudsonic/sonic-server/persistence/ledis"
|
||||
"github.com/deluan/gomate"
|
||||
"github.com/deluan/gomate/ledis"
|
||||
"github.com/google/wire"
|
||||
|
@ -13,7 +13,7 @@ import (
|
|||
|
||||
var allProviders = wire.NewSet(
|
||||
itunesbridge.NewItunesControl,
|
||||
persistence.Set,
|
||||
ledis2.Set,
|
||||
engine.Set,
|
||||
NewSystemController,
|
||||
NewBrowsingController,
|
||||
|
@ -64,5 +64,5 @@ func initStreamController() *StreamController {
|
|||
}
|
||||
|
||||
func newDB() gomate.DB {
|
||||
return ledis.NewEmbeddedDB(persistence.Db())
|
||||
return ledis.NewEmbeddedDB(ledis2.Db())
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package persistence
|
||||
package ledis
|
||||
|
||||
import (
|
||||
"errors"
|
|
@ -1,4 +1,4 @@
|
|||
package persistence
|
||||
package ledis
|
||||
|
||||
import (
|
||||
"errors"
|
|
@ -1,4 +1,4 @@
|
|||
package persistence
|
||||
package ledis
|
||||
|
||||
import (
|
||||
"errors"
|
|
@ -1,4 +1,4 @@
|
|||
package persistence
|
||||
package ledis
|
||||
|
||||
import (
|
||||
"errors"
|
|
@ -1,4 +1,4 @@
|
|||
package persistence
|
||||
package ledis
|
||||
|
||||
import (
|
||||
"strconv"
|
|
@ -1,4 +1,4 @@
|
|||
package persistence
|
||||
package ledis
|
||||
|
||||
import (
|
||||
"sync"
|
|
@ -1,4 +1,4 @@
|
|||
package persistence
|
||||
package ledis
|
||||
|
||||
import (
|
||||
"crypto/md5"
|
|
@ -1,4 +1,4 @@
|
|||
package persistence
|
||||
package ledis
|
||||
|
||||
import (
|
||||
"fmt"
|
|
@ -1,4 +1,4 @@
|
|||
package persistence
|
||||
package ledis
|
||||
|
||||
import (
|
||||
"errors"
|
|
@ -1,4 +1,4 @@
|
|||
package persistence
|
||||
package ledis
|
||||
|
||||
import (
|
||||
"github.com/cloudsonic/sonic-server/conf"
|
|
@ -1,4 +1,4 @@
|
|||
package persistence
|
||||
package ledis
|
||||
|
||||
import (
|
||||
"encoding/json"
|
|
@ -1,4 +1,4 @@
|
|||
package persistence
|
||||
package ledis
|
||||
|
||||
import (
|
||||
"errors"
|
|
@ -1,4 +1,4 @@
|
|||
package persistence
|
||||
package ledis
|
||||
|
||||
import (
|
||||
"errors"
|
|
@ -1,4 +1,4 @@
|
|||
package persistence
|
||||
package ledis
|
||||
|
||||
import "github.com/google/wire"
|
||||
|
22
wire_gen.go
22
wire_gen.go
|
@ -8,24 +8,24 @@ package main
|
|||
import (
|
||||
"github.com/cloudsonic/sonic-server/engine"
|
||||
"github.com/cloudsonic/sonic-server/itunesbridge"
|
||||
"github.com/cloudsonic/sonic-server/persistence"
|
||||
"github.com/cloudsonic/sonic-server/persistence/ledis"
|
||||
"github.com/cloudsonic/sonic-server/scanner"
|
||||
"github.com/deluan/gomate"
|
||||
"github.com/deluan/gomate/ledis"
|
||||
ledis2 "github.com/deluan/gomate/ledis"
|
||||
"github.com/google/wire"
|
||||
)
|
||||
|
||||
// Injectors from wire_injectors.go:
|
||||
|
||||
func initImporter(musicFolder string) *scanner.Importer {
|
||||
checkSumRepository := persistence.NewCheckSumRepository()
|
||||
checkSumRepository := ledis.NewCheckSumRepository()
|
||||
itunesScanner := scanner.NewItunesScanner(checkSumRepository)
|
||||
mediaFileRepository := persistence.NewMediaFileRepository()
|
||||
albumRepository := persistence.NewAlbumRepository()
|
||||
artistRepository := persistence.NewArtistRepository()
|
||||
artistIndexRepository := persistence.NewArtistIndexRepository()
|
||||
playlistRepository := persistence.NewPlaylistRepository()
|
||||
propertyRepository := persistence.NewPropertyRepository()
|
||||
mediaFileRepository := ledis.NewMediaFileRepository()
|
||||
albumRepository := ledis.NewAlbumRepository()
|
||||
artistRepository := ledis.NewArtistRepository()
|
||||
artistIndexRepository := ledis.NewArtistIndexRepository()
|
||||
playlistRepository := ledis.NewPlaylistRepository()
|
||||
propertyRepository := ledis.NewPropertyRepository()
|
||||
db := newDB()
|
||||
search := engine.NewSearch(artistRepository, albumRepository, mediaFileRepository, db)
|
||||
importer := scanner.NewImporter(musicFolder, itunesScanner, mediaFileRepository, albumRepository, artistRepository, artistIndexRepository, playlistRepository, propertyRepository, search)
|
||||
|
@ -34,8 +34,8 @@ func initImporter(musicFolder string) *scanner.Importer {
|
|||
|
||||
// wire_injectors.go:
|
||||
|
||||
var allProviders = wire.NewSet(itunesbridge.NewItunesControl, persistence.Set, engine.Set, scanner.Set, newDB)
|
||||
var allProviders = wire.NewSet(itunesbridge.NewItunesControl, ledis.Set, engine.Set, scanner.Set, newDB)
|
||||
|
||||
func newDB() gomate.DB {
|
||||
return ledis.NewEmbeddedDB(persistence.Db())
|
||||
return ledis2.NewEmbeddedDB(ledis.Db())
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@ package main
|
|||
import (
|
||||
"github.com/cloudsonic/sonic-server/engine"
|
||||
"github.com/cloudsonic/sonic-server/itunesbridge"
|
||||
"github.com/cloudsonic/sonic-server/persistence"
|
||||
ledis2 "github.com/cloudsonic/sonic-server/persistence/ledis"
|
||||
"github.com/cloudsonic/sonic-server/scanner"
|
||||
"github.com/deluan/gomate"
|
||||
"github.com/deluan/gomate/ledis"
|
||||
|
@ -14,7 +14,7 @@ import (
|
|||
|
||||
var allProviders = wire.NewSet(
|
||||
itunesbridge.NewItunesControl,
|
||||
persistence.Set,
|
||||
ledis2.Set,
|
||||
engine.Set,
|
||||
scanner.Set,
|
||||
newDB,
|
||||
|
@ -25,5 +25,5 @@ func initImporter(musicFolder string) *scanner.Importer {
|
|||
}
|
||||
|
||||
func newDB() gomate.DB {
|
||||
return ledis.NewEmbeddedDB(persistence.Db())
|
||||
return ledis.NewEmbeddedDB(ledis2.Db())
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue