You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
62 lines
2.2 KiB
62 lines
2.2 KiB
12 years ago
|
using System;
|
||
12 years ago
|
using System.Collections.Generic;
|
||
12 years ago
|
using System.Linq;
|
||
12 years ago
|
using System.Threading.Tasks;
|
||
|
using NLog;
|
||
12 years ago
|
using NzbDrone.Core.DecisionEngine;
|
||
12 years ago
|
using NzbDrone.Core.Download;
|
||
12 years ago
|
using NzbDrone.Core.IndexerSearch;
|
||
12 years ago
|
using NzbDrone.Core.Indexers;
|
||
12 years ago
|
using NzbDrone.Core.Model;
|
||
12 years ago
|
using NzbDrone.Core.ReferenceData;
|
||
12 years ago
|
using NzbDrone.Core.Tv;
|
||
12 years ago
|
|
||
12 years ago
|
namespace NzbDrone.Core.Test.IndexerSearchTests
|
||
12 years ago
|
{
|
||
|
public class TestSearch : SearchBase
|
||
|
{
|
||
|
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
|
||
|
|
||
12 years ago
|
public TestSearch(ISeriesService seriesService, IEpisodeService episodeService, DownloadProvider downloadProvider,
|
||
12 years ago
|
IIndexerService indexerService, ISceneMappingService sceneMappingService,
|
||
12 years ago
|
DownloadDirector downloadDirector, ISeriesRepository seriesRepository)
|
||
|
: base(seriesRepository, episodeService, downloadProvider, indexerService, sceneMappingService,
|
||
|
downloadDirector)
|
||
12 years ago
|
{
|
||
|
}
|
||
|
|
||
12 years ago
|
public override List<EpisodeParseResult> PerformSearch(Series series, List<Episode> episodes, Model.Notification.ProgressNotification notification)
|
||
12 years ago
|
{
|
||
12 years ago
|
var episode = episodes.Single();
|
||
12 years ago
|
|
||
|
var reports = new List<EpisodeParseResult>();
|
||
|
var title = GetSearchTitle(series);
|
||
|
|
||
12 years ago
|
var seasonNumber = episode.SeasonNumber;
|
||
|
var episodeNumber = episode.EpisodeNumber;
|
||
12 years ago
|
|
||
12 years ago
|
Parallel.ForEach(_indexerService.GetEnabledIndexers(), indexer =>
|
||
12 years ago
|
{
|
||
|
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}",
|
||
12 years ago
|
series.Title, episode.SeasonNumber, episode.EpisodeNumber, indexer.Name), e);
|
||
12 years ago
|
}
|
||
|
});
|
||
|
|
||
|
return reports;
|
||
|
}
|
||
|
|
||
12 years ago
|
public override bool IsEpisodeMatch(Series series, dynamic options, EpisodeParseResult episodeParseResult)
|
||
12 years ago
|
{
|
||
12 years ago
|
return true;
|
||
12 years ago
|
}
|
||
|
|
||
|
}
|
||
|
}
|