mirror of
https://github.com/Radarr/Radarr
synced 2026-01-25 00:41:50 +01:00
Merge c7a46fbf51 into 89110c2cc8
This commit is contained in:
commit
9ad1d91edd
6 changed files with 44 additions and 1 deletions
|
|
@ -93,6 +93,18 @@ const fileDateOptions: EnhancedSelectInputValue<string>[] = [
|
|||
return translate('PhysicalReleaseDate');
|
||||
},
|
||||
},
|
||||
{
|
||||
key: 'first',
|
||||
get value() {
|
||||
return translate('FirstImportedDate');
|
||||
},
|
||||
},
|
||||
{
|
||||
key: 'tracked',
|
||||
get value() {
|
||||
return translate('TrackedDate');
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
function MediaManagement() {
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ public interface IHistoryRepository : IBasicRepository<MovieHistory>
|
|||
List<MovieHistory> FindDownloadHistory(int movieId, QualityModel quality);
|
||||
List<MovieHistory> GetByMovieId(int movieId, MovieHistoryEventType? eventType);
|
||||
void DeleteForMovies(List<int> movieIds);
|
||||
MovieHistory FirstForMovie(int movieId);
|
||||
MovieHistory MostRecentForMovie(int movieId);
|
||||
List<MovieHistory> Since(DateTime date, MovieHistoryEventType? eventType);
|
||||
PagingSpec<MovieHistory> GetPaged(PagingSpec<MovieHistory> pagingSpec, int[] languages, int[] qualities);
|
||||
|
|
@ -75,6 +76,11 @@ public void DeleteForMovies(List<int> movieIds)
|
|||
Delete(c => movieIds.Contains(c.MovieId));
|
||||
}
|
||||
|
||||
public MovieHistory FirstForMovie(int movieId)
|
||||
{
|
||||
return Query(x => x.MovieId == movieId).MinBy(h => h.Date);
|
||||
}
|
||||
|
||||
public MovieHistory MostRecentForMovie(int movieId)
|
||||
{
|
||||
return Query(x => x.MovieId == movieId).MaxBy(h => h.Date);
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ public interface IHistoryService
|
|||
{
|
||||
QualityModel GetBestQualityInHistory(QualityProfile profile, int movieId);
|
||||
PagingSpec<MovieHistory> Paged(PagingSpec<MovieHistory> pagingSpec, int[] languages, int[] qualities);
|
||||
MovieHistory FirstForMovie(int movieId);
|
||||
MovieHistory MostRecentForMovie(int movieId);
|
||||
MovieHistory MostRecentForDownloadId(string downloadId);
|
||||
MovieHistory Get(int historyId);
|
||||
|
|
@ -54,6 +55,11 @@ public PagingSpec<MovieHistory> Paged(PagingSpec<MovieHistory> pagingSpec, int[]
|
|||
return _historyRepository.GetPaged(pagingSpec, languages, qualities);
|
||||
}
|
||||
|
||||
public MovieHistory FirstForMovie(int movieId)
|
||||
{
|
||||
return _historyRepository.FirstForMovie(movieId);
|
||||
}
|
||||
|
||||
public MovieHistory MostRecentForMovie(int movieId)
|
||||
{
|
||||
return _historyRepository.MostRecentForMovie(movieId);
|
||||
|
|
|
|||
|
|
@ -700,6 +700,7 @@
|
|||
"Filters": "Filters",
|
||||
"FilterMoviePropertiesOnlyNotFileWarning": "Filters are available only for the properties of a movie, they are not available for properties of the file(s) you may have for that movie.",
|
||||
"FirstDayOfWeek": "First Day of Week",
|
||||
"FirstImportedDate": "First Imported Date",
|
||||
"Fixed": "Fixed",
|
||||
"Folder": "Folder",
|
||||
"FolderNameTokens": "Folder Name Tokens",
|
||||
|
|
@ -1932,6 +1933,7 @@
|
|||
"TotalSpace": "Total Space",
|
||||
"Trace": "Trace",
|
||||
"Trailer": "Trailer",
|
||||
"TrackedDate": "Tracked Date",
|
||||
"Trakt": "Trakt",
|
||||
"TraktRating": "Trakt Rating",
|
||||
"TraktVotes": "Trakt Votes",
|
||||
|
|
|
|||
|
|
@ -4,6 +4,8 @@ public enum FileDateType
|
|||
{
|
||||
None = 0,
|
||||
Cinemas = 1,
|
||||
Release = 2
|
||||
Release = 2,
|
||||
First = 3,
|
||||
Tracked = 4
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
using NzbDrone.Common.Disk;
|
||||
using NzbDrone.Common.Instrumentation.Extensions;
|
||||
using NzbDrone.Core.Configuration;
|
||||
using NzbDrone.Core.History;
|
||||
using NzbDrone.Core.MediaFiles.Events;
|
||||
using NzbDrone.Core.Messaging.Events;
|
||||
using NzbDrone.Core.Movies;
|
||||
|
|
@ -23,16 +24,19 @@ public class UpdateMovieFileService : IUpdateMovieFileService,
|
|||
private readonly IDiskProvider _diskProvider;
|
||||
private readonly IConfigService _configService;
|
||||
private readonly IMediaFileService _mediaFileService;
|
||||
private readonly IHistoryService _historyService;
|
||||
private readonly Logger _logger;
|
||||
|
||||
public UpdateMovieFileService(IDiskProvider diskProvider,
|
||||
IConfigService configService,
|
||||
IMediaFileService mediaFileService,
|
||||
IHistoryService historyService,
|
||||
Logger logger)
|
||||
{
|
||||
_diskProvider = diskProvider;
|
||||
_configService = configService;
|
||||
_mediaFileService = mediaFileService;
|
||||
_historyService = historyService;
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
|
|
@ -70,6 +74,17 @@ private bool ChangeFileDate(MovieFile movieFile, Movie movie)
|
|||
|
||||
return ChangeFileDate(movieFilePath, airDate.Value);
|
||||
}
|
||||
|
||||
case FileDateType.First:
|
||||
{
|
||||
var firstMovieHistory = _historyService.FirstForMovie(movie.Id);
|
||||
return ChangeFileDate(movieFilePath, firstMovieHistory.Date);
|
||||
}
|
||||
|
||||
case FileDateType.Tracked:
|
||||
{
|
||||
return ChangeFileDate(movieFilePath, movie.Added);
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
|
|
|
|||
Loading…
Reference in a new issue