diff --git a/Ombi.Services/Jobs/EmbyContentCacher.cs b/Ombi.Services/Jobs/EmbyContentCacher.cs index a3eacab65..ce8acdc0e 100644 --- a/Ombi.Services/Jobs/EmbyContentCacher.cs +++ b/Ombi.Services/Jobs/EmbyContentCacher.cs @@ -115,7 +115,7 @@ namespace Ombi.Services.Jobs foreach (var item in info.Items) { var movieInfo = EmbyApi.GetInformation(item.Id, EmbyMediaType.Movie, embySettings.ApiKey, - embySettings.AdministratorId, embySettings.FullUri).MovieInformation; + embySettings.AdministratorId, embySettings.FullUri).MovieInformation; ProcessMovies(movieInfo); } } @@ -149,6 +149,12 @@ namespace Ombi.Services.Jobs connection.Dispose(); return media; }); + if (item != null && item.EmbyId != t.Id) + { + // delete this item since the Id has changed + EmbyContent.Delete(item); + item = null; + } if (item == null) { @@ -255,6 +261,13 @@ namespace Ombi.Services.Jobs return media; }); + if (item != null && item.EmbyId != movieInfo.Id) + { + // delete this item since the Id has changed + EmbyContent.Delete(item); + item = null; + } + if (item == null) { // Doesn't exist, insert it diff --git a/Ombi.Services/Jobs/EmbyEpisodeCacher.cs b/Ombi.Services/Jobs/EmbyEpisodeCacher.cs index 387a7dc98..ce313b965 100644 --- a/Ombi.Services/Jobs/EmbyEpisodeCacher.cs +++ b/Ombi.Services/Jobs/EmbyEpisodeCacher.cs @@ -81,6 +81,7 @@ namespace Ombi.Services.Jobs continue; } + // Check it this episode exists var item = Repo.Custom(connection => { @@ -93,6 +94,15 @@ namespace Ombi.Services.Jobs return media; }); + if (item != null) + { + if (item.EmbyId != ep.Id) // The id's dont match, delete it + { + Repo.Delete(item); + item = null; + } + } + if (item == null) { // add it