Another attempt to fix #2366

pull/2383/head
Jamie Rees 6 years ago
parent 35453754a0
commit c14f603705

@ -81,7 +81,7 @@ namespace Ombi.Schedule.Jobs.Emby
{
foreach (var movie in movies.Items)
{
if (movie.Type.Equals("boxset", StringComparison.CurrentCultureIgnoreCase) && mediaToAdd.All(x => x.EmbyId != movie.Id))
if (movie.Type.Equals("boxset", StringComparison.InvariantCultureIgnoreCase))
{
var movieInfo =
await _api.GetCollection(movie.Id, server.ApiKey, server.AdministratorId, server.FullUri);
@ -89,11 +89,16 @@ namespace Ombi.Schedule.Jobs.Emby
{
await ProcessMovies(item, mediaToAdd);
}
processed++;
}
else
{
processed++;
// Regular movie
await ProcessMovies(movie, mediaToAdd);
}
}
// Get the next batch
movies = await _api.GetAllMovies(server.ApiKey, processed, 200, server.AdministratorId, server.FullUri);
@ -163,8 +168,8 @@ namespace Ombi.Schedule.Jobs.Emby
{
// Check if it exists
var existingMovie = await _repo.GetByEmbyId(movieInfo.Id);
if (existingMovie == null)
var alreadyGoingToAdd = content.Any(x => x.EmbyId == movieInfo.Id);
if (existingMovie == null && !alreadyGoingToAdd)
{
_logger.LogDebug("Adding new movie {0}", movieInfo.Name);
content.Add(new EmbyContent

Loading…
Cancel
Save