mirror of
https://github.com/Radarr/Radarr.git
synced 2026-04-27 22:57:09 -04:00
Fixed: Improve sorting movies by release dates
This commit is contained in:
@@ -1380,6 +1380,7 @@
|
||||
"RelativePath": "Relative Path",
|
||||
"Release": "Release",
|
||||
"ReleaseBranchCheckOfficialBranchMessage": "Branch {0} is not a valid {appName} release branch, you will not receive updates",
|
||||
"ReleaseDate": "Release Date",
|
||||
"ReleaseDates": "Release Dates",
|
||||
"ReleaseGroup": "Release Group",
|
||||
"ReleaseGroupFootNote": "Optionally control truncation to a maximum number of bytes including ellipsis (`...`). Truncating from the end (e.g. `{Release Group:30}`) or the beginning (e.g. `{Release Group:-30}`) are both supported.`).",
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NzbDrone.Common.Extensions;
|
||||
using NzbDrone.Core.Datastore;
|
||||
using NzbDrone.Core.MediaFiles;
|
||||
@@ -117,6 +118,30 @@ namespace NzbDrone.Core.Movies
|
||||
return DateTime.UtcNow >= minimumAvailabilityDate.AddDays(delay);
|
||||
}
|
||||
|
||||
public DateTime? GetReleaseDate()
|
||||
{
|
||||
if (MinimumAvailability is MovieStatusType.TBA or MovieStatusType.Announced)
|
||||
{
|
||||
return new[] { MovieMetadata.Value.InCinemas, MovieMetadata.Value.DigitalRelease, MovieMetadata.Value.PhysicalRelease }
|
||||
.Where(x => x.HasValue)
|
||||
.Min();
|
||||
}
|
||||
|
||||
if (MinimumAvailability == MovieStatusType.InCinemas && MovieMetadata.Value.InCinemas.HasValue)
|
||||
{
|
||||
return MovieMetadata.Value.InCinemas.Value;
|
||||
}
|
||||
|
||||
if (MovieMetadata.Value.DigitalRelease.HasValue || MovieMetadata.Value.PhysicalRelease.HasValue)
|
||||
{
|
||||
return new[] { MovieMetadata.Value.DigitalRelease, MovieMetadata.Value.PhysicalRelease }
|
||||
.Where(x => x.HasValue)
|
||||
.Min();
|
||||
}
|
||||
|
||||
return MovieMetadata.Value.InCinemas?.AddDays(90);
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return string.Format("[{1} ({2})][{0}, {3}]", MovieMetadata.Value.ImdbId, MovieMetadata.Value.Title.NullSafe(), MovieMetadata.Value.Year.NullSafe(), MovieMetadata.Value.TmdbId);
|
||||
|
||||
Reference in New Issue
Block a user