mirror of
https://github.com/Radarr/Radarr
synced 2025-01-03 22:04:43 +00:00
Fix pending release service, also fix the deduper
This commit is contained in:
parent
b02b066257
commit
b137fc075a
1 changed files with 34 additions and 36 deletions
|
@ -117,8 +117,6 @@ public List<RemoteMovie> GetPendingRemoteMovies(int movieId)
|
|||
|
||||
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)
|
||||
|
@ -136,7 +134,7 @@ public List<RemoteMovie> GetPendingRemoteMovies(int movieId)
|
|||
Series = null,
|
||||
Episode = null,
|
||||
Movie = pendingRelease.RemoteMovie.Movie,
|
||||
Quality = pendingRelease.RemoteMovie.ParsedMovieInfo.Quality,
|
||||
Quality = pendingRelease.RemoteMovie.ParsedMovieInfo?.Quality ?? new QualityModel(),
|
||||
Title = pendingRelease.Title,
|
||||
Size = pendingRelease.RemoteMovie.Release.Size,
|
||||
Sizeleft = pendingRelease.RemoteMovie.Release.Size,
|
||||
|
@ -146,16 +144,16 @@ public List<RemoteMovie> GetPendingRemoteMovies(int movieId)
|
|||
Status = "Pending",
|
||||
Protocol = pendingRelease.RemoteMovie.Release.DownloadProtocol
|
||||
};
|
||||
|
||||
queued.Add(queue);
|
||||
//}
|
||||
}
|
||||
|
||||
//Return best quality release for each episode
|
||||
var deduped = queued.GroupBy(q => q.Episode.Id).Select(g =>
|
||||
var deduped = queued.GroupBy(q => q.Movie.Id).Select(g =>
|
||||
{
|
||||
var series = g.First().Series;
|
||||
var movies = g.First().Movie;
|
||||
|
||||
return g.OrderByDescending(e => e.Quality, new QualityModelComparer(series.Profile))
|
||||
return g.OrderByDescending(e => e.Quality, new QualityModelComparer(movies.Profile))
|
||||
.ThenBy(q => PrioritizeDownloadProtocol(q.Movie, q.Protocol))
|
||||
.First();
|
||||
});
|
||||
|
@ -254,12 +252,12 @@ private int GetDelay(RemoteMovie remoteMovie)
|
|||
return new[] { delay, minimumAge }.Max();
|
||||
}
|
||||
|
||||
private void RemoveGrabbed(RemoteMovie remoteEpisode)
|
||||
private void RemoveGrabbed(RemoteMovie remoteMovie)
|
||||
{
|
||||
var pendingReleases = GetPendingReleases();
|
||||
|
||||
|
||||
var existingReports = pendingReleases.Where(r => r.RemoteMovie.Movie.Id == remoteEpisode.Movie.Id)
|
||||
var existingReports = pendingReleases.Where(r => r.RemoteMovie.Movie.Id == remoteMovie.Movie.Id)
|
||||
.ToList();
|
||||
|
||||
if (existingReports.Empty())
|
||||
|
@ -267,11 +265,11 @@ private void RemoveGrabbed(RemoteMovie remoteEpisode)
|
|||
return;
|
||||
}
|
||||
|
||||
var profile = remoteEpisode.Movie.Profile.Value;
|
||||
var profile = remoteMovie.Movie.Profile.Value;
|
||||
|
||||
foreach (var existingReport in existingReports)
|
||||
{
|
||||
var compare = new QualityModelComparer(profile).Compare(remoteEpisode.ParsedMovieInfo.Quality,
|
||||
var compare = new QualityModelComparer(profile).Compare(remoteMovie.ParsedMovieInfo.Quality,
|
||||
existingReport.RemoteMovie.ParsedMovieInfo.Quality);
|
||||
|
||||
//Only remove lower/equal quality pending releases
|
||||
|
|
Loading…
Reference in a new issue