@ -117,45 +117,43 @@ namespace NzbDrone.Core.Download.Pending
foreach ( var pendingRelease in GetPendingReleases ( ) )
{
//foreach (var episode in pendingRelease.RemoteEpisode.Episodes)
//{
var ect = pendingRelease . Release . PublishDate . AddMinutes ( GetDelay ( pendingRelease . RemoteMovie ) ) ;
if ( ect < nextRssSync . Value )
{
ect = nextRssSync . Value ;
}
else
{
ect = ect . AddMinutes ( _configService . RssSyncInterval ) ;
}
var queue = new Queue . Queue
{
Id = GetQueueId ( pendingRelease , pendingRelease . RemoteMovie . Movie ) ,
Series = null ,
Episode = null ,
Movie = pendingRelease . RemoteMovie . Movie ,
Quality = pendingRelease . RemoteMovie . ParsedMovieInfo . Quality ,
Title = pendingRelease . Title ,
Size = pendingRelease . RemoteMovie . Release . Size ,
Sizeleft = pendingRelease . RemoteMovie . Release . Size ,
RemoteMovie = pendingRelease . RemoteMovie ,
Timeleft = ect . Subtract ( DateTime . UtcNow ) ,
EstimatedCompletionTime = ect ,
Status = "Pending" ,
Protocol = pendingRelease . RemoteMovie . Release . DownloadProtocol
} ;
queued . Add ( queue ) ;
//}
var ect = pendingRelease . Release . PublishDate . AddMinutes ( GetDelay ( pendingRelease . RemoteMovie ) ) ;
if ( ect < nextRssSync . Value )
{
ect = nextRssSync . Value ;
}
else
{
ect = ect . AddMinutes ( _configService . RssSyncInterval ) ;
}
var queue = new Queue . Queue
{
Id = GetQueueId ( pendingRelease , pendingRelease . RemoteMovie . Movie ) ,
Series = null ,
Episode = null ,
Movie = pendingRelease . RemoteMovie . Movie ,
Quality = pendingRelease . RemoteMovie . ParsedMovieInfo ? . Quality ? ? new QualityModel ( ) ,
Title = pendingRelease . Title ,
Size = pendingRelease . RemoteMovie . Release . Size ,
Sizeleft = pendingRelease . RemoteMovie . Release . Size ,
RemoteMovie = pendingRelease . RemoteMovie ,
Timeleft = ect . Subtract ( DateTime . UtcNow ) ,
EstimatedCompletionTime = ect ,
Status = "Pending" ,
Protocol = pendingRelease . RemoteMovie . Release . DownloadProtocol
} ;
queued . Add ( queue ) ;
}
//Return best quality release for each episode
var deduped = queued . GroupBy ( q = > q . Episod e. Id ) . Select ( g = >
var deduped = queued . GroupBy ( q = > q . Movi e. Id ) . Select ( g = >
{
var series = g . First ( ) . Series ;
var movies = g . First ( ) . Movie ;
return g . OrderByDescending ( e = > e . Quality , new QualityModelComparer ( ser ies. Profile ) )
return g . OrderByDescending ( e = > e . Quality , new QualityModelComparer ( mov ies. Profile ) )
. ThenBy ( q = > PrioritizeDownloadProtocol ( q . Movie , q . Protocol ) )
. First ( ) ;
} ) ;
@ -254,12 +252,12 @@ namespace NzbDrone.Core.Download.Pending
return new [ ] { delay , minimumAge } . Max ( ) ;
}
private void RemoveGrabbed ( RemoteMovie remote Episod e)
private void RemoveGrabbed ( RemoteMovie remote Movi e)
{
var pendingReleases = GetPendingReleases ( ) ;
var existingReports = pendingReleases . Where ( r = > r . RemoteMovie . Movie . Id = = remote Episod e. Movie . Id )
var existingReports = pendingReleases . Where ( r = > r . RemoteMovie . Movie . Id = = remote Movi e. Movie . Id )
. ToList ( ) ;
if ( existingReports . Empty ( ) )
@ -267,11 +265,11 @@ namespace NzbDrone.Core.Download.Pending
return ;
}
var profile = remote Episod e. Movie . Profile . Value ;
var profile = remote Movi e. Movie . Profile . Value ;
foreach ( var existingReport in existingReports )
{
var compare = new QualityModelComparer ( profile ) . Compare ( remote Episod e. ParsedMovieInfo . Quality ,
var compare = new QualityModelComparer ( profile ) . Compare ( remote Movi e. ParsedMovieInfo . Quality ,
existingReport . RemoteMovie . ParsedMovieInfo . Quality ) ;
//Only remove lower/equal quality pending releases