mirror of
https://github.com/lidarr/Lidarr
synced 2025-03-03 18:15:37 +00:00
Allow Discography to be grabbed automatically if all albums will be released within 24 hours
(cherry picked from commit 87795708b5caf63e63570cb62c6043a781ee89ae) Closes #3181
This commit is contained in:
parent
abefdca0fc
commit
2f0d02b3bc
3 changed files with 10 additions and 1 deletions
|
@ -57,6 +57,14 @@ public void should_return_true_if_all_albums_have_released()
|
|||
Subject.IsSatisfiedBy(_remoteAlbum, null).Accepted.Should().BeTrue();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_return_true_if_all_albums_will_have_released_in_the_next_24_hours()
|
||||
{
|
||||
_remoteAlbum.Albums.Last().ReleaseDate = DateTime.UtcNow.AddHours(23);
|
||||
|
||||
Subject.IsSatisfiedBy(_remoteAlbum, null).Accepted.Should().BeTrue();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_return_false_if_one_album_has_not_released()
|
||||
{
|
||||
|
|
|
@ -25,7 +25,7 @@ public virtual Decision IsSatisfiedBy(RemoteAlbum subject, SearchCriteriaBase se
|
|||
{
|
||||
_logger.Debug("Checking if all albums in discography release have released. {0}", subject.Release.Title);
|
||||
|
||||
if (subject.Albums.Any(e => !e.ReleaseDate.HasValue || e.ReleaseDate.Value.After(DateTime.UtcNow)))
|
||||
if (subject.Albums.Any(e => !e.ReleaseDate.HasValue || e.ReleaseDate.Value.After(DateTime.UtcNow.AddHours(24))))
|
||||
{
|
||||
_logger.Debug("Discography release {0} rejected. All albums haven't released yet.", subject.Release.Title);
|
||||
return Decision.Reject("Discography release rejected. All albums haven't released yet.");
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
|
Loading…
Reference in a new issue