1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-07-02 10:22:21 +02:00

New: Provide more Options to choose File Date from

This commit is contained in:
Mr.Pimpky 2023-12-18 16:02:49 +01:00
parent 119cdf6f09
commit 67e1ae7e60
5 changed files with 69 additions and 4 deletions

View File

@ -76,6 +76,24 @@ const fileDateOptions = [
get value() { get value() {
return translate('PhysicalReleaseDate'); return translate('PhysicalReleaseDate');
} }
},
{
key: 'cinemasOrRelease',
get value() {
return translate('InCinemasOrPhysicalReleaseDate');
}
},
{
key: 'oldest',
get value() {
return translate('OldestDate');
}
},
{
key: 'latest',
get value() {
return translate('LatestDate');
}
} }
]; ];

View File

@ -516,6 +516,7 @@
"Importing": "Importing", "Importing": "Importing",
"InCinemas": "In Cinemas", "InCinemas": "In Cinemas",
"InCinemasDate": "In Cinemas Date", "InCinemasDate": "In Cinemas Date",
"InCinemasOrPhysicalReleaseDate": "In Cinemas or Physical Release Date",
"InCinemasMsg": "Movie is in Cinemas", "InCinemasMsg": "Movie is in Cinemas",
"IncludeCustomFormatWhenRenaming": "Include Custom Format when Renaming", "IncludeCustomFormatWhenRenaming": "Include Custom Format when Renaming",
"IncludeCustomFormatWhenRenamingHelpText": "Include in {Custom Formats} renaming format", "IncludeCustomFormatWhenRenamingHelpText": "Include in {Custom Formats} renaming format",
@ -572,6 +573,7 @@
"LastExecution": "Last Execution", "LastExecution": "Last Execution",
"LastUsed": "Last Used", "LastUsed": "Last Used",
"LastWriteTime": "Last Write Time", "LastWriteTime": "Last Write Time",
"LatestDate": "Latest Date",
"LaunchBrowserHelpText": " Open a web browser and navigate to the {appName} homepage on app start.", "LaunchBrowserHelpText": " Open a web browser and navigate to the {appName} homepage on app start.",
"Letterboxd": "Letterboxd", "Letterboxd": "Letterboxd",
"Level": "Level", "Level": "Level",
@ -769,6 +771,7 @@
"NotificationTriggersHelpText": "Select which events should trigger this notification", "NotificationTriggersHelpText": "Select which events should trigger this notification",
"OAuthPopupMessage": "Pop-ups are being blocked by your browser", "OAuthPopupMessage": "Pop-ups are being blocked by your browser",
"Ok": "Ok", "Ok": "Ok",
"OldestDate": "Oldest Date",
"OnApplicationUpdate": "On Application Update", "OnApplicationUpdate": "On Application Update",
"OnApplicationUpdateHelpText": "On Application Update", "OnApplicationUpdateHelpText": "On Application Update",
"OnDownloadHelpText": "On Import", "OnDownloadHelpText": "On Import",

View File

@ -1,9 +1,12 @@
namespace NzbDrone.Core.MediaFiles namespace NzbDrone.Core.MediaFiles
{ {
public enum FileDateType public enum FileDateType
{ {
None = 0, None = 0,
Cinemas = 1, Cinemas = 1,
Release = 2 Release = 2,
CinemasOrRelease = 3,
Oldest = 4,
Latest = 5
} }
} }

View File

@ -70,6 +70,44 @@ private bool ChangeFileDate(MovieFile movieFile, Movie movie)
return ChangeFileDate(movieFilePath, airDate.Value); return ChangeFileDate(movieFilePath, airDate.Value);
} }
case FileDateType.CinemasOrRelease:
{
var finalDate = movie.MovieMetadata.Value.InCinemas ?? movie.MovieMetadata.Value.PhysicalRelease ?? movie.MovieMetadata.Value.DigitalRelease;
if (finalDate.HasValue == false)
{
return false;
}
return ChangeFileDate(movieFilePath, finalDate.Value);
}
case FileDateType.Oldest:
{
var oldestDate = new[] { movie.MovieMetadata.Value.InCinemas, movie.MovieMetadata.Value.PhysicalRelease, movie.MovieMetadata.Value.DigitalRelease }
.Where(d => d.HasValue).OrderBy(d => d).FirstOrDefault();
if (oldestDate.HasValue == false)
{
return false;
}
return ChangeFileDate(movieFilePath, oldestDate.Value);
}
case FileDateType.Latest:
{
var latestDate = new[] { movie.MovieMetadata.Value.InCinemas, movie.MovieMetadata.Value.PhysicalRelease, movie.MovieMetadata.Value.DigitalRelease }
.Where(d => d.HasValue).OrderBy(d => d).LastOrDefault();
if (latestDate.HasValue == false)
{
return false;
}
return ChangeFileDate(movieFilePath, latestDate.Value);
}
} }
return false; return false;

View File

@ -9674,7 +9674,10 @@
"enum": [ "enum": [
"none", "none",
"cinemas", "cinemas",
"release" "release",
"cinemasOrRelease",
"oldest",
"latest"
], ],
"type": "string" "type": "string"
}, },
@ -13302,4 +13305,4 @@
"apikey": [ ] "apikey": [ ]
} }
] ]
} }