mirror of
https://github.com/Sonarr/Sonarr.git
synced 2024-12-16 11:37:58 +02:00
use Rage TV ID for newznab search api calls
This commit is contained in:
parent
57bb37a8cd
commit
f29eb49c7f
@ -10,6 +10,7 @@ public abstract class SearchCriteriaBase
|
|||||||
private static readonly Regex BeginningThe = new Regex(@"^the\s", RegexOptions.IgnoreCase | RegexOptions.Compiled);
|
private static readonly Regex BeginningThe = new Regex(@"^the\s", RegexOptions.IgnoreCase | RegexOptions.Compiled);
|
||||||
|
|
||||||
public int SeriesId { get; set; }
|
public int SeriesId { get; set; }
|
||||||
|
public int SeriesRageTvId { get; set; }
|
||||||
public string SceneTitle { get; set; }
|
public string SceneTitle { get; set; }
|
||||||
|
|
||||||
public string QueryTitle
|
public string QueryTitle
|
||||||
|
@ -59,7 +59,7 @@ public List<DownloadDecision> EpisodeSearch(int episodeId)
|
|||||||
throw new InvalidOperationException("Daily episode is missing AirDate. Try to refresh series info.");
|
throw new InvalidOperationException("Daily episode is missing AirDate. Try to refresh series info.");
|
||||||
}
|
}
|
||||||
|
|
||||||
return SearchDaily(episode.SeriesId, DateTime.ParseExact(episode.AirDate, Episode.AIR_DATE_FORMAT, CultureInfo.InvariantCulture));
|
return SearchDaily(episode.SeriesId, episode.Series.TvRageId, DateTime.ParseExact(episode.AirDate, Episode.AIR_DATE_FORMAT, CultureInfo.InvariantCulture));
|
||||||
}
|
}
|
||||||
|
|
||||||
return SearchSingle(series, episode);
|
return SearchSingle(series, episode);
|
||||||
@ -67,7 +67,7 @@ public List<DownloadDecision> EpisodeSearch(int episodeId)
|
|||||||
|
|
||||||
private List<DownloadDecision> SearchSingle(Series series, Episode episode)
|
private List<DownloadDecision> SearchSingle(Series series, Episode episode)
|
||||||
{
|
{
|
||||||
var searchSpec = Get<SingleEpisodeSearchCriteria>(series.Id, episode.SeasonNumber);
|
var searchSpec = Get<SingleEpisodeSearchCriteria>(series.Id, series.TvRageId, episode.SeasonNumber);
|
||||||
|
|
||||||
if (series.UseSceneNumbering)
|
if (series.UseSceneNumbering)
|
||||||
{
|
{
|
||||||
@ -92,9 +92,9 @@ private List<DownloadDecision> SearchSingle(Series series, Episode episode)
|
|||||||
return Dispatch(indexer => _feedFetcher.Fetch(indexer, searchSpec), searchSpec);
|
return Dispatch(indexer => _feedFetcher.Fetch(indexer, searchSpec), searchSpec);
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<DownloadDecision> SearchDaily(int seriesId, DateTime airDate)
|
private List<DownloadDecision> SearchDaily(int seriesId, int rageTvId, DateTime airDate)
|
||||||
{
|
{
|
||||||
var searchSpec = Get<DailyEpisodeSearchCriteria>(seriesId);
|
var searchSpec = Get<DailyEpisodeSearchCriteria>(seriesId, rageTvId);
|
||||||
searchSpec.Airtime = airDate;
|
searchSpec.Airtime = airDate;
|
||||||
|
|
||||||
return Dispatch(indexer => _feedFetcher.Fetch(indexer, searchSpec), searchSpec);
|
return Dispatch(indexer => _feedFetcher.Fetch(indexer, searchSpec), searchSpec);
|
||||||
@ -128,13 +128,14 @@ private List<DownloadDecision> PartialSeasonSearch(SeasonSearchCriteria search)
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
private TSpec Get<TSpec>(int seriesId, int seasonNumber = -1) where TSpec : SearchCriteriaBase, new()
|
private TSpec Get<TSpec>(int seriesId, int rageTvId, int seasonNumber = -1) where TSpec : SearchCriteriaBase, new()
|
||||||
{
|
{
|
||||||
var spec = new TSpec();
|
var spec = new TSpec();
|
||||||
|
|
||||||
var series = _seriesService.GetSeries(seriesId);
|
var series = _seriesService.GetSeries(seriesId);
|
||||||
|
|
||||||
spec.SeriesId = seriesId;
|
spec.SeriesId = seriesId;
|
||||||
|
spec.SeriesRageTvId = rageTvId;
|
||||||
spec.SceneTitle = _sceneMapping.GetSceneName(series.TvdbId, seasonNumber);
|
spec.SceneTitle = _sceneMapping.GetSceneName(series.TvdbId, seasonNumber);
|
||||||
|
|
||||||
if (string.IsNullOrWhiteSpace(spec.SceneTitle))
|
if (string.IsNullOrWhiteSpace(spec.SceneTitle))
|
||||||
|
@ -17,9 +17,9 @@ public interface IIndexer
|
|||||||
|
|
||||||
IParseFeed Parser { get; }
|
IParseFeed Parser { get; }
|
||||||
|
|
||||||
IEnumerable<string> GetEpisodeSearchUrls(string seriesTitle, int seasonNumber, int episodeNumber);
|
IEnumerable<string> GetEpisodeSearchUrls(string seriesTitle, int rageTvId, int seasonNumber, int episodeNumber);
|
||||||
IEnumerable<string> GetDailyEpisodeSearchUrls(string seriesTitle, DateTime date);
|
IEnumerable<string> GetDailyEpisodeSearchUrls(string seriesTitle, int rageTvId, DateTime date);
|
||||||
IEnumerable<string> GetSeasonSearchUrls(string seriesTitle, int seasonNumber);
|
IEnumerable<string> GetSeasonSearchUrls(string seriesTitle, int rageTvId, int seasonNumber);
|
||||||
IEnumerable<string> GetPartialSeasonSearchUrls(string seriesTitle, int seasonNumber, int episodeWildcard);
|
IEnumerable<string> GetPartialSeasonSearchUrls(string seriesTitle, int rageTvId, int seasonNumber, int episodeWildcard);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -34,10 +34,10 @@ public virtual IParseFeed Parser
|
|||||||
}
|
}
|
||||||
|
|
||||||
public abstract IEnumerable<string> RecentFeed { get; }
|
public abstract IEnumerable<string> RecentFeed { get; }
|
||||||
public abstract IEnumerable<string> GetEpisodeSearchUrls(string seriesTitle, int seasonNumber, int episodeNumber);
|
public abstract IEnumerable<string> GetEpisodeSearchUrls(string seriesTitle, int rageTvId, int seasonNumber, int episodeNumber);
|
||||||
public abstract IEnumerable<string> GetDailyEpisodeSearchUrls(string seriesTitle, DateTime date);
|
public abstract IEnumerable<string> GetDailyEpisodeSearchUrls(string seriesTitle, int rageTvId, DateTime date);
|
||||||
public abstract IEnumerable<string> GetSeasonSearchUrls(string seriesTitle, int seasonNumber);
|
public abstract IEnumerable<string> GetSeasonSearchUrls(string seriesTitle, int rageTvId, int seasonNumber);
|
||||||
public abstract IEnumerable<string> GetPartialSeasonSearchUrls(string seriesTitle, int seasonNumber, int episodeWildcard);
|
public abstract IEnumerable<string> GetPartialSeasonSearchUrls(string seriesTitle, int rageTvId, int seasonNumber, int episodeWildcard);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@ public IList<ReportInfo> Fetch(IIndexer indexer, SeasonSearchCriteria searchCrit
|
|||||||
{
|
{
|
||||||
_logger.Debug("Searching for {0}", searchCriteria);
|
_logger.Debug("Searching for {0}", searchCriteria);
|
||||||
|
|
||||||
var searchUrls = indexer.GetSeasonSearchUrls(searchCriteria.QueryTitle, searchCriteria.SeasonNumber);
|
var searchUrls = indexer.GetSeasonSearchUrls(searchCriteria.QueryTitle, searchCriteria.SeriesRageTvId, searchCriteria.SeasonNumber);
|
||||||
var result = Fetch(indexer, searchUrls);
|
var result = Fetch(indexer, searchUrls);
|
||||||
|
|
||||||
|
|
||||||
@ -58,7 +58,7 @@ public IList<ReportInfo> Fetch(IIndexer indexer, SingleEpisodeSearchCriteria sea
|
|||||||
{
|
{
|
||||||
_logger.Debug("Searching for {0}", searchCriteria);
|
_logger.Debug("Searching for {0}", searchCriteria);
|
||||||
|
|
||||||
var searchUrls = indexer.GetEpisodeSearchUrls(searchCriteria.QueryTitle, searchCriteria.SeasonNumber, searchCriteria.EpisodeNumber);
|
var searchUrls = indexer.GetEpisodeSearchUrls(searchCriteria.QueryTitle, searchCriteria.SeriesRageTvId, searchCriteria.SeasonNumber, searchCriteria.EpisodeNumber);
|
||||||
var result = Fetch(indexer, searchUrls);
|
var result = Fetch(indexer, searchUrls);
|
||||||
|
|
||||||
|
|
||||||
@ -71,7 +71,7 @@ public IList<ReportInfo> Fetch(IIndexer indexer, PartialSeasonSearchCriteria sea
|
|||||||
{
|
{
|
||||||
_logger.Debug("Searching for {0}", searchCriteria);
|
_logger.Debug("Searching for {0}", searchCriteria);
|
||||||
|
|
||||||
var searchUrls = indexer.GetSeasonSearchUrls(searchCriteria.QueryTitle, searchCriteria.SeasonNumber);
|
var searchUrls = indexer.GetSeasonSearchUrls(searchCriteria.QueryTitle, searchCriteria.SeriesRageTvId, searchCriteria.SeasonNumber);
|
||||||
var result = Fetch(indexer, searchUrls);
|
var result = Fetch(indexer, searchUrls);
|
||||||
|
|
||||||
|
|
||||||
@ -83,7 +83,7 @@ public IList<ReportInfo> Fetch(IIndexer indexer, DailyEpisodeSearchCriteria sear
|
|||||||
{
|
{
|
||||||
_logger.Debug("Searching for {0}", searchCriteria);
|
_logger.Debug("Searching for {0}", searchCriteria);
|
||||||
|
|
||||||
var searchUrls = indexer.GetDailyEpisodeSearchUrls(searchCriteria.QueryTitle, searchCriteria.Airtime);
|
var searchUrls = indexer.GetDailyEpisodeSearchUrls(searchCriteria.QueryTitle, searchCriteria.SeriesRageTvId, searchCriteria.Airtime);
|
||||||
var result = Fetch(indexer, searchUrls);
|
var result = Fetch(indexer, searchUrls);
|
||||||
|
|
||||||
_logger.Info("Finished searching {0} on {1}. Found {2}", indexer.Name, searchCriteria, result.Count);
|
_logger.Info("Finished searching {0} on {1}. Found {2}", indexer.Name, searchCriteria, result.Count);
|
||||||
|
@ -84,24 +84,52 @@ public override IEnumerable<string> RecentFeed
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override IEnumerable<string> GetEpisodeSearchUrls(string seriesTitle, int seasonNumber, int episodeNumber)
|
public override IEnumerable<string> GetEpisodeSearchUrls(string seriesTitle, int rageTvId, int seasonNumber, int episodeNumber)
|
||||||
{
|
{
|
||||||
return RecentFeed.Select(url => String.Format("{0}&limit=100&q={1}&season={2}&ep={3}", url, NewsnabifyTitle(seriesTitle), seasonNumber, episodeNumber));
|
if (Settings.UseRageTvId)
|
||||||
|
{
|
||||||
|
return RecentFeed.Select(url => String.Format("{0}&limit=100&rid={1}&season={2}&ep={3}", url, rageTvId, seasonNumber, episodeNumber));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return RecentFeed.Select(url => String.Format("{0}&limit=100&q={1}&season={2}&ep={3}", url, NewsnabifyTitle(seriesTitle), seasonNumber, episodeNumber));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override IEnumerable<string> GetDailyEpisodeSearchUrls(string seriesTitle, DateTime date)
|
public override IEnumerable<string> GetDailyEpisodeSearchUrls(string seriesTitle, int rageTvId, DateTime date)
|
||||||
{
|
{
|
||||||
return RecentFeed.Select(url => String.Format("{0}&limit=100&q={1}&season={2:yyyy}&ep={2:MM/dd}", url, NewsnabifyTitle(seriesTitle), date)).ToList();
|
if (Settings.UseRageTvId)
|
||||||
|
{
|
||||||
|
return RecentFeed.Select(url => String.Format("{0}&limit=100&rid={1}&season={2:yyyy}&ep={2:MM/dd}", url, rageTvId, date)).ToList();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return RecentFeed.Select(url => String.Format("{0}&limit=100&q={1}&season={2:yyyy}&ep={2:MM/dd}", url, NewsnabifyTitle(seriesTitle), date)).ToList();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override IEnumerable<string> GetSeasonSearchUrls(string seriesTitle, int seasonNumber)
|
public override IEnumerable<string> GetSeasonSearchUrls(string seriesTitle, int rageTvId, int seasonNumber)
|
||||||
{
|
{
|
||||||
return RecentFeed.Select(url => String.Format("{0}&limit=100&q={1}&season={2}", url, NewsnabifyTitle(seriesTitle), seasonNumber));
|
if (Settings.UseRageTvId)
|
||||||
|
{
|
||||||
|
return RecentFeed.Select(url => String.Format("{0}&limit=100&rid={1}&season={2}", url, rageTvId, seasonNumber));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return RecentFeed.Select(url => String.Format("{0}&limit=100&q={1}&season={2}", url, NewsnabifyTitle(seriesTitle), seasonNumber));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override IEnumerable<string> GetPartialSeasonSearchUrls(string seriesTitle, int seasonNumber, int episodeWildcard)
|
public override IEnumerable<string> GetPartialSeasonSearchUrls(string seriesTitle, int rageTvId, int seasonNumber, int episodeWildcard)
|
||||||
{
|
{
|
||||||
return RecentFeed.Select(url => String.Format("{0}&limit=100&q={1}+S{2:00}E{3}", url, NewsnabifyTitle(seriesTitle), seasonNumber, episodeWildcard));
|
if (Settings.UseRageTvId)
|
||||||
|
{
|
||||||
|
return RecentFeed.Select(url => String.Format("{0}&limit=100&rid={1}&season={2}&q=E{3}", url, rageTvId, seasonNumber, episodeWildcard));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return RecentFeed.Select(url => String.Format("{0}&limit=100&q={1}+S{2:00}E{3}", url, NewsnabifyTitle(seriesTitle), seasonNumber, episodeWildcard));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override string Name
|
public override string Name
|
||||||
|
@ -10,6 +10,7 @@ public class NewznabSettings : IIndexerSetting
|
|||||||
public NewznabSettings()
|
public NewznabSettings()
|
||||||
{
|
{
|
||||||
Categories = new [] { 5030, 5040 };
|
Categories = new [] { 5030, 5040 };
|
||||||
|
UseRageTvId = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
[FieldDefinition(0, Label = "URL")]
|
[FieldDefinition(0, Label = "URL")]
|
||||||
@ -20,6 +21,8 @@ public NewznabSettings()
|
|||||||
|
|
||||||
public IEnumerable<Int32> Categories { get; set; }
|
public IEnumerable<Int32> Categories { get; set; }
|
||||||
|
|
||||||
|
public bool UseRageTvId { get; set; }
|
||||||
|
|
||||||
public bool IsValid
|
public bool IsValid
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
@ -35,7 +35,7 @@ public override IEnumerable<string> RecentFeed
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override IEnumerable<string> GetEpisodeSearchUrls(string seriesTitle, int seasonNumber, int episodeNumber)
|
public override IEnumerable<string> GetEpisodeSearchUrls(string seriesTitle, int rageTvId, int seasonNumber, int episodeNumber)
|
||||||
{
|
{
|
||||||
var searchUrls = new List<string>();
|
var searchUrls = new List<string>();
|
||||||
|
|
||||||
@ -47,7 +47,7 @@ public override IEnumerable<string> GetEpisodeSearchUrls(string seriesTitle, int
|
|||||||
return searchUrls;
|
return searchUrls;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override IEnumerable<string> GetSeasonSearchUrls(string seriesTitle, int seasonNumber)
|
public override IEnumerable<string> GetSeasonSearchUrls(string seriesTitle, int rageTvId, int seasonNumber)
|
||||||
{
|
{
|
||||||
var searchUrls = new List<string>();
|
var searchUrls = new List<string>();
|
||||||
|
|
||||||
@ -59,7 +59,7 @@ public override IEnumerable<string> GetSeasonSearchUrls(string seriesTitle, int
|
|||||||
return searchUrls;
|
return searchUrls;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override IEnumerable<string> GetDailyEpisodeSearchUrls(string seriesTitle, DateTime date)
|
public override IEnumerable<string> GetDailyEpisodeSearchUrls(string seriesTitle, int rageTvId, DateTime date)
|
||||||
{
|
{
|
||||||
var searchUrls = new List<String>();
|
var searchUrls = new List<String>();
|
||||||
|
|
||||||
@ -71,7 +71,7 @@ public override IEnumerable<string> GetDailyEpisodeSearchUrls(string seriesTitle
|
|||||||
return searchUrls;
|
return searchUrls;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override IEnumerable<string> GetPartialSeasonSearchUrls(string seriesTitle, int seasonNumber, int episodeWildcard)
|
public override IEnumerable<string> GetPartialSeasonSearchUrls(string seriesTitle, int rageTvId, int seasonNumber, int episodeWildcard)
|
||||||
{
|
{
|
||||||
var searchUrls = new List<String>();
|
var searchUrls = new List<String>();
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ public override IEnumerable<string> RecentFeed
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override IEnumerable<string> GetEpisodeSearchUrls(string seriesTitle, int seasonNumber, int episodeNumber)
|
public override IEnumerable<string> GetEpisodeSearchUrls(string seriesTitle, int rageTvId, int seasonNumber, int episodeNumber)
|
||||||
{
|
{
|
||||||
var searchUrls = new List<string>();
|
var searchUrls = new List<string>();
|
||||||
|
|
||||||
@ -32,7 +32,7 @@ public override IEnumerable<string> GetEpisodeSearchUrls(string seriesTitle, int
|
|||||||
return searchUrls;
|
return searchUrls;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override IEnumerable<string> GetDailyEpisodeSearchUrls(string seriesTitle, DateTime date)
|
public override IEnumerable<string> GetDailyEpisodeSearchUrls(string seriesTitle, int rageTvId, DateTime date)
|
||||||
{
|
{
|
||||||
var searchUrls = new List<String>();
|
var searchUrls = new List<String>();
|
||||||
|
|
||||||
@ -44,7 +44,7 @@ public override IEnumerable<string> GetDailyEpisodeSearchUrls(string seriesTitle
|
|||||||
return searchUrls;
|
return searchUrls;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override IEnumerable<string> GetSeasonSearchUrls(string seriesTitle, int seasonNumber)
|
public override IEnumerable<string> GetSeasonSearchUrls(string seriesTitle, int rageTvId, int seasonNumber)
|
||||||
{
|
{
|
||||||
var searchUrls = new List<String>();
|
var searchUrls = new List<String>();
|
||||||
|
|
||||||
@ -56,7 +56,7 @@ public override IEnumerable<string> GetSeasonSearchUrls(string seriesTitle, int
|
|||||||
return searchUrls;
|
return searchUrls;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override IEnumerable<string> GetPartialSeasonSearchUrls(string seriesTitle, int seasonNumber, int episodeWildcard)
|
public override IEnumerable<string> GetPartialSeasonSearchUrls(string seriesTitle, int rageTvId, int seasonNumber, int episodeWildcard)
|
||||||
{
|
{
|
||||||
var searchUrls = new List<String>();
|
var searchUrls = new List<String>();
|
||||||
|
|
||||||
|
@ -23,22 +23,22 @@ public override IEnumerable<string> RecentFeed
|
|||||||
get { yield return "http://nzb.isasecret.com/rss/?sec=TV&fr=false"; }
|
get { yield return "http://nzb.isasecret.com/rss/?sec=TV&fr=false"; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public override IEnumerable<string> GetEpisodeSearchUrls(string seriesTitle, int seasonNumber, int episodeNumber)
|
public override IEnumerable<string> GetEpisodeSearchUrls(string seriesTitle, int rageTvId, int seasonNumber, int episodeNumber)
|
||||||
{
|
{
|
||||||
return new List<string>();
|
return new List<string>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override IEnumerable<string> GetSeasonSearchUrls(string seriesTitle, int seasonNumber)
|
public override IEnumerable<string> GetSeasonSearchUrls(string seriesTitle, int rageTvId, int seasonNumber)
|
||||||
{
|
{
|
||||||
return new List<string>();
|
return new List<string>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override IEnumerable<string> GetDailyEpisodeSearchUrls(string seriesTitle, DateTime date)
|
public override IEnumerable<string> GetDailyEpisodeSearchUrls(string seriesTitle, int rageTvId, DateTime date)
|
||||||
{
|
{
|
||||||
return new List<string>();
|
return new List<string>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override IEnumerable<string> GetPartialSeasonSearchUrls(string seriesTitle, int seasonNumber, int episodeWildcard)
|
public override IEnumerable<string> GetPartialSeasonSearchUrls(string seriesTitle, int rageTvId, int seasonNumber, int episodeWildcard)
|
||||||
{
|
{
|
||||||
return new List<string>();
|
return new List<string>();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user