From ea8d19a513c20b573ce03b1fd73ca829aa1e3150 Mon Sep 17 00:00:00 2001 From: ta264 Date: Tue, 24 Sep 2019 21:04:46 +0100 Subject: [PATCH] Fixed: Correctly page through Spotify followed artists --- .../Spotify/SpotifyFollowedArtistsFixture.cs | 6 +++--- .../ImportLists/Spotify/SpotifyFollowedArtists.cs | 3 ++- src/NzbDrone.Core/ImportLists/Spotify/SpotifyProxy.cs | 8 ++++---- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/NzbDrone.Core.Test/ImportListTests/Spotify/SpotifyFollowedArtistsFixture.cs b/src/NzbDrone.Core.Test/ImportListTests/Spotify/SpotifyFollowedArtistsFixture.cs index 982df6e61..9c3627761 100644 --- a/src/NzbDrone.Core.Test/ImportListTests/Spotify/SpotifyFollowedArtistsFixture.cs +++ b/src/NzbDrone.Core.Test/ImportListTests/Spotify/SpotifyFollowedArtistsFixture.cs @@ -132,8 +132,8 @@ namespace NzbDrone.Core.Test.ImportListTests Mocker.GetMock() .Setup(x => x.GetNextPage(It.IsAny(), It.IsAny(), - It.IsAny>())) - .Returns(default(CursorPaging)); + It.IsAny())) + .Returns(default(FollowedArtists)); var result = Subject.Fetch(api); @@ -142,7 +142,7 @@ namespace NzbDrone.Core.Test.ImportListTests Mocker.GetMock() .Verify(v => v.GetNextPage(It.IsAny(), It.IsAny(), - It.IsAny>()), + It.IsAny()), Times.Once()); } diff --git a/src/NzbDrone.Core/ImportLists/Spotify/SpotifyFollowedArtists.cs b/src/NzbDrone.Core/ImportLists/Spotify/SpotifyFollowedArtists.cs index 6a9bdd92a..5897af015 100644 --- a/src/NzbDrone.Core/ImportLists/Spotify/SpotifyFollowedArtists.cs +++ b/src/NzbDrone.Core/ImportLists/Spotify/SpotifyFollowedArtists.cs @@ -54,7 +54,8 @@ namespace NzbDrone.Core.ImportLists.Spotify break; } - artists = _spotifyProxy.GetNextPage(this, api, artists); + followedArtists = _spotifyProxy.GetNextPage(this, api, followedArtists); + artists = followedArtists?.Artists; } return result; diff --git a/src/NzbDrone.Core/ImportLists/Spotify/SpotifyProxy.cs b/src/NzbDrone.Core/ImportLists/Spotify/SpotifyProxy.cs index bcaa5cca9..72e2464e9 100644 --- a/src/NzbDrone.Core/ImportLists/Spotify/SpotifyProxy.cs +++ b/src/NzbDrone.Core/ImportLists/Spotify/SpotifyProxy.cs @@ -20,7 +20,7 @@ namespace NzbDrone.Core.ImportLists.Spotify where TSettings : SpotifySettingsBase, new(); Paging GetNextPage(SpotifyImportListBase list, SpotifyWebAPI api, Paging item) where TSettings : SpotifySettingsBase, new(); - CursorPaging GetNextPage(SpotifyImportListBase list, SpotifyWebAPI api, CursorPaging item) + FollowedArtists GetNextPage(SpotifyImportListBase list, SpotifyWebAPI api, FollowedArtists item) where TSettings : SpotifySettingsBase, new(); } @@ -48,7 +48,7 @@ namespace NzbDrone.Core.ImportLists.Spotify public FollowedArtists GetFollowedArtists(SpotifyImportListBase list, SpotifyWebAPI api) where TSettings : SpotifySettingsBase, new() { - return Execute(list, api, x => x.GetFollowedArtists(FollowType.Artist)); + return Execute(list, api, x => x.GetFollowedArtists(FollowType.Artist, 50)); } public Paging GetSavedAlbums(SpotifyImportListBase list, SpotifyWebAPI api) @@ -69,10 +69,10 @@ namespace NzbDrone.Core.ImportLists.Spotify return Execute(list, api, (x) => x.GetNextPage(item)); } - public CursorPaging GetNextPage(SpotifyImportListBase list, SpotifyWebAPI api, CursorPaging item) + public FollowedArtists GetNextPage(SpotifyImportListBase list, SpotifyWebAPI api, FollowedArtists item) where TSettings : SpotifySettingsBase, new() { - return Execute(list, api, (x) => x.GetNextPage(item)); + return Execute(list, api, (x) => x.GetNextPage(item.Artists)); } public T Execute(SpotifyImportListBase list, SpotifyWebAPI api, Func method, bool allowReauth = true)