mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-07-29 19:18:30 -07:00
fix(plex): stop the plex sync from deleting episodes when we can't find the plex key
This commit is contained in:
parent
386736fa7f
commit
66b05e5a85
1 changed files with 23 additions and 23 deletions
|
@ -496,31 +496,31 @@ namespace Ombi.Schedule.Jobs.Plex
|
||||||
await Repo.Update(existingContent);
|
await Repo.Update(existingContent);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Just check the key
|
//// Just check the key
|
||||||
if (existingKey != null)
|
//if (existingKey != null)
|
||||||
{
|
//{
|
||||||
// The rating key is all good!
|
// // The rating key is all good!
|
||||||
}
|
//}
|
||||||
else
|
//else
|
||||||
{
|
//{
|
||||||
// This means the rating key has changed somehow.
|
// // This means the rating key has changed somehow.
|
||||||
// Should probably delete this and get the new one
|
// // Should probably delete this and get the new one
|
||||||
var oldKey = existingContent.Key;
|
// var oldKey = existingContent.Key;
|
||||||
Repo.DeleteWithoutSave(existingContent);
|
// Repo.DeleteWithoutSave(existingContent);
|
||||||
|
|
||||||
// Because we have changed the rating key, we need to change all children too
|
// // Because we have changed the rating key, we need to change all children too
|
||||||
var episodeToChange = Repo.GetAllEpisodes().Cast<PlexEpisode>().Where(x => x.GrandparentKey == oldKey);
|
// var episodeToChange = Repo.GetAllEpisodes().Cast<PlexEpisode>().Where(x => x.GrandparentKey == oldKey);
|
||||||
if (episodeToChange.Any())
|
// if (episodeToChange.Any())
|
||||||
{
|
// {
|
||||||
foreach (var e in episodeToChange)
|
// foreach (var e in episodeToChange)
|
||||||
{
|
// {
|
||||||
Repo.DeleteWithoutSave(e);
|
// Repo.DeleteWithoutSave(e);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
await Repo.SaveChangesAsync();
|
// await Repo.SaveChangesAsync();
|
||||||
existingContent = null;
|
// existingContent = null;
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Also make sure it's not already being processed...
|
// Also make sure it's not already being processed...
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue