From 7e4de5cbd7b0024248fe67e963b2272e893a3017 Mon Sep 17 00:00:00 2001 From: tidusjar Date: Thu, 26 Oct 2017 22:00:45 +0100 Subject: [PATCH] Fixed the issue where we have got an episode but not the related series. #1620 --- src/Ombi.Schedule/Jobs/Emby/EmbyEpisodeCacher.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/Ombi.Schedule/Jobs/Emby/EmbyEpisodeCacher.cs b/src/Ombi.Schedule/Jobs/Emby/EmbyEpisodeCacher.cs index d6e8878aa..792ab6752 100644 --- a/src/Ombi.Schedule/Jobs/Emby/EmbyEpisodeCacher.cs +++ b/src/Ombi.Schedule/Jobs/Emby/EmbyEpisodeCacher.cs @@ -89,6 +89,15 @@ namespace Ombi.Schedule.Jobs.Emby continue; } + // Let's make sure we have the parent request, stop those pesky forign key errors, + // Damn me having data integrity + var parent = await _repo.GetByEmbyId(epInfo.SeriesId); + if (parent == null) + { + _logger.LogInformation("The episode {0} does not relate to a series, so we cannot save this", ep.Name); + continue; + } + var existingEpisode = await _repo.GetByEmbyId(ep.Id); if (existingEpisode == null) {