mirror of
https://github.com/Radarr/Radarr
synced 2025-02-24 23:23:21 +00:00
New: Improved Discover recommendations
New: Movies existing in Library no longer show as a Discover Recommendations
This commit is contained in:
parent
b85f3f0e35
commit
3759625386
2 changed files with 9 additions and 10 deletions
|
@ -313,19 +313,18 @@ public Dictionary<int, List<int>> AllMovieTags()
|
|||
|
||||
public List<int> GetRecommendations()
|
||||
{
|
||||
var recommendations = new List<List<int>>();
|
||||
var tmdbIds = AllMovieTmdbIds();
|
||||
var recommendations = new List<int>();
|
||||
|
||||
using (var conn = _database.OpenConnection())
|
||||
{
|
||||
recommendations = conn.Query<List<int>>("SELECT Recommendations FROM Movies ORDER BY id DESC LIMIT 100").ToList();
|
||||
recommendations = conn.Query<int>(@"
|
||||
SELECT Rec FROM
|
||||
(SELECT CAST(j.value AS INT) AS Rec FROM Movies CROSS JOIN json_each(Movies.Recommendations) AS j
|
||||
WHERE Rec NOT IN (SELECT TmdbId FROM Movies))
|
||||
GROUP BY Rec ORDER BY count(*) DESC LIMIT 100;").ToList();
|
||||
}
|
||||
|
||||
return recommendations.SelectMany(x => x)
|
||||
.Where(r => !tmdbIds.Any(m => m == r))
|
||||
.Distinct()
|
||||
.Take(100)
|
||||
.ToList();
|
||||
return recommendations;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -286,7 +286,7 @@ public void RemoveAddOptions(Movie movie)
|
|||
public void SetFileId(Movie movie, MovieFile movieFile)
|
||||
{
|
||||
_movieRepository.SetFileId(movieFile.Id, movie.Id);
|
||||
_logger.Info("Linking [{0}] > [{1}]", movieFile.RelativePath, movie);
|
||||
_logger.Info("Assigning file [{0}] to movie [{1}]", movieFile.RelativePath, movie);
|
||||
}
|
||||
|
||||
public List<Movie> GetMoviesByFileId(int fileId)
|
||||
|
@ -386,7 +386,7 @@ public void Handle(MovieFileAddedEvent message)
|
|||
_movieRepository.Update(movie);
|
||||
|
||||
//_movieRepository.SetFileId(message.MovieFile.Id, message.MovieFile.Movie.Value.Id);
|
||||
_logger.Info("Linking [{0}] > [{1}]", message.MovieFile.RelativePath, message.MovieFile.Movie);
|
||||
_logger.Info("Assigning file [{0}] to movie [{1}]", message.MovieFile.RelativePath, message.MovieFile.Movie);
|
||||
}
|
||||
|
||||
public void Handle(MovieFileDeletedEvent message)
|
||||
|
|
Loading…
Reference in a new issue