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) 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 = var movieInfo =
await _api.GetCollection(movie.Id, server.ApiKey, server.AdministratorId, server.FullUri); await _api.GetCollection(movie.Id, server.ApiKey, server.AdministratorId, server.FullUri);
@ -89,10 +89,15 @@ namespace Ombi.Schedule.Jobs.Emby
{ {
await ProcessMovies(item, mediaToAdd); await ProcessMovies(item, mediaToAdd);
} }
processed++;
}
else
{
processed++;
// Regular movie
await ProcessMovies(movie, mediaToAdd);
} }
processed++;
// Regular movie
await ProcessMovies(movie, mediaToAdd);
} }
// Get the next batch // Get the next batch
@ -163,8 +168,8 @@ namespace Ombi.Schedule.Jobs.Emby
{ {
// Check if it exists // Check if it exists
var existingMovie = await _repo.GetByEmbyId(movieInfo.Id); var existingMovie = await _repo.GetByEmbyId(movieInfo.Id);
var alreadyGoingToAdd = content.Any(x => x.EmbyId == movieInfo.Id);
if (existingMovie == null) if (existingMovie == null && !alreadyGoingToAdd)
{ {
_logger.LogDebug("Adding new movie {0}", movieInfo.Name); _logger.LogDebug("Adding new movie {0}", movieInfo.Name);
content.Add(new EmbyContent content.Add(new EmbyContent

Loading…
Cancel
Save