New: Improved Discover recommendations

New: Movies existing in Library no longer show as a Discover Recommendations
pull/5371/head
bakerboy448 4 years ago committed by Qstick
parent b85f3f0e35
commit 3759625386

@ -313,19 +313,18 @@ namespace NzbDrone.Core.Movies
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 @@ namespace NzbDrone.Core.Movies
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 @@ namespace NzbDrone.Core.Movies
_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…
Cancel
Save