Skip to content

Commit

Permalink
Allow Discography to be grabbed automatically if all albums will be r…
Browse files Browse the repository at this point in the history
…eleased within 24 hours

(cherry picked from commit 87795708b5caf63e63570cb62c6043a781ee89ae)

Closes #3181
  • Loading branch information
markus101 authored and mynameisbogdan committed Feb 5, 2024
1 parent abefdca commit 2f0d02b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
Expand Up @@ -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()
{
Expand Down
Expand Up @@ -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.");
Expand Down
1 change: 1 addition & 0 deletions src/NzbDrone.Core/IndexerSearch/AlbumSearchService.cs
@@ -1,3 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
Expand Down

0 comments on commit 2f0d02b

Please sign in to comment.