|
|
@ -10,12 +10,18 @@ namespace NzbDrone.Core.Indexers.Waffles
|
|
|
|
public class WafflesRequestGenerator : IIndexerRequestGenerator
|
|
|
|
public class WafflesRequestGenerator : IIndexerRequestGenerator
|
|
|
|
{
|
|
|
|
{
|
|
|
|
public WafflesSettings Settings { get; set; }
|
|
|
|
public WafflesSettings Settings { get; set; }
|
|
|
|
|
|
|
|
public int MaxPages { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public WafflesRequestGenerator()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
MaxPages = 5;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public virtual IndexerPageableRequestChain GetRecentRequests()
|
|
|
|
public virtual IndexerPageableRequestChain GetRecentRequests()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var pageableRequests = new IndexerPageableRequestChain();
|
|
|
|
var pageableRequests = new IndexerPageableRequestChain();
|
|
|
|
|
|
|
|
|
|
|
|
pageableRequests.Add(GetPagedRequests(null));
|
|
|
|
pageableRequests.Add(GetPagedRequests(MaxPages, null));
|
|
|
|
|
|
|
|
|
|
|
|
return pageableRequests;
|
|
|
|
return pageableRequests;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -54,7 +60,7 @@ namespace NzbDrone.Core.Indexers.Waffles
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var pageableRequests = new IndexerPageableRequestChain();
|
|
|
|
var pageableRequests = new IndexerPageableRequestChain();
|
|
|
|
|
|
|
|
|
|
|
|
pageableRequests.Add(GetPagedRequests(string.Format("&q=artist:{0} album:{1}",searchCriteria.Artist.Name,searchCriteria.AlbumTitle)));
|
|
|
|
pageableRequests.Add(GetPagedRequests(MaxPages, string.Format("&q=artist:{0} album:{1}",searchCriteria.Artist.Name,searchCriteria.AlbumTitle)));
|
|
|
|
|
|
|
|
|
|
|
|
return pageableRequests;
|
|
|
|
return pageableRequests;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -63,12 +69,12 @@ namespace NzbDrone.Core.Indexers.Waffles
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var pageableRequests = new IndexerPageableRequestChain();
|
|
|
|
var pageableRequests = new IndexerPageableRequestChain();
|
|
|
|
|
|
|
|
|
|
|
|
pageableRequests.Add(GetPagedRequests(string.Format("&q=artist:{0}", searchCriteria.Artist.Name)));
|
|
|
|
pageableRequests.Add(GetPagedRequests(MaxPages, string.Format("&q=artist:{0}", searchCriteria.Artist.Name)));
|
|
|
|
|
|
|
|
|
|
|
|
return pageableRequests;
|
|
|
|
return pageableRequests;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private IEnumerable<IndexerRequest> GetPagedRequests(string query)
|
|
|
|
private IEnumerable<IndexerRequest> GetPagedRequests(int maxPages, string query)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
var url = new StringBuilder();
|
|
|
|
var url = new StringBuilder();
|
|
|
@ -80,7 +86,10 @@ namespace NzbDrone.Core.Indexers.Waffles
|
|
|
|
url.AppendFormat(query);
|
|
|
|
url.AppendFormat(query);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
yield return new IndexerRequest(url.ToString(), HttpAccept.Rss);
|
|
|
|
for (var page = 0; page < maxPages; page++)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
yield return new IndexerRequest(string.Format("{0}&p={1}", url, page), HttpAccept.Rss);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|