mirror of
https://github.com/Lidarr/Lidarr
synced 2026-01-24 16:31:54 +01:00
Update src/NzbDrone.Core/ImportLists/Discogs/DiscogsListsRequestGenerator.cs
Co-authored-by: Bogdan <mynameisbogdan@users.noreply.github.com>
This commit is contained in:
parent
c6f14c3975
commit
55c9b5428d
1 changed files with 7 additions and 10 deletions
|
|
@ -5,29 +5,26 @@ namespace NzbDrone.Core.ImportLists.Discogs
|
|||
{
|
||||
public class DiscogsListsRequestGenerator : IImportListRequestGenerator
|
||||
{
|
||||
public DiscogsListsSettings Settings { get; set; }
|
||||
private readonly DiscogsListsSettings _settings;
|
||||
|
||||
public int MaxPages { get; set; }
|
||||
public int PageSize { get; set; }
|
||||
|
||||
public DiscogsListsRequestGenerator()
|
||||
public DiscogsListsRequestGenerator(DiscogsListsSettings settings)
|
||||
{
|
||||
MaxPages = 1;
|
||||
PageSize = 0; // Discogs doesn't support pagination for lists currently
|
||||
_settings = settings;
|
||||
}
|
||||
|
||||
public virtual ImportListPageableRequestChain GetListItems()
|
||||
{
|
||||
var pageableRequests = new ImportListPageableRequestChain();
|
||||
pageableRequests.Add(GetPagedRequests());
|
||||
|
||||
return pageableRequests;
|
||||
}
|
||||
|
||||
private IEnumerable<ImportListRequest> GetPagedRequests()
|
||||
{
|
||||
var request = new HttpRequestBuilder(Settings.BaseUrl.TrimEnd('/'))
|
||||
.Resource($"/lists/{Settings.ListId}")
|
||||
.SetHeader("Authorization", $"Discogs token={Settings.Token}")
|
||||
var request = new HttpRequestBuilder(_settings.BaseUrl.TrimEnd('/'))
|
||||
.Resource($"/lists/{_settings.ListId}")
|
||||
.SetHeader("Authorization", $"Discogs token={_settings.Token}")
|
||||
.Build();
|
||||
|
||||
yield return new ImportListRequest(request);
|
||||
|
|
|
|||
Loading…
Reference in a new issue