|
|
@ -64,33 +64,58 @@ namespace NzbDrone.Core.Providers
|
|
|
|
return new List<int>();
|
|
|
|
return new List<int>();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//Return false if the series is a daily series (we only support individual episode searching
|
|
|
|
|
|
|
|
if (series.IsDaily)
|
|
|
|
if (series.IsDaily)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
_logger.Trace("Daily series detected, skipping season search: {0}", series.Title);
|
|
|
|
return new List<int>();
|
|
|
|
return new List<int>();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
notification.CurrentMessage = String.Format("Searching for {0} Season {1}", series.Title, seasonNumber);
|
|
|
|
_logger.Debug("Getting episodes from database for series: {0} and season: {1}", seriesId, seasonNumber);
|
|
|
|
|
|
|
|
var episodes = _episodeProvider.GetEpisodesBySeason(seriesId, seasonNumber);
|
|
|
|
|
|
|
|
|
|
|
|
var reports = PerformSearch(notification, series, seasonNumber);
|
|
|
|
if (episodes == null || episodes.Count == 0)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
_logger.Warn("No episodes in database found for series: {0} and season: {1}.", seriesId, seasonNumber);
|
|
|
|
|
|
|
|
return new List<int>();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
_logger.Debug("Finished searching all indexers. Total {0}", reports.Count);
|
|
|
|
notification.CurrentMessage = String.Format("Searching for {0} Season {1}", series.Title, seasonNumber);
|
|
|
|
|
|
|
|
|
|
|
|
if (reports.Count == 0)
|
|
|
|
List<EpisodeParseResult> reports;
|
|
|
|
return new List<int>();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_logger.Debug("Getting episodes from database for series: {0} and season: {1}", seriesId, seasonNumber);
|
|
|
|
if (series.UseSceneNumbering)
|
|
|
|
var episodeNumbers = _episodeProvider.GetEpisodeNumbersBySeason(seriesId, seasonNumber);
|
|
|
|
{
|
|
|
|
|
|
|
|
var sceneSeasonNumbers = episodes.Select(e => e.SceneSeasonNumber).ToList();
|
|
|
|
|
|
|
|
var sceneEpisodeNumbers = episodes.Select(e => e.SceneEpisodeNumber).ToList();
|
|
|
|
|
|
|
|
|
|
|
|
if (episodeNumbers == null || episodeNumbers.Count == 0)
|
|
|
|
if (sceneSeasonNumbers.Distinct().Count() > 1)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
_logger.Warn("No episodes in database found for series: {0} and season: {1}.", seriesId, seasonNumber);
|
|
|
|
_logger.Trace("Uses scene numbering, but multiple seasons found, skipping.");
|
|
|
|
return new List<int>();
|
|
|
|
return new List<int>();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
notification.CurrentMessage = "Processing search results";
|
|
|
|
reports = PerformSeasonSearch(series, sceneSeasonNumbers.First());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
reports.Where(p => p.FullSeason && p.SeasonNumber == sceneSeasonNumbers.First()).ToList().ForEach(
|
|
|
|
|
|
|
|
e => e.EpisodeNumbers = sceneEpisodeNumbers.ToList()
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
reports = PerformSeasonSearch(series, seasonNumber);
|
|
|
|
|
|
|
|
|
|
|
|
reports.Where(p => p.FullSeason && p.SeasonNumber == seasonNumber).ToList().ForEach(
|
|
|
|
reports.Where(p => p.FullSeason && p.SeasonNumber == seasonNumber).ToList().ForEach(
|
|
|
|
e => e.EpisodeNumbers = episodeNumbers.ToList()
|
|
|
|
e => e.EpisodeNumbers = episodes.Select(ep => ep.EpisodeNumber).ToList()
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_logger.Debug("Finished searching all indexers. Total {0}", reports.Count);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (reports.Count == 0)
|
|
|
|
|
|
|
|
return new List<int>();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
notification.CurrentMessage = "Processing search results";
|
|
|
|
|
|
|
|
|
|
|
|
searchResult.SearchHistoryItems = ProcessSearchResults(notification, reports, searchResult, series, seasonNumber);
|
|
|
|
searchResult.SearchHistoryItems = ProcessSearchResults(notification, reports, searchResult, series, seasonNumber);
|
|
|
|
_searchHistoryProvider.Add(searchResult);
|
|
|
|
_searchHistoryProvider.Add(searchResult);
|
|
|
@ -115,13 +140,36 @@ namespace NzbDrone.Core.Providers
|
|
|
|
return new List<int>();
|
|
|
|
return new List<int>();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//Return empty list if the series is a daily series (we only support individual episode searching
|
|
|
|
|
|
|
|
if (series.IsDaily)
|
|
|
|
if (series.IsDaily)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
_logger.Trace("Daily series detected, skipping season search: {0}", series.Title);
|
|
|
|
return new List<int>();
|
|
|
|
return new List<int>();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
notification.CurrentMessage = String.Format("Searching for {0} Season {1}", series.Title, seasonNumber);
|
|
|
|
notification.CurrentMessage = String.Format("Searching for {0} Season {1}", series.Title, seasonNumber);
|
|
|
|
var episodes = _episodeProvider.GetEpisodesBySeason(seriesId, seasonNumber);
|
|
|
|
var episodes = _episodeProvider.GetEpisodesBySeason(seriesId, seasonNumber);
|
|
|
|
var reports = PerformSearch(notification, series, seasonNumber, episodes);
|
|
|
|
|
|
|
|
|
|
|
|
List<EpisodeParseResult> reports;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (series.UseSceneNumbering)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var sceneSeasonNumbers = episodes.Select(e => e.SceneSeasonNumber).ToList();
|
|
|
|
|
|
|
|
var sceneEpisodeNumbers = episodes.Select(e => e.SceneEpisodeNumber).ToList();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (sceneSeasonNumbers.Distinct().Count() > 1)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
_logger.Trace("Uses scene numbering, but multiple seasons found, skipping.");
|
|
|
|
|
|
|
|
return new List<int>();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
reports = PerformPartialSeasonSearch(series, sceneSeasonNumbers.First(), GetEpisodeNumberPrefixes(sceneEpisodeNumbers));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
reports = PerformPartialSeasonSearch(series, seasonNumber, GetEpisodeNumberPrefixes(episodes.Select(e => e.EpisodeNumber)));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
_logger.Debug("Finished searching all indexers. Total {0}", reports.Count);
|
|
|
|
_logger.Debug("Finished searching all indexers. Total {0}", reports.Count);
|
|
|
|
|
|
|
|
|
|
|
|
if (reports.Count == 0)
|
|
|
|
if (reports.Count == 0)
|
|
|
@ -153,27 +201,29 @@ namespace NzbDrone.Core.Providers
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
notification.CurrentMessage = "Looking for " + episode;
|
|
|
|
notification.CurrentMessage = "Looking for " + episode;
|
|
|
|
|
|
|
|
List<EpisodeParseResult> reports;
|
|
|
|
|
|
|
|
|
|
|
|
if (episode.Series.IsDaily && !episode.AirDate.HasValue)
|
|
|
|
var searchResult = new SearchHistory
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
SearchTime = DateTime.Now,
|
|
|
|
|
|
|
|
SeriesId = episode.Series.SeriesId,
|
|
|
|
|
|
|
|
EpisodeId = episodeId
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (episode.Series.IsDaily)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (!episode.AirDate.HasValue)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
_logger.Warn("AirDate is not Valid for: {0}", episode);
|
|
|
|
_logger.Warn("AirDate is not Valid for: {0}", episode);
|
|
|
|
notification.CurrentMessage = String.Format("Search for {0} Failed, AirDate is invalid", episode);
|
|
|
|
notification.CurrentMessage = String.Format("Search for {0} Failed, AirDate is invalid", episode);
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var searchResult = new SearchHistory
|
|
|
|
reports = PerformDailyEpisodeSearch(episode.Series, episode);
|
|
|
|
{
|
|
|
|
|
|
|
|
SearchTime = DateTime.Now,
|
|
|
|
|
|
|
|
SeriesId = episode.Series.SeriesId
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var reports = PerformSearch(notification, episode.Series, episode.SeasonNumber, new List<Episode> { episode });
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_logger.Debug("Finished searching all indexers. Total {0}", reports.Count);
|
|
|
|
_logger.Debug("Finished searching all indexers. Total {0}", reports.Count);
|
|
|
|
notification.CurrentMessage = "Processing search results";
|
|
|
|
notification.CurrentMessage = "Processing search results";
|
|
|
|
|
|
|
|
|
|
|
|
if (episode.Series.IsDaily)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
searchResult.SearchHistoryItems = ProcessSearchResults(notification, reports, episode.Series, episode.AirDate.Value);
|
|
|
|
searchResult.SearchHistoryItems = ProcessSearchResults(notification, reports, episode.Series, episode.AirDate.Value);
|
|
|
|
_searchHistoryProvider.Add(searchResult);
|
|
|
|
_searchHistoryProvider.Add(searchResult);
|
|
|
|
|
|
|
|
|
|
|
@ -183,17 +233,17 @@ namespace NzbDrone.Core.Providers
|
|
|
|
|
|
|
|
|
|
|
|
else if (episode.Series.UseSceneNumbering)
|
|
|
|
else if (episode.Series.UseSceneNumbering)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
searchResult.EpisodeId = episodeId;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var seasonNumber = episode.SceneSeasonNumber;
|
|
|
|
var seasonNumber = episode.SceneSeasonNumber;
|
|
|
|
var episodeNumber = episode.SceneEpisodeNumber;
|
|
|
|
var episodeNumber = episode.SceneEpisodeNumber;
|
|
|
|
|
|
|
|
|
|
|
|
if (seasonNumber == 0 || episodeNumber == 0)
|
|
|
|
if (seasonNumber == 0 && episodeNumber == 0)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
seasonNumber = episode.SeasonNumber;
|
|
|
|
seasonNumber = episode.SeasonNumber;
|
|
|
|
episodeNumber = episode.EpisodeNumber;
|
|
|
|
episodeNumber = episode.EpisodeNumber;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
reports = PerformEpisodeSearch(episode.Series, seasonNumber, episodeNumber);
|
|
|
|
|
|
|
|
|
|
|
|
searchResult.SearchHistoryItems = ProcessSearchResults(
|
|
|
|
searchResult.SearchHistoryItems = ProcessSearchResults(
|
|
|
|
notification,
|
|
|
|
notification,
|
|
|
|
reports,
|
|
|
|
reports,
|
|
|
@ -211,7 +261,8 @@ namespace NzbDrone.Core.Providers
|
|
|
|
|
|
|
|
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
searchResult.EpisodeId = episodeId;
|
|
|
|
reports = PerformEpisodeSearch(episode.Series, episode.SeasonNumber, episode.EpisodeNumber);
|
|
|
|
|
|
|
|
|
|
|
|
searchResult.SearchHistoryItems = ProcessSearchResults(notification, reports, searchResult, episode.Series, episode.SeasonNumber, episode.EpisodeNumber);
|
|
|
|
searchResult.SearchHistoryItems = ProcessSearchResults(notification, reports, searchResult, episode.Series, episode.SeasonNumber, episode.EpisodeNumber);
|
|
|
|
_searchHistoryProvider.Add(searchResult);
|
|
|
|
_searchHistoryProvider.Add(searchResult);
|
|
|
|
|
|
|
|
|
|
|
@ -221,75 +272,12 @@ namespace NzbDrone.Core.Providers
|
|
|
|
|
|
|
|
|
|
|
|
_logger.Warn("Unable to find {0} in any of indexers.", episode);
|
|
|
|
_logger.Warn("Unable to find {0} in any of indexers.", episode);
|
|
|
|
|
|
|
|
|
|
|
|
if (reports.Any())
|
|
|
|
notification.CurrentMessage = reports.Any() ? String.Format("Sorry, couldn't find {0}, that matches your preferences.", episode)
|
|
|
|
{
|
|
|
|
: String.Format("Sorry, couldn't find {0} in any of indexers.", episode);
|
|
|
|
notification.CurrentMessage = String.Format("Sorry, couldn't find {0}, that matches your preferences.", episode);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
notification.CurrentMessage = String.Format("Sorry, couldn't find {0} in any of indexers.", episode);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public List<EpisodeParseResult> PerformSearch(ProgressNotification notification, Series series, int seasonNumber, IList<Episode> episodes = null)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
//If single episode, do a single episode search, if full season then do a full season search, otherwise, do a partial search
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var reports = new List<EpisodeParseResult>();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var title = _sceneMappingProvider.GetSceneName(series.SeriesId);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (string.IsNullOrWhiteSpace(title))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
title = series.Title;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Parallel.ForEach(_indexerProvider.GetEnabledIndexers(), indexer =>
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
try
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (episodes == null)
|
|
|
|
|
|
|
|
reports.AddRange(indexer.FetchSeason(title, seasonNumber));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//Treat as single episode
|
|
|
|
|
|
|
|
else if (episodes.Count == 1)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
//Use SceneNumbering - Only if SceneSN and SceneEN are greater than zero
|
|
|
|
|
|
|
|
if (series.UseSceneNumbering && episodes.First().SceneSeasonNumber > 0 && episodes.First().SceneEpisodeNumber > 0)
|
|
|
|
|
|
|
|
reports.AddRange(indexer.FetchEpisode(title, episodes.First().SceneSeasonNumber, episodes.First().SceneEpisodeNumber));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//Standard
|
|
|
|
|
|
|
|
else if (!series.IsDaily)
|
|
|
|
|
|
|
|
reports.AddRange(indexer.FetchEpisode(title, seasonNumber, episodes.First().EpisodeNumber));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//Daily Episode
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
reports.AddRange(indexer.FetchDailyEpisode(title, episodes.First().AirDate.Value));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//Treat as Partial Season
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var prefixes = GetEpisodeNumberPrefixes(episodes.Select(s => s.EpisodeNumber));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
foreach (var episodePrefix in prefixes)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
reports.AddRange(indexer.FetchPartialSeason(title, seasonNumber, episodePrefix));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
catch (Exception e)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
_logger.ErrorException("An error has occurred while fetching items from " + indexer.Name, e);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return reports;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public List<SearchHistoryItem> ProcessSearchResults(ProgressNotification notification, IEnumerable<EpisodeParseResult> reports, SearchHistory searchResult, Series series, int seasonNumber, int? episodeNumber = null)
|
|
|
|
public List<SearchHistoryItem> ProcessSearchResults(ProgressNotification notification, IEnumerable<EpisodeParseResult> reports, SearchHistory searchResult, Series series, int seasonNumber, int? episodeNumber = null)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var items = new List<SearchHistoryItem>();
|
|
|
|
var items = new List<SearchHistoryItem>();
|
|
|
@ -488,5 +476,106 @@ namespace NzbDrone.Core.Providers
|
|
|
|
|
|
|
|
|
|
|
|
return results.Distinct().ToList();
|
|
|
|
return results.Distinct().ToList();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public List<EpisodeParseResult> PerformEpisodeSearch(Series series, int seasonNumber, int episodeNumber)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var reports = new List<EpisodeParseResult>();
|
|
|
|
|
|
|
|
var title = GetSeriesTitle(series);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Parallel.ForEach(_indexerProvider.GetEnabledIndexers(), indexer =>
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
try
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
reports.AddRange(indexer.FetchEpisode(title, seasonNumber, episodeNumber));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
catch (Exception e)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
_logger.ErrorException(String.Format("An error has occurred while searching for {0}-S{1:00}E{2:00} from: {3}",
|
|
|
|
|
|
|
|
series.Title, seasonNumber, episodeNumber, indexer.Name), e);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return reports;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public List<EpisodeParseResult> PerformDailyEpisodeSearch(Series series, Episode episode)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var reports = new List<EpisodeParseResult>();
|
|
|
|
|
|
|
|
var title = GetSeriesTitle(series);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Parallel.ForEach(_indexerProvider.GetEnabledIndexers(), indexer =>
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
try
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
_logger.Trace("Episode {0} is a daily episode, searching as daily", episode);
|
|
|
|
|
|
|
|
reports.AddRange(indexer.FetchDailyEpisode(title, episode.AirDate.Value));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
catch (Exception e)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
_logger.ErrorException(String.Format("An error has occurred while searching for {0}-{1} from: {2}",
|
|
|
|
|
|
|
|
series.Title, episode.AirDate, indexer.Name), e);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return reports;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public List<EpisodeParseResult> PerformPartialSeasonSearch(Series series, int seasonNumber, List<int> prefixes)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var reports = new List<EpisodeParseResult>();
|
|
|
|
|
|
|
|
var title = GetSeriesTitle(series);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Parallel.ForEach(_indexerProvider.GetEnabledIndexers(), indexer =>
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
try
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
foreach (var episodePrefix in prefixes)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
reports.AddRange(indexer.FetchPartialSeason(title, seasonNumber, episodePrefix));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
catch (Exception e)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
_logger.ErrorException(String.Format("An error has occurred while searching for {0}-S{1:00} from: {2}",
|
|
|
|
|
|
|
|
series.Title, seasonNumber, indexer.Name), e);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return reports;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public List<EpisodeParseResult> PerformSeasonSearch(Series series, int seasonNumber)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var reports = new List<EpisodeParseResult>();
|
|
|
|
|
|
|
|
var title = GetSeriesTitle(series);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Parallel.ForEach(_indexerProvider.GetEnabledIndexers(), indexer =>
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
try
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
reports.AddRange(indexer.FetchSeason(title, seasonNumber));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
catch (Exception e)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
_logger.ErrorException("An error has occurred while searching for items from: " + indexer.Name, e);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return reports;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public string GetSeriesTitle(Series series)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var title = _sceneMappingProvider.GetSceneName(series.SeriesId);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (String.IsNullOrWhiteSpace(title))
|
|
|
|
|
|
|
|
title = series.Title;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return title;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|