add initial Last.FM tests (#329)

* Move model into separate file

* Separate Last.FM client and scrobbler

* Use separate Last.FM client and scrobbler

* Fix playcount attribute name

* Add initial test for Last.FM client
This commit is contained in:
Gregor Zurowski
2023-05-20 13:24:03 +02:00
committed by GitHub
parent 6144ac7979
commit dbcccdc811
12 changed files with 572 additions and 359 deletions

View File

@@ -97,19 +97,25 @@ func New(opts Options) (*Server, error) {
opts.CacheAudioPath,
)
ctrlAdmin, err := ctrladmin.New(base, sessDB, podcast)
lastfmClient := lastfm.NewClient()
ctrlAdmin, err := ctrladmin.New(base, sessDB, podcast, lastfmClient)
if err != nil {
return nil, fmt.Errorf("create admin controller: %w", err)
}
ctrlSubsonic := &ctrlsubsonic.Controller{
Controller: base,
MusicPaths: opts.MusicPaths,
PodcastsPath: opts.PodcastPath,
CacheAudioPath: opts.CacheAudioPath,
CoverCachePath: opts.CoverCachePath,
Scrobblers: []scrobble.Scrobbler{&lastfm.Scrobbler{DB: opts.DB}, listenbrainz.NewScrobbler()},
Podcasts: podcast,
Transcoder: cacheTranscoder,
Scrobblers: []scrobble.Scrobbler{
lastfm.NewScrobbler(opts.DB, lastfmClient),
listenbrainz.NewScrobbler(),
},
Podcasts: podcast,
Transcoder: cacheTranscoder,
}
setupMisc(r, base)