diff --git a/PlexRequests.Api/CouchPotatoApi.cs b/PlexRequests.Api/CouchPotatoApi.cs index dd5f85d83..ae395115f 100644 --- a/PlexRequests.Api/CouchPotatoApi.cs +++ b/PlexRequests.Api/CouchPotatoApi.cs @@ -49,8 +49,8 @@ namespace PlexRequests.Api public bool AddMovie(string imdbid, string apiKey, string title, Uri baseUrl, string profileId = default(string)) { RestRequest request; - request = string.IsNullOrEmpty(profileId) - ? new RestRequest {Resource = "/api/{apikey}/movie.add?title={title}&identifier={imdbid}"} + request = string.IsNullOrEmpty(profileId) + ? new RestRequest { Resource = "/api/{apikey}/movie.add?title={title}&identifier={imdbid}" } : new RestRequest { Resource = "/api/{apikey}/movie.add?title={title}&identifier={imdbid}&profile_id={profileId}" }; if (!string.IsNullOrEmpty(profileId)) @@ -62,11 +62,11 @@ namespace PlexRequests.Api request.AddUrlSegment("imdbid", imdbid); request.AddUrlSegment("title", title); - var obj = RetryHandler.Execute(() => Api.ExecuteJson (request, baseUrl),new[] { - TimeSpan.FromSeconds (2), - TimeSpan.FromSeconds(5), - TimeSpan.FromSeconds(10)}, - (exception, timespan) => Log.Error (exception, "Exception when calling AddMovie for CP, Retrying {0}", timespan)); + var obj = RetryHandler.Execute(() => Api.ExecuteJson(request, baseUrl), new[] { + TimeSpan.FromSeconds (2), + TimeSpan.FromSeconds(5), + TimeSpan.FromSeconds(10)}, + (exception, timespan) => Log.Error(exception, "Exception when calling AddMovie for CP, Retrying {0}", timespan)); Log.Trace("CP movie Add result count {0}", obj.Count); @@ -106,18 +106,17 @@ namespace PlexRequests.Api request.AddUrlSegment("apikey", apiKey); - var obj = RetryHandler.Execute(() => Api.Execute (request, url),new TimeSpan[] { - TimeSpan.FromSeconds (2), - TimeSpan.FromSeconds(5), - TimeSpan.FromSeconds(10)}, - (exception, timespan) => Log.Error (exception, "Exception when calling GetStatus for CP, Retrying {0}", timespan)); - - return obj; + var obj = RetryHandler.Execute(() => Api.Execute(request, url), new TimeSpan[] { + TimeSpan.FromSeconds (2), + TimeSpan.FromSeconds(5), + TimeSpan.FromSeconds(10)}, + (exception, timespan) => Log.Error(exception, "Exception when calling GetStatus for CP, Retrying {0}", timespan)); + + return obj; } public CouchPotatoProfiles GetProfiles(Uri url, string apiKey) { - Log.Trace("Getting CP Profiles, ApiKey = {0}", apiKey); var request = new RestRequest { Resource = "api/{apikey}/profile.list/", @@ -126,10 +125,10 @@ namespace PlexRequests.Api request.AddUrlSegment("apikey", apiKey); - var obj = RetryHandler.Execute(() => Api.Execute (request, url),null, - (exception, timespan) => Log.Error (exception, "Exception when calling GetProfiles for CP, Retrying {0}", timespan)); - - return obj; + var obj = RetryHandler.Execute(() => Api.Execute(request, url), null, + (exception, timespan) => Log.Error(exception, "Exception when calling GetProfiles for CP, Retrying {0}", timespan)); + + return obj; } public CouchPotatoMovies GetMovies(Uri baseUrl, string apiKey, string[] status) @@ -147,21 +146,21 @@ namespace PlexRequests.Api request.AddUrlSegment("status", string.Join(",", status)); try { - var obj = RetryHandler.Execute(() => Api.Execute (request, baseUrl), - new[] { - TimeSpan.FromSeconds (5), - TimeSpan.FromSeconds(10), - TimeSpan.FromSeconds(30) - }, - (exception, timespan) => Log.Error (exception, "Exception when calling GetMovies for CP, Retrying {0}", timespan)); - - return obj; + var obj = RetryHandler.Execute(() => Api.Execute(request, baseUrl), + new[] { + TimeSpan.FromSeconds (5), + TimeSpan.FromSeconds(10), + TimeSpan.FromSeconds(30) + }, + (exception, timespan) => Log.Error(exception, "Exception when calling GetMovies for CP, Retrying {0}", timespan)); + + return obj; } - catch (Exception e) // Request error is already logged in the ApiRequest class + catch (Exception e) // Request error is already logged in the ApiRequest class { Log.Error("Error when attempting to GetMovies."); - Log.Error (e); - return new CouchPotatoMovies(); + Log.Error(e); + return new CouchPotatoMovies(); } } } diff --git a/PlexRequests.Api/PlexRequests.Api.csproj b/PlexRequests.Api/PlexRequests.Api.csproj index 9e24aebdd..e22fba7cb 100644 --- a/PlexRequests.Api/PlexRequests.Api.csproj +++ b/PlexRequests.Api/PlexRequests.Api.csproj @@ -1,124 +1,125 @@ - - - - - Debug - AnyCPU - {8CB8D235-2674-442D-9C6A-35FCAEEB160D} - Library - Properties - PlexRequests.Api - PlexRequests.Api - v4.5 - 512 - - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - ..\packages\NLog.4.3.4\lib\net45\NLog.dll - True - - - ..\packages\RestSharp.105.2.3\lib\net45\RestSharp.dll - True - - - - - - - - - - - ..\packages\Dapper.1.42\lib\net45\Dapper.dll - - - ..\packages\Nancy.1.4.3\lib\net40\Nancy.dll - - - ..\packages\Newtonsoft.Json.8.0.2\lib\net45\Newtonsoft.Json.dll - - - ..\packages\TMDbLib.0.9.0.0-alpha\lib\net45\TMDbLib.dll - - - ..\packages\Polly-Signed.4.2.0\lib\net45\Polly.dll - - - - - - - True - True - MockApiData.resx - - - - - - - - - - - - - - - - - - - - - - - - - - {95834072-A675-415D-AA8F-877C91623810} - PlexRequests.Api.Interfaces - - - {CB37A5F8-6DFC-4554-99D3-A42B502E4591} - PlexRequests.Api.Models - - - {1252336D-42A3-482A-804C-836E60173DFA} - PlexRequests.Helpers - - - - - ResXFileCodeGenerator - MockApiData.Designer.cs - - - - + + + + + Debug + AnyCPU + {8CB8D235-2674-442D-9C6A-35FCAEEB160D} + Library + Properties + PlexRequests.Api + PlexRequests.Api + v4.5 + 512 + + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + ..\packages\NLog.4.3.4\lib\net45\NLog.dll + True + + + ..\packages\Polly-Signed.4.3.0\lib\net45\Polly.dll + True + + + ..\packages\RestSharp.105.2.3\lib\net45\RestSharp.dll + True + + + + + + + + + + + ..\packages\Dapper.1.42\lib\net45\Dapper.dll + + + ..\packages\Nancy.1.4.3\lib\net40\Nancy.dll + + + ..\packages\Newtonsoft.Json.8.0.2\lib\net45\Newtonsoft.Json.dll + + + ..\packages\TMDbLib.0.9.0.0-alpha\lib\net45\TMDbLib.dll + + + + + + + True + True + MockApiData.resx + + + + + + + + + + + + + + + + + + + + + + + + + + {95834072-A675-415D-AA8F-877C91623810} + PlexRequests.Api.Interfaces + + + {CB37A5F8-6DFC-4554-99D3-A42B502E4591} + PlexRequests.Api.Models + + + {1252336D-42A3-482A-804C-836E60173DFA} + PlexRequests.Helpers + + + + + ResXFileCodeGenerator + MockApiData.Designer.cs + + + + \ No newline at end of file diff --git a/PlexRequests.Api/app.config b/PlexRequests.Api/app.config index 44b249bff..afa1b4c43 100644 --- a/PlexRequests.Api/app.config +++ b/PlexRequests.Api/app.config @@ -1,11 +1,11 @@ - - - - - - - - - - - + + + + + + + + + + + diff --git a/PlexRequests.Api/packages.config b/PlexRequests.Api/packages.config index e7e63c904..9e3f12006 100644 --- a/PlexRequests.Api/packages.config +++ b/PlexRequests.Api/packages.config @@ -4,7 +4,7 @@ - + \ No newline at end of file diff --git a/PlexRequests.Updater/PlexRequests.Updater.csproj b/PlexRequests.Updater/PlexRequests.Updater.csproj index 86de4fd4a..194cbd128 100644 --- a/PlexRequests.Updater/PlexRequests.Updater.csproj +++ b/PlexRequests.Updater/PlexRequests.Updater.csproj @@ -28,6 +28,10 @@ true + + ..\packages\Polly-Signed.4.3.0\lib\net45\Polly.dll + True + diff --git a/PlexRequests.Updater/packages.config b/PlexRequests.Updater/packages.config index 4d4f826f4..4a06c0f59 100644 --- a/PlexRequests.Updater/packages.config +++ b/PlexRequests.Updater/packages.config @@ -1,4 +1,4 @@  - + \ No newline at end of file