mirror of
https://github.com/Radarr/Radarr.git
synced 2024-11-04 10:02:40 +01:00
Fixed an issue with season searching using the season number as the tvrageid
This commit is contained in:
parent
017975696e
commit
f4aae73d27
@ -59,7 +59,7 @@ public List<DownloadDecision> EpisodeSearch(int episodeId)
|
||||
throw new InvalidOperationException("Daily episode is missing AirDate. Try to refresh series info.");
|
||||
}
|
||||
|
||||
return SearchDaily(episode.SeriesId, episode.Series.TvRageId, DateTime.ParseExact(episode.AirDate, Episode.AIR_DATE_FORMAT, CultureInfo.InvariantCulture));
|
||||
return SearchDaily(series, DateTime.ParseExact(episode.AirDate, Episode.AIR_DATE_FORMAT, CultureInfo.InvariantCulture));
|
||||
}
|
||||
|
||||
return SearchSingle(series, episode);
|
||||
@ -67,7 +67,7 @@ public List<DownloadDecision> EpisodeSearch(int episodeId)
|
||||
|
||||
private List<DownloadDecision> SearchSingle(Series series, Episode episode)
|
||||
{
|
||||
var searchSpec = Get<SingleEpisodeSearchCriteria>(series.Id, series.TvRageId, episode.SeasonNumber);
|
||||
var searchSpec = Get<SingleEpisodeSearchCriteria>(series, episode.SeasonNumber);
|
||||
|
||||
if (series.UseSceneNumbering)
|
||||
{
|
||||
@ -92,9 +92,9 @@ private List<DownloadDecision> SearchSingle(Series series, Episode episode)
|
||||
return Dispatch(indexer => _feedFetcher.Fetch(indexer, searchSpec), searchSpec);
|
||||
}
|
||||
|
||||
private List<DownloadDecision> SearchDaily(int seriesId, int rageTvId, DateTime airDate)
|
||||
private List<DownloadDecision> SearchDaily(Series series, DateTime airDate)
|
||||
{
|
||||
var searchSpec = Get<DailyEpisodeSearchCriteria>(seriesId, rageTvId);
|
||||
var searchSpec = Get<DailyEpisodeSearchCriteria>(series);
|
||||
searchSpec.Airtime = airDate;
|
||||
|
||||
return Dispatch(indexer => _feedFetcher.Fetch(indexer, searchSpec), searchSpec);
|
||||
@ -102,40 +102,20 @@ private List<DownloadDecision> SearchDaily(int seriesId, int rageTvId, DateTime
|
||||
|
||||
public List<DownloadDecision> SeasonSearch(int seriesId, int seasonNumber)
|
||||
{
|
||||
var searchSpec = Get<SeasonSearchCriteria>(seriesId, seasonNumber);
|
||||
var series = _seriesService.GetSeries(seriesId);
|
||||
|
||||
var searchSpec = Get<SeasonSearchCriteria>(series, seasonNumber);
|
||||
searchSpec.SeasonNumber = seasonNumber;
|
||||
|
||||
return Dispatch(indexer => _feedFetcher.Fetch(indexer, searchSpec), searchSpec);
|
||||
}
|
||||
|
||||
private List<DownloadDecision> PartialSeasonSearch(SeasonSearchCriteria search)
|
||||
{
|
||||
var episodesNumbers = _episodeService.GetEpisodesBySeason(search.SeriesId, search.SeasonNumber).Select(c => c.EpisodeNumber);
|
||||
var prefixes = episodesNumbers
|
||||
.Select(i => i / 10)
|
||||
.Distinct()
|
||||
.Select(prefix => new PartialSeasonSearchCriteria(search, prefix));
|
||||
|
||||
var result = new List<DownloadDecision>();
|
||||
|
||||
foreach (var partialSeasonSearchSpec in prefixes)
|
||||
{
|
||||
var spec = partialSeasonSearchSpec;
|
||||
result.AddRange(Dispatch(indexer => _feedFetcher.Fetch(indexer, spec), partialSeasonSearchSpec));
|
||||
}
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private TSpec Get<TSpec>(int seriesId, int rageTvId, int seasonNumber = -1) where TSpec : SearchCriteriaBase, new()
|
||||
private TSpec Get<TSpec>(Series series, int seasonNumber = -1) where TSpec : SearchCriteriaBase, new()
|
||||
{
|
||||
var spec = new TSpec();
|
||||
|
||||
var series = _seriesService.GetSeries(seriesId);
|
||||
|
||||
spec.SeriesId = seriesId;
|
||||
spec.SeriesTvRageId = rageTvId;
|
||||
spec.SeriesId = series.Id;
|
||||
spec.SeriesTvRageId = series.TvRageId;
|
||||
spec.SceneTitle = _sceneMapping.GetSceneName(series.TvdbId, seasonNumber);
|
||||
|
||||
if (string.IsNullOrWhiteSpace(spec.SceneTitle))
|
||||
|
@ -20,6 +20,5 @@ public interface IIndexer
|
||||
IEnumerable<string> GetEpisodeSearchUrls(string seriesTitle, int tvRageId, int seasonNumber, int episodeNumber);
|
||||
IEnumerable<string> GetDailyEpisodeSearchUrls(string seriesTitle, int tvRageId, DateTime date);
|
||||
IEnumerable<string> GetSeasonSearchUrls(string seriesTitle, int tvRageId, int seasonNumber);
|
||||
IEnumerable<string> GetPartialSeasonSearchUrls(string seriesTitle, int tvRageId, int seasonNumber, int episodeWildcard);
|
||||
}
|
||||
}
|
@ -37,8 +37,5 @@ public virtual IParseFeed Parser
|
||||
public abstract IEnumerable<string> GetEpisodeSearchUrls(string seriesTitle, int tvRageId, int seasonNumber, int episodeNumber);
|
||||
public abstract IEnumerable<string> GetDailyEpisodeSearchUrls(string seriesTitle, int tvRageId, DateTime date);
|
||||
public abstract IEnumerable<string> GetSeasonSearchUrls(string seriesTitle, int tvRageId, int seasonNumber);
|
||||
public abstract IEnumerable<string> GetPartialSeasonSearchUrls(string seriesTitle, int tvRageId, int seasonNumber, int episodeWildcard);
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -114,16 +114,6 @@ public override IEnumerable<string> GetSeasonSearchUrls(string seriesTitle, int
|
||||
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 tvRageId, int seasonNumber, int episodeWildcard)
|
||||
{
|
||||
if (tvRageId > 0)
|
||||
{
|
||||
return RecentFeed.Select(url => String.Format("{0}&limit=100&rid={1}&season={2}&q=E{3}", url, tvRageId, seasonNumber, episodeWildcard));
|
||||
}
|
||||
|
||||
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
|
||||
{
|
||||
get
|
||||
|
@ -70,17 +70,5 @@ public override IEnumerable<string> GetDailyEpisodeSearchUrls(string seriesTitle
|
||||
|
||||
return searchUrls;
|
||||
}
|
||||
|
||||
public override IEnumerable<string> GetPartialSeasonSearchUrls(string seriesTitle, int tvRageId, int seasonNumber, int episodeWildcard)
|
||||
{
|
||||
var searchUrls = new List<String>();
|
||||
|
||||
foreach (var url in RecentFeed)
|
||||
{
|
||||
searchUrls.Add(String.Format("{0}+{1}+S{2:00}E{3}", url, seriesTitle, seasonNumber, episodeWildcard));
|
||||
}
|
||||
|
||||
return searchUrls;
|
||||
}
|
||||
}
|
||||
}
|
@ -63,17 +63,5 @@ public override IEnumerable<string> GetSeasonSearchUrls(string seriesTitle, int
|
||||
|
||||
return searchUrls;
|
||||
}
|
||||
|
||||
public override IEnumerable<string> GetPartialSeasonSearchUrls(string seriesTitle, int tvRageId, int seasonNumber, int episodeWildcard)
|
||||
{
|
||||
var searchUrls = new List<String>();
|
||||
|
||||
foreach (var url in RecentFeed)
|
||||
{
|
||||
searchUrls.Add(String.Format("{0}&search={1}+S{2:00}E{3}", url, seriesTitle, seasonNumber, episodeWildcard));
|
||||
}
|
||||
|
||||
return searchUrls;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -37,10 +37,5 @@ public override IEnumerable<string> GetDailyEpisodeSearchUrls(string seriesTitle
|
||||
{
|
||||
return new List<string>();
|
||||
}
|
||||
|
||||
public override IEnumerable<string> GetPartialSeasonSearchUrls(string seriesTitle, int tvRageId, int seasonNumber, int episodeWildcard)
|
||||
{
|
||||
return new List<string>();
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
using NzbDrone.Common.Messaging;
|
||||
|
||||
namespace NzbDrone.Core.Instrumentation.Commands
|
||||
{
|
||||
public class ClearLogCommand : ICommand
|
||||
{
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user