mirror of
https://github.com/Radarr/Radarr.git
synced 2024-11-20 18:02:44 +01:00
New: Show error message for pending queue items without movies
(cherry picked from commit 5ca868b4b2d34ba65ba3d40144ed889ccf55343d) Closes #8320
This commit is contained in:
parent
2d05708fa9
commit
b3517c14de
@ -184,61 +184,22 @@ public List<RemoteMovie> GetPendingRemoteMovies(int movieId)
|
|||||||
|
|
||||||
foreach (var pendingRelease in pendingReleases)
|
foreach (var pendingRelease in pendingReleases)
|
||||||
{
|
{
|
||||||
if (pendingRelease.RemoteMovie != null)
|
if (pendingRelease.RemoteMovie.Movie == null)
|
||||||
{
|
{
|
||||||
var ect = pendingRelease.Release.PublishDate.AddMinutes(GetDelay(pendingRelease.RemoteMovie));
|
var noMovieItem = GetQueueItem(pendingRelease, nextRssSync, null);
|
||||||
|
|
||||||
if (ect < nextRssSync.Value)
|
noMovieItem.ErrorMessage = "Unable to find matching movie(s)";
|
||||||
{
|
|
||||||
ect = nextRssSync.Value;
|
queued.Add(noMovieItem);
|
||||||
}
|
|
||||||
else
|
continue;
|
||||||
{
|
|
||||||
ect = ect.AddMinutes(_configService.RssSyncInterval);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var timeleft = ect.Subtract(DateTime.UtcNow);
|
queued.Add(GetQueueItem(pendingRelease, nextRssSync, pendingRelease.RemoteMovie.Movie));
|
||||||
|
|
||||||
if (timeleft.TotalSeconds < 0)
|
|
||||||
{
|
|
||||||
timeleft = TimeSpan.Zero;
|
|
||||||
}
|
|
||||||
|
|
||||||
string downloadClientName = null;
|
|
||||||
var indexer = _indexerFactory.Find(pendingRelease.Release.IndexerId);
|
|
||||||
|
|
||||||
if (indexer is { DownloadClientId: > 0 })
|
|
||||||
{
|
|
||||||
var downloadClient = _downloadClientFactory.Find(indexer.DownloadClientId);
|
|
||||||
|
|
||||||
downloadClientName = downloadClient?.Name;
|
|
||||||
}
|
|
||||||
|
|
||||||
var queue = new Queue.Queue
|
|
||||||
{
|
|
||||||
Id = GetQueueId(pendingRelease, pendingRelease.RemoteMovie.Movie),
|
|
||||||
Movie = pendingRelease.RemoteMovie.Movie,
|
|
||||||
Quality = pendingRelease.RemoteMovie.ParsedMovieInfo?.Quality ?? new QualityModel(),
|
|
||||||
Languages = pendingRelease.RemoteMovie.Languages,
|
|
||||||
Title = pendingRelease.Title,
|
|
||||||
Size = pendingRelease.RemoteMovie.Release.Size,
|
|
||||||
Sizeleft = pendingRelease.RemoteMovie.Release.Size,
|
|
||||||
RemoteMovie = pendingRelease.RemoteMovie,
|
|
||||||
Timeleft = timeleft,
|
|
||||||
EstimatedCompletionTime = ect,
|
|
||||||
Added = pendingRelease.Added,
|
|
||||||
Status = pendingRelease.Reason.ToString(),
|
|
||||||
Protocol = pendingRelease.RemoteMovie.Release.DownloadProtocol,
|
|
||||||
Indexer = pendingRelease.RemoteMovie.Release.Indexer,
|
|
||||||
DownloadClient = downloadClientName
|
|
||||||
};
|
|
||||||
|
|
||||||
queued.Add(queue);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return best quality release for each movie
|
// Return best quality release for each movie
|
||||||
var deduped = queued.GroupBy(q => q.Movie.Id).Select(g =>
|
var deduped = queued.Where(q => q.Movie != null).GroupBy(q => q.Movie.Id).Select(g =>
|
||||||
{
|
{
|
||||||
var movies = g.First().Movie;
|
var movies = g.First().Movie;
|
||||||
|
|
||||||
@ -309,7 +270,7 @@ private List<PendingRelease> IncludeRemoteMovies(List<PendingRelease> releases,
|
|||||||
{
|
{
|
||||||
var movie = movieMap.GetValueOrDefault(release.MovieId);
|
var movie = movieMap.GetValueOrDefault(release.MovieId);
|
||||||
|
|
||||||
// Just in case the series was removed, but wasn't cleaned up yet (housekeeper will clean it up)
|
// Just in case the movie was removed, but wasn't cleaned up yet (housekeeper will clean it up)
|
||||||
if (movie == null)
|
if (movie == null)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
@ -339,6 +300,58 @@ private List<PendingRelease> IncludeRemoteMovies(List<PendingRelease> releases,
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Queue.Queue GetQueueItem(PendingRelease pendingRelease, Lazy<DateTime> nextRssSync, Movie movie)
|
||||||
|
{
|
||||||
|
var ect = pendingRelease.Release.PublishDate.AddMinutes(GetDelay(pendingRelease.RemoteMovie));
|
||||||
|
|
||||||
|
if (ect < nextRssSync.Value)
|
||||||
|
{
|
||||||
|
ect = nextRssSync.Value;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ect = ect.AddMinutes(_configService.RssSyncInterval);
|
||||||
|
}
|
||||||
|
|
||||||
|
var timeleft = ect.Subtract(DateTime.UtcNow);
|
||||||
|
|
||||||
|
if (timeleft.TotalSeconds < 0)
|
||||||
|
{
|
||||||
|
timeleft = TimeSpan.Zero;
|
||||||
|
}
|
||||||
|
|
||||||
|
string downloadClientName = null;
|
||||||
|
var indexer = _indexerFactory.Find(pendingRelease.Release.IndexerId);
|
||||||
|
|
||||||
|
if (indexer is { DownloadClientId: > 0 })
|
||||||
|
{
|
||||||
|
var downloadClient = _downloadClientFactory.Find(indexer.DownloadClientId);
|
||||||
|
|
||||||
|
downloadClientName = downloadClient?.Name;
|
||||||
|
}
|
||||||
|
|
||||||
|
var queue = new Queue.Queue
|
||||||
|
{
|
||||||
|
Id = GetQueueId(pendingRelease, movie),
|
||||||
|
Movie = movie,
|
||||||
|
Quality = pendingRelease.RemoteMovie.ParsedMovieInfo?.Quality ?? new QualityModel(),
|
||||||
|
Languages = pendingRelease.RemoteMovie.Languages,
|
||||||
|
Title = pendingRelease.Title,
|
||||||
|
Size = pendingRelease.RemoteMovie.Release.Size,
|
||||||
|
Sizeleft = pendingRelease.RemoteMovie.Release.Size,
|
||||||
|
RemoteMovie = pendingRelease.RemoteMovie,
|
||||||
|
Timeleft = timeleft,
|
||||||
|
EstimatedCompletionTime = ect,
|
||||||
|
Added = pendingRelease.Added,
|
||||||
|
Status = pendingRelease.Reason.ToString(),
|
||||||
|
Protocol = pendingRelease.RemoteMovie.Release.DownloadProtocol,
|
||||||
|
Indexer = pendingRelease.RemoteMovie.Release.Indexer,
|
||||||
|
DownloadClient = downloadClientName
|
||||||
|
};
|
||||||
|
|
||||||
|
return queue;
|
||||||
|
}
|
||||||
|
|
||||||
private void Insert(DownloadDecision decision, PendingReleaseReason reason)
|
private void Insert(DownloadDecision decision, PendingReleaseReason reason)
|
||||||
{
|
{
|
||||||
var release = new PendingRelease
|
var release = new PendingRelease
|
||||||
@ -441,7 +454,7 @@ private PendingRelease FindPendingRelease(int queueId)
|
|||||||
|
|
||||||
private int GetQueueId(PendingRelease pendingRelease, Movie movie)
|
private int GetQueueId(PendingRelease pendingRelease, Movie movie)
|
||||||
{
|
{
|
||||||
return HashConverter.GetHashInt31(string.Format("pending-{0}-movie{1}", pendingRelease.Id, movie.Id));
|
return HashConverter.GetHashInt31(string.Format("pending-{0}-movie{1}", pendingRelease.Id, movie?.Id ?? 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
private int PrioritizeDownloadProtocol(Movie movie, DownloadProtocol downloadProtocol)
|
private int PrioritizeDownloadProtocol(Movie movie, DownloadProtocol downloadProtocol)
|
||||||
|
Loading…
Reference in New Issue
Block a user