From f60e880da5ee906c5fc4da391a8f934b8c84e087 Mon Sep 17 00:00:00 2001 From: tidusjar Date: Fri, 5 Aug 2016 12:53:06 +0100 Subject: [PATCH] Need to work out why the cacher is not working and where the datatype mismatch is --- PlexRequests.Api/PlexApi.cs | 10 +++++----- PlexRequests.Services/Jobs/PlexEpisodeCacher.cs | 6 ++---- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/PlexRequests.Api/PlexApi.cs b/PlexRequests.Api/PlexApi.cs index 19c8b59b9..91df2ce11 100644 --- a/PlexRequests.Api/PlexApi.cs +++ b/PlexRequests.Api/PlexApi.cs @@ -119,7 +119,7 @@ namespace PlexRequests.Api request.AddUrlSegment("searchTerm", searchTerm); AddHeaders(ref request, authToken); - var search = RetryHandler.Execute(() => Api.ExecuteXml (request, plexFullHost), + var search = RetryHandler.Execute(() => Api.ExecuteXml (request, plexFullHost), (exception, timespan) => Log.Error (exception, "Exception when calling SearchContent for Plex, Retrying {0}", timespan), null); return search; @@ -134,7 +134,7 @@ namespace PlexRequests.Api AddHeaders(ref request, authToken); - var users = RetryHandler.Execute(() => Api.ExecuteXml (request, uri), + var users = RetryHandler.Execute(() => Api.ExecuteXml (request, uri), (exception, timespan) => Log.Error (exception, "Exception when calling GetStatus for Plex, Retrying {0}", timespan), null); return users; @@ -149,7 +149,7 @@ namespace PlexRequests.Api AddHeaders(ref request, authToken); - var account = RetryHandler.Execute(() => Api.ExecuteXml (request, new Uri(GetAccountUri)), + var account = RetryHandler.Execute(() => Api.ExecuteXml (request, new Uri(GetAccountUri)), (exception, timespan) => Log.Error (exception, "Exception when calling GetAccount for Plex, Retrying {0}", timespan), null); return account; @@ -308,8 +308,8 @@ namespace PlexRequests.Api private void AddHeaders(ref RestRequest request) { - request.AddHeader("X-Plex-Client-Identifier", "Test213"); - request.AddHeader("X-Plex-Product", "Request Plex"); + request.AddHeader("X-Plex-Client-Identifier", $"PlexRequests.Net{Version}"); + request.AddHeader("X-Plex-Product", "Plex Requests .Net"); request.AddHeader("X-Plex-Version", Version); request.AddHeader("Content-Type", "application/xml"); } diff --git a/PlexRequests.Services/Jobs/PlexEpisodeCacher.cs b/PlexRequests.Services/Jobs/PlexEpisodeCacher.cs index f31fcb9f0..31ce4de6b 100644 --- a/PlexRequests.Services/Jobs/PlexEpisodeCacher.cs +++ b/PlexRequests.Services/Jobs/PlexEpisodeCacher.cs @@ -127,10 +127,8 @@ namespace PlexRequests.Services.Jobs } // Delete all of the current items - //Repo.DeleteAll(TableName); - - Log.Debug("Inserting The following (1st item)"); - Log.Debug(entities.FirstOrDefault().DumpJson()); + Repo.DeleteAll(TableName); + // TODO Fix the datatype mismatch... // Insert the new items var result = Repo.BatchInsert(entities, TableName, typeof(PlexEpisodes).GetPropertyNames());