Add artist search framework code

This commit is contained in:
Daniel Underwood
2017-07-19 22:34:16 -04:00
parent 6ecaa4b97f
commit f40918ddb8
21 changed files with 159 additions and 0 deletions
@@ -47,6 +47,11 @@ namespace NzbDrone.Core.Indexers.BitMeTv
throw new System.NotImplementedException();
}
public IndexerPageableRequestChain GetSearchRequests(ArtistSearchCriteria searchCriteria)
{
throw new System.NotImplementedException();
}
private IEnumerable<IndexerRequest> GetRssRequests()
{
var request = new IndexerRequest(string.Format("{0}/rss.php?uid={1}&passkey={2}", Settings.BaseUrl.Trim().TrimEnd('/'), Settings.UserId, Settings.RssPasskey), HttpAccept.Html);
@@ -165,6 +165,11 @@ namespace NzbDrone.Core.Indexers.BroadcastheNet
throw new System.NotImplementedException();
}
public IndexerPageableRequestChain GetSearchRequests(ArtistSearchCriteria searchCriteria)
{
throw new System.NotImplementedException();
}
private bool AddSeriesSearchParameters(BroadcastheNetTorrentQuery parameters, SearchCriteriaBase searchCriteria)
{
if (searchCriteria.Series.TvdbId != 0)
@@ -65,6 +65,11 @@ namespace NzbDrone.Core.Indexers.Fanzub
throw new System.NotImplementedException();
}
public IndexerPageableRequestChain GetSearchRequests(ArtistSearchCriteria searchCriteria)
{
throw new System.NotImplementedException();
}
private IEnumerable<IndexerRequest> GetPagedRequests(string query)
{
var url = new StringBuilder();
@@ -48,6 +48,11 @@ namespace NzbDrone.Core.Indexers.HDBits
throw new System.NotImplementedException();
}
public IndexerPageableRequestChain GetSearchRequests(ArtistSearchCriteria searchCriteria)
{
throw new System.NotImplementedException();
}
public virtual IndexerPageableRequestChain GetSearchRequests(DailyEpisodeSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
@@ -128,6 +128,18 @@ namespace NzbDrone.Core.Indexers
return FetchReleases(generator.GetSearchRequests(searchCriteria));
}
public override IList<ReleaseInfo> Fetch(ArtistSearchCriteria searchCriteria)
{
if (!SupportsSearch)
{
return new List<ReleaseInfo>();
}
var generator = GetRequestGenerator();
return FetchReleases(generator.GetSearchRequests(searchCriteria));
}
protected virtual IList<ReleaseInfo> FetchReleases(IndexerPageableRequestChain pageableRequestChain, bool isRecent = false)
{
var releases = new List<ReleaseInfo>();
+1
View File
@@ -23,5 +23,6 @@ namespace NzbDrone.Core.Indexers
[System.Obsolete("Sonarr TV Stuff -- Shouldn't be needed for Lidarr")]
IList<ReleaseInfo> Fetch(SpecialEpisodeSearchCriteria searchCriteria);
IList<ReleaseInfo> Fetch(AlbumSearchCriteria searchCriteria);
IList<ReleaseInfo> Fetch(ArtistSearchCriteria searchCriteria);
}
}
@@ -11,5 +11,6 @@ namespace NzbDrone.Core.Indexers
IndexerPageableRequestChain GetSearchRequests(AnimeEpisodeSearchCriteria searchCriteria);
IndexerPageableRequestChain GetSearchRequests(SpecialEpisodeSearchCriteria searchCriteria);
IndexerPageableRequestChain GetSearchRequests(AlbumSearchCriteria searchCriteria);
IndexerPageableRequestChain GetSearchRequests(ArtistSearchCriteria searchCriteria);
}
}
@@ -47,6 +47,11 @@ namespace NzbDrone.Core.Indexers.IPTorrents
throw new System.NotImplementedException();
}
public IndexerPageableRequestChain GetSearchRequests(ArtistSearchCriteria searchCriteria)
{
throw new System.NotImplementedException();
}
private IEnumerable<IndexerRequest> GetRssRequests()
{
yield return new IndexerRequest(Settings.Url, HttpAccept.Rss);
@@ -74,6 +74,7 @@ namespace NzbDrone.Core.Indexers
[System.Obsolete("Sonarr TV Stuff -- Shouldn't be needed for Lidarr")]
public abstract IList<ReleaseInfo> Fetch(SpecialEpisodeSearchCriteria searchCriteria);
public abstract IList<ReleaseInfo> Fetch(AlbumSearchCriteria searchCriteria);
public abstract IList<ReleaseInfo> Fetch(ArtistSearchCriteria searchCriteria);
protected virtual IList<ReleaseInfo> CleanupReleases(IEnumerable<ReleaseInfo> releases)
{
@@ -185,6 +185,11 @@ namespace NzbDrone.Core.Indexers.Newznab
throw new System.NotImplementedException();
}
public IndexerPageableRequestChain GetSearchRequests(ArtistSearchCriteria searchCriteria)
{
throw new System.NotImplementedException();
}
private void AddTvIdPageableRequests(IndexerPageableRequestChain chain, int maxPages, IEnumerable<int> categories, SearchCriteriaBase searchCriteria, string parameters)
{
var includeTvdbSearch = SupportsTvdbSearch && searchCriteria.Series.TvdbId > 0;
@@ -79,6 +79,11 @@ namespace NzbDrone.Core.Indexers.Nyaa
throw new System.NotImplementedException();
}
public IndexerPageableRequestChain GetSearchRequests(ArtistSearchCriteria searchCriteria)
{
throw new System.NotImplementedException();
}
private IEnumerable<IndexerRequest> GetPagedRequests(int maxPages, string term)
{
var baseUrl = string.Format("{0}/?page=rss{1}", Settings.BaseUrl.TrimEnd('/'), Settings.AdditionalParameters);
@@ -93,6 +93,11 @@ namespace NzbDrone.Core.Indexers.Omgwtfnzbs
throw new System.NotImplementedException();
}
public IndexerPageableRequestChain GetSearchRequests(ArtistSearchCriteria searchCriteria)
{
throw new System.NotImplementedException();
}
private IEnumerable<IndexerRequest> GetPagedRequests(string query)
{
var url = new StringBuilder();
@@ -86,6 +86,15 @@ namespace NzbDrone.Core.Indexers.Rarbg
return pageableRequests;
}
public IndexerPageableRequestChain GetSearchRequests(ArtistSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests("search", null, "{0}", searchCriteria.Artist.Name));
return pageableRequests;
}
private IEnumerable<IndexerRequest> GetPagedRequests(string mode, int? tvdbId, string query, params object[] args)
{
var requestBuilder = new HttpRequestBuilder(Settings.BaseUrl)
@@ -51,5 +51,10 @@ namespace NzbDrone.Core.Indexers
{
throw new System.NotImplementedException();
}
public IndexerPageableRequestChain GetSearchRequests(ArtistSearchCriteria searchCriteria)
{
throw new System.NotImplementedException();
}
}
}
@@ -48,6 +48,11 @@ namespace NzbDrone.Core.Indexers.TorrentRss
throw new System.NotImplementedException();
}
public IndexerPageableRequestChain GetSearchRequests(ArtistSearchCriteria searchCriteria)
{
throw new System.NotImplementedException();
}
private IEnumerable<IndexerRequest> GetRssRequests(string searchParameters)
{
var request = new IndexerRequest(Settings.BaseUrl.Trim().TrimEnd('/'), HttpAccept.Rss);
@@ -47,6 +47,11 @@ namespace NzbDrone.Core.Indexers.Torrentleech
throw new System.NotImplementedException();
}
public IndexerPageableRequestChain GetSearchRequests(ArtistSearchCriteria searchCriteria)
{
throw new System.NotImplementedException();
}
private IEnumerable<IndexerRequest> GetRssRequests(string searchParameters)
{
yield return new IndexerRequest(string.Format("{0}/{1}{2}", Settings.BaseUrl.Trim().TrimEnd('/'), Settings.ApiKey, searchParameters), HttpAccept.Rss);