mirror of
https://github.com/navidrome/navidrome.git
synced 2025-04-03 20:47:35 +03:00
Remove "Biography not available" when agents are not available
This commit is contained in:
parent
3f2d24695e
commit
0ffef05cc3
3 changed files with 6 additions and 12 deletions
|
@ -30,9 +30,6 @@ var _ = Describe("Agents", func() {
|
|||
ag = New(ds)
|
||||
})
|
||||
|
||||
It("calls the placeholder GetBiography", func() {
|
||||
Expect(ag.GetBiography(ctx, "123", "John Doe", "mb123")).To(Equal(localBiography))
|
||||
})
|
||||
It("calls the placeholder GetImages", func() {
|
||||
mfRepo.SetData(model.MediaFiles{{ID: "1", Title: "One", MbzReleaseTrackID: "111"}, {ID: "2", Title: "Two", MbzReleaseTrackID: "222"}})
|
||||
songs, err := ag.GetTopSongs(ctx, "123", "John Doe", "mb123", 2)
|
||||
|
@ -104,7 +101,8 @@ var _ = Describe("Agents", func() {
|
|||
})
|
||||
It("skips the agent if it returns an error", func() {
|
||||
mock.Err = errors.New("error")
|
||||
Expect(ag.GetBiography(ctx, "123", "test", "mb123")).To(Equal(localBiography))
|
||||
_, err := ag.GetBiography(ctx, "123", "test", "mb123")
|
||||
Expect(err).To(MatchError(ErrNotFound))
|
||||
Expect(mock.Args).To(ConsistOf("123", "test", "mb123"))
|
||||
})
|
||||
It("interrupts if the context is canceled", func() {
|
||||
|
|
|
@ -9,10 +9,6 @@ import (
|
|||
|
||||
const LocalAgentName = "local"
|
||||
|
||||
const (
|
||||
localBiography = "Biography not available"
|
||||
)
|
||||
|
||||
type localAgent struct {
|
||||
ds model.DataStore
|
||||
}
|
||||
|
@ -25,10 +21,6 @@ func (p *localAgent) AgentName() string {
|
|||
return LocalAgentName
|
||||
}
|
||||
|
||||
func (p *localAgent) GetBiography(ctx context.Context, id, name, mbid string) (string, error) {
|
||||
return localBiography, nil
|
||||
}
|
||||
|
||||
func (p *localAgent) GetTopSongs(ctx context.Context, id, artistName, mbid string, count int) ([]Song, error) {
|
||||
top, err := p.ds.MediaFile(ctx).GetAll(model.QueryOptions{
|
||||
Sort: "playCount",
|
||||
|
|
|
@ -139,6 +139,10 @@ func (r *refresher) refreshArtists(ctx context.Context, ids ...string) error {
|
|||
grouped := slice.Group(albums, func(al model.Album) string { return al.AlbumArtistID })
|
||||
for _, group := range grouped {
|
||||
a := model.Albums(group).ToAlbumArtist()
|
||||
|
||||
// Force a external metadata lookup on next access
|
||||
a.ExternalInfoUpdatedAt = time.Time{}
|
||||
|
||||
err := repo.Put(&a)
|
||||
if err != nil {
|
||||
return err
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue