Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New: Provide more Options to choose File Date from #9499

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 18 additions & 0 deletions frontend/src/Settings/MediaManagement/MediaManagement.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,24 @@ const fileDateOptions = [
get value() {
return translate('PhysicalReleaseDate');
}
},
{
key: 'cinemasOrRelease',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't this essentially be the same as oldest in most cases? I'm struggling to see the need for all three of these. I could be missing something obvious though.

Copy link
Author

@mrpimpky mrpimpky Jan 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It could be, but in rare circumstances, the release could be digital-first (or physical), and someone would like to prioritize the cinema release date. But if you want, I can remove this entry. Should I?

Copy link
Author

@mrpimpky mrpimpky Jan 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One example is "The Irishman", released first on Netflix but later in selected cinemas.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Qstick Is there anything left I can do for you? Or are these changes ready for approval?

get value() {
return translate('InCinemasOrPhysicalReleaseDate');
}
},
{
key: 'oldest',
get value() {
return translate('OldestDate');
}
},
{
key: 'latest',
get value() {
return translate('LatestDate');
}
}
];

Expand Down
3 changes: 3 additions & 0 deletions src/NzbDrone.Core/Localization/Core/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -516,6 +516,7 @@
"Importing": "Importing",
"InCinemas": "In Cinemas",
"InCinemasDate": "In Cinemas Date",
"InCinemasOrPhysicalReleaseDate": "In Cinemas or Physical Release Date",
"InCinemasMsg": "Movie is in Cinemas",
"IncludeCustomFormatWhenRenaming": "Include Custom Format when Renaming",
"IncludeCustomFormatWhenRenamingHelpText": "Include in {Custom Formats} renaming format",
Expand Down Expand Up @@ -572,6 +573,7 @@
"LastExecution": "Last Execution",
"LastUsed": "Last Used",
"LastWriteTime": "Last Write Time",
"LatestDate": "Latest Date",
"LaunchBrowserHelpText": " Open a web browser and navigate to the {appName} homepage on app start.",
"Letterboxd": "Letterboxd",
"Level": "Level",
Expand Down Expand Up @@ -769,6 +771,7 @@
"NotificationTriggersHelpText": "Select which events should trigger this notification",
"OAuthPopupMessage": "Pop-ups are being blocked by your browser",
"Ok": "Ok",
"OldestDate": "Oldest Date",
"OnApplicationUpdate": "On Application Update",
"OnApplicationUpdateHelpText": "On Application Update",
"OnDownloadHelpText": "On Import",
Expand Down
7 changes: 5 additions & 2 deletions src/NzbDrone.Core/MediaFiles/FileDateType.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
namespace NzbDrone.Core.MediaFiles
namespace NzbDrone.Core.MediaFiles
{
public enum FileDateType
{
None = 0,
Cinemas = 1,
Release = 2
Release = 2,
CinemasOrRelease = 3,
Oldest = 4,
Latest = 5
}
}
38 changes: 38 additions & 0 deletions src/NzbDrone.Core/MediaFiles/UpdateMovieFileService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,44 @@ private bool ChangeFileDate(MovieFile movieFile, Movie movie)

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;
Expand Down
7 changes: 5 additions & 2 deletions src/Radarr.Api.V3/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -9674,7 +9674,10 @@
"enum": [
"none",
"cinemas",
"release"
"release",
"cinemasOrRelease",
"oldest",
"latest"
],
"type": "string"
},
Expand Down Expand Up @@ -13302,4 +13305,4 @@
"apikey": [ ]
}
]
}
}