Fixed: Correctly page through Spotify followed artists

pull/1689/head
ta264 5 years ago committed by Qstick
parent 81ffc4e28f
commit ed357181ef

@ -132,8 +132,8 @@ namespace NzbDrone.Core.Test.ImportListTests
Mocker.GetMock<ISpotifyProxy>()
.Setup(x => x.GetNextPage(It.IsAny<SpotifyFollowedArtists>(),
It.IsAny<SpotifyWebAPI>(),
It.IsAny<CursorPaging<FullArtist>>()))
.Returns(default(CursorPaging<FullArtist>));
It.IsAny<FollowedArtists>()))
.Returns(default(FollowedArtists));
var result = Subject.Fetch(api);
@ -142,7 +142,7 @@ namespace NzbDrone.Core.Test.ImportListTests
Mocker.GetMock<ISpotifyProxy>()
.Verify(v => v.GetNextPage(It.IsAny<SpotifyFollowedArtists>(),
It.IsAny<SpotifyWebAPI>(),
It.IsAny<CursorPaging<FullArtist>>()),
It.IsAny<FollowedArtists>()),
Times.Once());
}

@ -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;

@ -20,7 +20,7 @@ namespace NzbDrone.Core.ImportLists.Spotify
where TSettings : SpotifySettingsBase<TSettings>, new();
Paging<T> GetNextPage<T, TSettings>(SpotifyImportListBase<TSettings> list, SpotifyWebAPI api, Paging<T> item)
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();
}
@ -48,7 +48,7 @@ namespace NzbDrone.Core.ImportLists.Spotify
public FollowedArtists GetFollowedArtists<TSettings>(SpotifyImportListBase<TSettings> list, SpotifyWebAPI api)
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)
@ -69,10 +69,10 @@ namespace NzbDrone.Core.ImportLists.Spotify
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()
{
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)

Loading…
Cancel
Save