From 706fc94eb3fa01330314713f1a143a1eda43254e Mon Sep 17 00:00:00 2001 From: "Jamie.Rees" Date: Fri, 10 Mar 2017 12:12:37 +0000 Subject: [PATCH] #1102 --- Ombi.Services/Jobs/EmbyContentCacher.cs | 16 ++++++++-- Ombi.Services/Jobs/PlexContentCacher.cs | 42 ++++++++++++------------- 2 files changed, 35 insertions(+), 23 deletions(-) diff --git a/Ombi.Services/Jobs/EmbyContentCacher.cs b/Ombi.Services/Jobs/EmbyContentCacher.cs index ce8acdc0e..8e1011aec 100644 --- a/Ombi.Services/Jobs/EmbyContentCacher.cs +++ b/Ombi.Services/Jobs/EmbyContentCacher.cs @@ -105,7 +105,13 @@ namespace Ombi.Services.Jobs try { var movies = GetMovies(); - + // Delete everything + EmbyContent.Custom(connection => + { + connection.Open(); + connection.Query("delete from EmbyContent where type = @type", new { type = 0 }); + return new List(); + }); foreach (var m in movies) { if (m.Type.Equals("boxset", StringComparison.CurrentCultureIgnoreCase)) @@ -129,7 +135,13 @@ namespace Ombi.Services.Jobs } var tv = GetTvShows(); - + // Delete everything + EmbyContent.Custom(connection => + { + connection.Open(); + connection.Query("delete from EmbyContent where type = @type", new { type = 1 }); + return new List(); + }); foreach (var t in tv) { var tvInfo = EmbyApi.GetInformation(t.Id, EmbyMediaType.Series, embySettings.ApiKey, diff --git a/Ombi.Services/Jobs/PlexContentCacher.cs b/Ombi.Services/Jobs/PlexContentCacher.cs index f370b7b36..6878c3367 100644 --- a/Ombi.Services/Jobs/PlexContentCacher.cs +++ b/Ombi.Services/Jobs/PlexContentCacher.cs @@ -239,13 +239,13 @@ namespace Ombi.Services.Jobs var movies = GetPlexMovies(results); - //// Time to destroy the plex movies from the DB - //PlexContent.Custom(connection => - //{ - // connection.Open(); - // connection.Query("delete from PlexContent where type = @type", new { type = 0 }); - // return new List(); - //}); + // Time to destroy the plex movies from the DB + PlexContent.Custom(connection => + { + connection.Open(); + connection.Query("delete from PlexContent where type = @type", new { type = 0 }); + return new List(); + }); foreach (var m in movies) { @@ -280,13 +280,13 @@ namespace Ombi.Services.Jobs } var tv = GetPlexTvShows(results); - //// Time to destroy the plex tv from the DB - //PlexContent.Custom(connection => - //{ - // connection.Open(); - // connection.Query("delete from PlexContent where type = @type", new { type = 1 }); - // return new List(); - //}); + // Time to destroy the plex tv from the DB + PlexContent.Custom(connection => + { + connection.Open(); + connection.Query("delete from PlexContent where type = @type", new { type = 1 }); + return new List(); + }); foreach (var t in tv) { if (string.IsNullOrEmpty(t.ProviderId)) @@ -321,13 +321,13 @@ namespace Ombi.Services.Jobs } var albums = GetPlexAlbums(results); - //// Time to destroy the plex movies from the DB - //PlexContent.Custom(connection => - //{ - // connection.Open(); - // connection.Query("delete from PlexContent where type = @type", new { type = 2 }); - // return new List(); - //}); + // Time to destroy the plex movies from the DB + PlexContent.Custom(connection => + { + connection.Open(); + connection.Query("delete from PlexContent where type = @type", new { type = 2 }); + return new List(); + }); foreach (var a in albums) {