mirror of
https://github.com/Radarr/Radarr.git
synced 2024-08-18 08:19:38 +02:00
Cleanup MovieService
This commit is contained in:
parent
b337f62a34
commit
d5b4f0efa9
@ -23,7 +23,6 @@ public interface IMovieRepository : IBasicRepository<Movie>
|
||||
PagingSpec<Movie> MoviesWithoutFiles(PagingSpec<Movie> pagingSpec);
|
||||
List<Movie> GetMoviesByFileId(int fileId);
|
||||
List<Movie> GetMoviesByCollectionTmdbId(int collectionId);
|
||||
void SetFileId(int fileId, int movieId);
|
||||
PagingSpec<Movie> MoviesWhereCutoffUnmet(PagingSpec<Movie> pagingSpec, List<QualitiesBelowCutoff> qualitiesBelowCutoff);
|
||||
Movie FindByPath(string path);
|
||||
Dictionary<int, string> AllMoviePaths();
|
||||
@ -226,11 +225,6 @@ public List<Movie> GetMoviesByCollectionTmdbId(int collectionId)
|
||||
return Query(x => x.MovieMetadata.Value.CollectionTmdbId == collectionId);
|
||||
}
|
||||
|
||||
public void SetFileId(int fileId, int movieId)
|
||||
{
|
||||
SetFields(new Movie { Id = movieId, MovieFileId = fileId }, movie => movie.MovieFileId);
|
||||
}
|
||||
|
||||
public List<Movie> MoviesBetweenDates(DateTime start, DateTime end, bool includeUnmonitored)
|
||||
{
|
||||
var builder = Builder()
|
||||
|
@ -23,7 +23,6 @@ public interface IMovieService
|
||||
List<Movie> AddMovies(List<Movie> newMovies);
|
||||
Movie FindByImdbId(string imdbid);
|
||||
Movie FindByTmdbId(int tmdbid);
|
||||
List<Movie> FindByTmdbId(List<int> tmdbids);
|
||||
Movie FindByTitle(string title);
|
||||
Movie FindByTitle(string title, int year);
|
||||
Movie FindByTitle(List<string> titles, int? year, List<string> otherTitles, List<Movie> candidates);
|
||||
@ -36,14 +35,12 @@ public interface IMovieService
|
||||
List<Movie> GetMoviesByCollectionTmdbId(int collectionId);
|
||||
List<Movie> GetMoviesBetweenDates(DateTime start, DateTime end, bool includeUnmonitored);
|
||||
PagingSpec<Movie> MoviesWithoutFiles(PagingSpec<Movie> pagingSpec);
|
||||
void SetFileId(Movie movie, MovieFile movieFile);
|
||||
void DeleteMovie(int movieId, bool deleteFiles, bool addExclusion = false);
|
||||
void DeleteMovies(List<int> movieIds, bool deleteFiles, bool addExclusion = false);
|
||||
List<Movie> GetAllMovies();
|
||||
Dictionary<int, List<int>> AllMovieTags();
|
||||
Movie UpdateMovie(Movie movie);
|
||||
List<Movie> UpdateMovie(List<Movie> movie, bool useExistingRelativeFolder);
|
||||
List<Movie> FilterExistingMovies(List<Movie> movies);
|
||||
List<int> GetRecommendedTmdbIds();
|
||||
bool MoviePathExists(string folder);
|
||||
void RemoveAddOptions(Movie movie);
|
||||
@ -192,11 +189,6 @@ public Movie FindByTmdbId(int tmdbid)
|
||||
return _movieRepository.FindByTmdbId(tmdbid);
|
||||
}
|
||||
|
||||
public List<Movie> FindByTmdbId(List<int> tmdbids)
|
||||
{
|
||||
return _movieRepository.FindByTmdbId(tmdbids);
|
||||
}
|
||||
|
||||
public Movie FindByPath(string path)
|
||||
{
|
||||
return _movieRepository.FindByPath(path);
|
||||
@ -290,12 +282,6 @@ public void RemoveAddOptions(Movie movie)
|
||||
_movieRepository.SetFields(movie, s => s.AddOptions);
|
||||
}
|
||||
|
||||
public void SetFileId(Movie movie, MovieFile movieFile)
|
||||
{
|
||||
_movieRepository.SetFileId(movieFile.Id, movie.Id);
|
||||
_logger.Info("Assigning file [{0}] to movie [{1}]", movieFile.RelativePath, movie);
|
||||
}
|
||||
|
||||
public List<Movie> GetMoviesByFileId(int fileId)
|
||||
{
|
||||
return _movieRepository.GetMoviesByFileId(fileId);
|
||||
@ -365,22 +351,6 @@ public bool MovieExists(Movie movie)
|
||||
return false;
|
||||
}
|
||||
|
||||
public List<Movie> FilterExistingMovies(List<Movie> movies)
|
||||
{
|
||||
var allMovies = GetAllMovies();
|
||||
|
||||
var withTmdbid = movies.Where(m => m.TmdbId != 0).ToList();
|
||||
var withoutTmdbid = movies.Where(m => m.TmdbId == 0).ToList();
|
||||
var withImdbid = withoutTmdbid.Where(m => m.ImdbId.IsNotNullOrWhiteSpace());
|
||||
var rest = withoutTmdbid.Where(m => m.ImdbId.IsNullOrWhiteSpace());
|
||||
|
||||
var ret = withTmdbid.ExceptBy(m => m.TmdbId, allMovies, m => m.TmdbId, EqualityComparer<int>.Default)
|
||||
.Union(withImdbid.ExceptBy(m => m.ImdbId, allMovies, m => m.ImdbId, EqualityComparer<string>.Default))
|
||||
.Union(rest.ExceptBy(m => m.Title.CleanMovieTitle(), allMovies, m => m.MovieMetadata.Value.CleanTitle, EqualityComparer<string>.Default)).ToList();
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
public List<int> GetRecommendedTmdbIds()
|
||||
{
|
||||
return _movieRepository.GetRecommendations();
|
||||
|
Loading…
Reference in New Issue
Block a user