From 141f96da5e45d5b3fa5f496806b102e473da6607 Mon Sep 17 00:00:00 2001 From: sephrat <34862846+sephrat@users.noreply.github.com> Date: Thu, 13 Apr 2023 19:01:07 +0200 Subject: [PATCH] fix: Support duplicates in Emby/JF collections (#4902) Support same movie that belongs in different collections in Emby or Jellyfin --- src/Ombi.Schedule/Jobs/Emby/EmbyContentSync.cs | 7 ++++++- src/Ombi.Schedule/Jobs/Jellyfin/JellyfinContentSync.cs | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/Ombi.Schedule/Jobs/Emby/EmbyContentSync.cs b/src/Ombi.Schedule/Jobs/Emby/EmbyContentSync.cs index 35cc66be4..443c1c3da 100644 --- a/src/Ombi.Schedule/Jobs/Emby/EmbyContentSync.cs +++ b/src/Ombi.Schedule/Jobs/Emby/EmbyContentSync.cs @@ -263,7 +263,12 @@ namespace Ombi.Schedule.Jobs.Emby // Check if it exists var existingMovie = await _repo.GetByEmbyId(movieInfo.Id); var alreadyGoingToAdd = content.Any(x => x.EmbyId == movieInfo.Id); - if (existingMovie == null && !alreadyGoingToAdd) + if (alreadyGoingToAdd) + { + _logger.LogDebug($"Detected duplicate for {movieInfo.Name}"); + return; + } + if (existingMovie == null) { if (!movieInfo.ProviderIds.Any()) { diff --git a/src/Ombi.Schedule/Jobs/Jellyfin/JellyfinContentSync.cs b/src/Ombi.Schedule/Jobs/Jellyfin/JellyfinContentSync.cs index 58dacaed5..3eab17a35 100644 --- a/src/Ombi.Schedule/Jobs/Jellyfin/JellyfinContentSync.cs +++ b/src/Ombi.Schedule/Jobs/Jellyfin/JellyfinContentSync.cs @@ -228,7 +228,12 @@ namespace Ombi.Schedule.Jobs.Jellyfin // Check if it exists var existingMovie = await _repo.GetByJellyfinId(movieInfo.Id); var alreadyGoingToAdd = content.Any(x => x.JellyfinId == movieInfo.Id); - if (existingMovie == null && !alreadyGoingToAdd) + if (alreadyGoingToAdd) + { + _logger.LogDebug($"Detected duplicate for {movieInfo.Name}"); + return; + } + if (existingMovie == null) { if (!movieInfo.ProviderIds.Any()) {