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