@ -22,7 +22,7 @@ namespace NzbDrone.Core.Providers
private readonly SceneMappingProvider _sceneMappingProvider ;
private readonly SceneMappingProvider _sceneMappingProvider ;
private readonly UpgradePossibleSpecification _upgradePossibleSpecification ;
private readonly UpgradePossibleSpecification _upgradePossibleSpecification ;
private readonly AllowedDownloadSpecification _allowedDownloadSpecification ;
private readonly AllowedDownloadSpecification _allowedDownloadSpecification ;
private readonly Search ResultProvider _searchResult Provider;
private readonly Search HistoryProvider _searchHistory Provider;
private static readonly Logger Logger = LogManager . GetCurrentClassLogger ( ) ;
private static readonly Logger Logger = LogManager . GetCurrentClassLogger ( ) ;
@ -30,7 +30,7 @@ namespace NzbDrone.Core.Providers
public SearchProvider ( EpisodeProvider episodeProvider , DownloadProvider downloadProvider , SeriesProvider seriesProvider ,
public SearchProvider ( EpisodeProvider episodeProvider , DownloadProvider downloadProvider , SeriesProvider seriesProvider ,
IndexerProvider indexerProvider , SceneMappingProvider sceneMappingProvider ,
IndexerProvider indexerProvider , SceneMappingProvider sceneMappingProvider ,
UpgradePossibleSpecification upgradePossibleSpecification , AllowedDownloadSpecification allowedDownloadSpecification ,
UpgradePossibleSpecification upgradePossibleSpecification , AllowedDownloadSpecification allowedDownloadSpecification ,
Search ResultProvider searchResult Provider)
Search HistoryProvider searchHistory Provider)
{
{
_episodeProvider = episodeProvider ;
_episodeProvider = episodeProvider ;
_downloadProvider = downloadProvider ;
_downloadProvider = downloadProvider ;
@ -39,7 +39,7 @@ namespace NzbDrone.Core.Providers
_sceneMappingProvider = sceneMappingProvider ;
_sceneMappingProvider = sceneMappingProvider ;
_upgradePossibleSpecification = upgradePossibleSpecification ;
_upgradePossibleSpecification = upgradePossibleSpecification ;
_allowedDownloadSpecification = allowedDownloadSpecification ;
_allowedDownloadSpecification = allowedDownloadSpecification ;
_search ResultProvider = searchResult Provider;
_search HistoryProvider = searchHistory Provider;
}
}
public SearchProvider ( )
public SearchProvider ( )
@ -48,7 +48,7 @@ namespace NzbDrone.Core.Providers
public virtual bool SeasonSearch ( ProgressNotification notification , int seriesId , int seasonNumber )
public virtual bool SeasonSearch ( ProgressNotification notification , int seriesId , int seasonNumber )
{
{
var searchResult = new Search Result
var searchResult = new Search History
{
{
SearchTime = DateTime . Now ,
SearchTime = DateTime . Now ,
SeriesId = seriesId ,
SeriesId = seriesId ,
@ -91,15 +91,15 @@ namespace NzbDrone.Core.Providers
e = > e . EpisodeNumbers = episodeNumbers . ToList ( )
e = > e . EpisodeNumbers = episodeNumbers . ToList ( )
) ;
) ;
searchResult . Search Result Items = ProcessSearchResults ( notification , reports , searchResult , series , seasonNumber ) ;
searchResult . Search History Items = ProcessSearchResults ( notification , reports , searchResult , series , seasonNumber ) ;
_search Result Provider. Add ( searchResult ) ;
_search History Provider. Add ( searchResult ) ;
return ( searchResult . Successes . Count = = episodeNumbers . Count ) ;
return ( searchResult . Successes . Count = = episodeNumbers . Count ) ;
}
}
public virtual List < int > PartialSeasonSearch ( ProgressNotification notification , int seriesId , int seasonNumber )
public virtual List < int > PartialSeasonSearch ( ProgressNotification notification , int seriesId , int seasonNumber )
{
{
var searchResult = new Search Result
var searchResult = new Search History
{
{
SearchTime = DateTime . Now ,
SearchTime = DateTime . Now ,
SeriesId = seriesId ,
SeriesId = seriesId ,
@ -127,9 +127,9 @@ namespace NzbDrone.Core.Providers
return new List < int > ( ) ;
return new List < int > ( ) ;
notification . CurrentMessage = "Processing search results" ;
notification . CurrentMessage = "Processing search results" ;
searchResult . Search Result Items = ProcessSearchResults ( notification , reports , searchResult , series , seasonNumber ) ;
searchResult . Search History Items = ProcessSearchResults ( notification , reports , searchResult , series , seasonNumber ) ;
_search Result Provider. Add ( searchResult ) ;
_search History Provider. Add ( searchResult ) ;
return searchResult . Successes ;
return searchResult . Successes ;
}
}
@ -160,7 +160,7 @@ namespace NzbDrone.Core.Providers
return false ;
return false ;
}
}
var searchResult = new Search Result
var searchResult = new Search History
{
{
SearchTime = DateTime . Now ,
SearchTime = DateTime . Now ,
SeriesId = episode . Series . SeriesId
SeriesId = episode . Series . SeriesId
@ -173,20 +173,20 @@ namespace NzbDrone.Core.Providers
if ( episode . Series . IsDaily )
if ( episode . Series . IsDaily )
{
{
searchResult . Search Result Items = ProcessSearchResults ( notification , reports , episode . Series , episode . AirDate . Value ) ;
searchResult . Search History Items = ProcessSearchResults ( notification , reports , episode . Series , episode . AirDate . Value ) ;
_search Result Provider. Add ( searchResult ) ;
_search History Provider. Add ( searchResult ) ;
if ( searchResult . Search Result Items. Any ( r = > r . Success ) )
if ( searchResult . Search History Items. Any ( r = > r . Success ) )
return true ;
return true ;
}
}
else
else
{
{
searchResult . EpisodeId = episodeId ;
searchResult . EpisodeId = episodeId ;
searchResult . Search Result Items = ProcessSearchResults ( notification , reports , searchResult , episode . Series , episode . SeasonNumber , episode . EpisodeNumber ) ;
searchResult . Search History Items = ProcessSearchResults ( notification , reports , searchResult , episode . Series , episode . SeasonNumber , episode . EpisodeNumber ) ;
_search Result Provider. Add ( searchResult ) ;
_search History Provider. Add ( searchResult ) ;
if ( searchResult . Search Result Items. Any ( r = > r . Success ) )
if ( searchResult . Search History Items. Any ( r = > r . Success ) )
return true ;
return true ;
}
}
@ -257,10 +257,10 @@ namespace NzbDrone.Core.Providers
return reports ;
return reports ;
}
}
public List < Search Result Item> ProcessSearchResults ( ProgressNotification notification , IEnumerable < EpisodeParseResult > reports , Search Result searchResult , Series series , int seasonNumber , int? episodeNumber = null )
public List < Search History Item> ProcessSearchResults ( ProgressNotification notification , IEnumerable < EpisodeParseResult > reports , Search History searchResult , Series series , int seasonNumber , int? episodeNumber = null )
{
{
var successes = new List < int > ( ) ;
var successes = new List < int > ( ) ;
var items = new List < Search Result Item> ( ) ;
var items = new List < Search History Item> ( ) ;
foreach ( var episodeParseResult in reports . OrderByDescending ( c = > c . Quality ) . ThenBy ( c = > c . Age ) )
foreach ( var episodeParseResult in reports . OrderByDescending ( c = > c . Quality ) . ThenBy ( c = > c . Age ) )
{
{
@ -268,7 +268,7 @@ namespace NzbDrone.Core.Providers
{
{
Logger . Trace ( "Analysing report " + episodeParseResult ) ;
Logger . Trace ( "Analysing report " + episodeParseResult ) ;
var item = new Search Result Item
var item = new Search History Item
{
{
ReportTitle = episodeParseResult . OriginalString ,
ReportTitle = episodeParseResult . OriginalString ,
NzbUrl = episodeParseResult . NzbUrl ,
NzbUrl = episodeParseResult . NzbUrl ,
@ -353,16 +353,16 @@ namespace NzbDrone.Core.Providers
return items ;
return items ;
}
}
public List < Search Result Item> ProcessSearchResults ( ProgressNotification notification , IEnumerable < EpisodeParseResult > reports , Series series , DateTime airDate )
public List < Search History Item> ProcessSearchResults ( ProgressNotification notification , IEnumerable < EpisodeParseResult > reports , Series series , DateTime airDate )
{
{
var items = new List < Search Result Item> ( ) ;
var items = new List < Search History Item> ( ) ;
var skip = false ;
var skip = false ;
foreach ( var episodeParseResult in reports . OrderByDescending ( c = > c . Quality ) )
foreach ( var episodeParseResult in reports . OrderByDescending ( c = > c . Quality ) )
{
{
try
try
{
{
var item = new Search Result Item
var item = new Search History Item
{
{
ReportTitle = episodeParseResult . OriginalString ,
ReportTitle = episodeParseResult . OriginalString ,
NzbUrl = episodeParseResult . NzbUrl ,
NzbUrl = episodeParseResult . NzbUrl ,