mirror of
https://github.com/lidarr/lidarr.git
synced 2025-07-15 09:33:52 -07:00
Fixed: Correctly page through Spotify followed artists
This commit is contained in:
parent
f4e4bae465
commit
ea8d19a513
3 changed files with 9 additions and 8 deletions
|
@ -132,8 +132,8 @@ namespace NzbDrone.Core.Test.ImportListTests
|
||||||
Mocker.GetMock<ISpotifyProxy>()
|
Mocker.GetMock<ISpotifyProxy>()
|
||||||
.Setup(x => x.GetNextPage(It.IsAny<SpotifyFollowedArtists>(),
|
.Setup(x => x.GetNextPage(It.IsAny<SpotifyFollowedArtists>(),
|
||||||
It.IsAny<SpotifyWebAPI>(),
|
It.IsAny<SpotifyWebAPI>(),
|
||||||
It.IsAny<CursorPaging<FullArtist>>()))
|
It.IsAny<FollowedArtists>()))
|
||||||
.Returns(default(CursorPaging<FullArtist>));
|
.Returns(default(FollowedArtists));
|
||||||
|
|
||||||
var result = Subject.Fetch(api);
|
var result = Subject.Fetch(api);
|
||||||
|
|
||||||
|
@ -142,7 +142,7 @@ namespace NzbDrone.Core.Test.ImportListTests
|
||||||
Mocker.GetMock<ISpotifyProxy>()
|
Mocker.GetMock<ISpotifyProxy>()
|
||||||
.Verify(v => v.GetNextPage(It.IsAny<SpotifyFollowedArtists>(),
|
.Verify(v => v.GetNextPage(It.IsAny<SpotifyFollowedArtists>(),
|
||||||
It.IsAny<SpotifyWebAPI>(),
|
It.IsAny<SpotifyWebAPI>(),
|
||||||
It.IsAny<CursorPaging<FullArtist>>()),
|
It.IsAny<FollowedArtists>()),
|
||||||
Times.Once());
|
Times.Once());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -54,7 +54,8 @@ namespace NzbDrone.Core.ImportLists.Spotify
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
artists = _spotifyProxy.GetNextPage(this, api, artists);
|
followedArtists = _spotifyProxy.GetNextPage(this, api, followedArtists);
|
||||||
|
artists = followedArtists?.Artists;
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
|
|
@ -20,7 +20,7 @@ namespace NzbDrone.Core.ImportLists.Spotify
|
||||||
where TSettings : SpotifySettingsBase<TSettings>, new();
|
where TSettings : SpotifySettingsBase<TSettings>, new();
|
||||||
Paging<T> GetNextPage<T, TSettings>(SpotifyImportListBase<TSettings> list, SpotifyWebAPI api, Paging<T> item)
|
Paging<T> GetNextPage<T, TSettings>(SpotifyImportListBase<TSettings> list, SpotifyWebAPI api, Paging<T> item)
|
||||||
where TSettings : SpotifySettingsBase<TSettings>, new();
|
where TSettings : SpotifySettingsBase<TSettings>, new();
|
||||||
CursorPaging<T> GetNextPage<T, TSettings>(SpotifyImportListBase<TSettings> list, SpotifyWebAPI api, CursorPaging<T> item)
|
FollowedArtists GetNextPage<TSettings>(SpotifyImportListBase<TSettings> list, SpotifyWebAPI api, FollowedArtists item)
|
||||||
where TSettings : SpotifySettingsBase<TSettings>, new();
|
where TSettings : SpotifySettingsBase<TSettings>, new();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ namespace NzbDrone.Core.ImportLists.Spotify
|
||||||
public FollowedArtists GetFollowedArtists<TSettings>(SpotifyImportListBase<TSettings> list, SpotifyWebAPI api)
|
public FollowedArtists GetFollowedArtists<TSettings>(SpotifyImportListBase<TSettings> list, SpotifyWebAPI api)
|
||||||
where TSettings : SpotifySettingsBase<TSettings>, new()
|
where TSettings : SpotifySettingsBase<TSettings>, new()
|
||||||
{
|
{
|
||||||
return Execute(list, api, x => x.GetFollowedArtists(FollowType.Artist));
|
return Execute(list, api, x => x.GetFollowedArtists(FollowType.Artist, 50));
|
||||||
}
|
}
|
||||||
|
|
||||||
public Paging<SavedAlbum> GetSavedAlbums<TSettings>(SpotifyImportListBase<TSettings> list, SpotifyWebAPI api)
|
public Paging<SavedAlbum> GetSavedAlbums<TSettings>(SpotifyImportListBase<TSettings> list, SpotifyWebAPI api)
|
||||||
|
@ -69,10 +69,10 @@ namespace NzbDrone.Core.ImportLists.Spotify
|
||||||
return Execute(list, api, (x) => x.GetNextPage(item));
|
return Execute(list, api, (x) => x.GetNextPage(item));
|
||||||
}
|
}
|
||||||
|
|
||||||
public CursorPaging<T> GetNextPage<T, TSettings>(SpotifyImportListBase<TSettings> list, SpotifyWebAPI api, CursorPaging<T> item)
|
public FollowedArtists GetNextPage<TSettings>(SpotifyImportListBase<TSettings> list, SpotifyWebAPI api, FollowedArtists item)
|
||||||
where TSettings : SpotifySettingsBase<TSettings>, new()
|
where TSettings : SpotifySettingsBase<TSettings>, new()
|
||||||
{
|
{
|
||||||
return Execute(list, api, (x) => x.GetNextPage(item));
|
return Execute(list, api, (x) => x.GetNextPage<FollowedArtists, FullArtist>(item.Artists));
|
||||||
}
|
}
|
||||||
|
|
||||||
public T Execute<T, TSettings>(SpotifyImportListBase<TSettings> list, SpotifyWebAPI api, Func<SpotifyWebAPI, T> method, bool allowReauth = true)
|
public T Execute<T, TSettings>(SpotifyImportListBase<TSettings> list, SpotifyWebAPI api, Func<SpotifyWebAPI, T> method, bool allowReauth = true)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue