From 2d0297231db87ba669fb3c5e2d89d0e33af63b52 Mon Sep 17 00:00:00 2001 From: tidusjar Date: Fri, 17 Mar 2017 20:58:53 +0000 Subject: [PATCH] Increased the delay for the Episode information api calls. #1163 Fixed the issue with notifications being slightly borked #1263 Fixed the issue for Radarr, the api changed again #1263 --- Ombi.Api.Interfaces/IRadarrApi.cs | 2 +- Ombi.Api.Models/Radarr/RadarrMovieContainer.cs | 3 +++ Ombi.Api/RadarrApi.cs | 4 ++-- Ombi.Services/Jobs/RadarrCacher.cs | 2 +- .../EmbyRecentlyAddedNewsletter.cs | 4 ++-- Ombi.Services/Notification/EmailMessageNotification.cs | 8 ++++---- 6 files changed, 13 insertions(+), 10 deletions(-) diff --git a/Ombi.Api.Interfaces/IRadarrApi.cs b/Ombi.Api.Interfaces/IRadarrApi.cs index fc20c8d43..f1b015d31 100644 --- a/Ombi.Api.Interfaces/IRadarrApi.cs +++ b/Ombi.Api.Interfaces/IRadarrApi.cs @@ -8,7 +8,7 @@ namespace Ombi.Api.Interfaces public interface IRadarrApi { RadarrAddMovie AddMovie(int tmdbId, string title, int year, int qualityId, string rootPath, string apiKey, Uri baseUrl, bool searchNow = false); - RadarrMovieContainer GetMovies(string apiKey, Uri baseUrl); + List GetMovies(string apiKey, Uri baseUrl); List GetProfiles(string apiKey, Uri baseUrl); SystemStatus SystemStatus(string apiKey, Uri baseUrl); List GetRootFolders(string apiKey, Uri baseUrl); diff --git a/Ombi.Api.Models/Radarr/RadarrMovieContainer.cs b/Ombi.Api.Models/Radarr/RadarrMovieContainer.cs index fea472db7..f1ae0d745 100644 --- a/Ombi.Api.Models/Radarr/RadarrMovieContainer.cs +++ b/Ombi.Api.Models/Radarr/RadarrMovieContainer.cs @@ -29,6 +29,9 @@ using System.Collections.Generic; namespace Ombi.Api.Models.Radarr { + /// + /// This is not used now... Keeping it here incase Radarr changes their mind again. + /// public class RadarrMovieContainer { public int page { get; set; } diff --git a/Ombi.Api/RadarrApi.cs b/Ombi.Api/RadarrApi.cs index 9d5a34e9a..1840f40a0 100644 --- a/Ombi.Api/RadarrApi.cs +++ b/Ombi.Api/RadarrApi.cs @@ -152,7 +152,7 @@ namespace Ombi.Api } - public RadarrMovieContainer GetMovies(string apiKey, Uri baseUrl) + public List GetMovies(string apiKey, Uri baseUrl) { var request = new RestRequest { Resource = "/api/movie", Method = Method.GET }; request.AddHeader("X-Api-Key", apiKey); @@ -165,7 +165,7 @@ namespace Ombi.Api var obj = policy.Execute(() => Api.Execute(request, baseUrl)); - return JsonConvert.DeserializeObject(obj.Content); + return JsonConvert.DeserializeObject>(obj.Content); } } } \ No newline at end of file diff --git a/Ombi.Services/Jobs/RadarrCacher.cs b/Ombi.Services/Jobs/RadarrCacher.cs index e781c997f..0be1faa7b 100644 --- a/Ombi.Services/Jobs/RadarrCacher.cs +++ b/Ombi.Services/Jobs/RadarrCacher.cs @@ -67,7 +67,7 @@ namespace Ombi.Services.Jobs if (movies != null) { var movieIds = new List(); - foreach (var m in movies.records) + foreach (var m in movies) { if (m.tmdbId > 0) { diff --git a/Ombi.Services/Jobs/RecentlyAddedNewsletter/EmbyRecentlyAddedNewsletter.cs b/Ombi.Services/Jobs/RecentlyAddedNewsletter/EmbyRecentlyAddedNewsletter.cs index 7bda0d5af..fbd714e8a 100644 --- a/Ombi.Services/Jobs/RecentlyAddedNewsletter/EmbyRecentlyAddedNewsletter.cs +++ b/Ombi.Services/Jobs/RecentlyAddedNewsletter/EmbyRecentlyAddedNewsletter.cs @@ -154,7 +154,7 @@ namespace Ombi.Services.Jobs.RecentlyAddedNewsletter Ombi.Api.Models.Emby.EmbyMediaType.Episode, embySettings.ApiKey, embySettings.AdministratorId, embySettings.FullUri); episodeList.Add(epInfo.EpisodeInformation); - Thread.Sleep(200); // Let's not try and overload the server + Thread.Sleep(600); // Let's not try and overload the server } item.EpisodeInformation = episodeList; } @@ -162,7 +162,7 @@ namespace Ombi.Services.Jobs.RecentlyAddedNewsletter { Log.Error( "Failed getting episode information, we may have overloaded Emby's api... Waiting and we will skip this one and go to the next"); - Thread.Sleep(500); + Thread.Sleep(1000); } } diff --git a/Ombi.Services/Notification/EmailMessageNotification.cs b/Ombi.Services/Notification/EmailMessageNotification.cs index 7f1a80f8d..cd85913dc 100644 --- a/Ombi.Services/Notification/EmailMessageNotification.cs +++ b/Ombi.Services/Notification/EmailMessageNotification.cs @@ -76,7 +76,7 @@ namespace Ombi.Services.Notification { Message = html, Subject = $"Ombi: New {model.RequestType.GetString()?.ToLower()} request for {model.Title}!", - To = model.UserEmail, + To = settings.RecipientEmail, }; message.Other.Add("PlainTextBody", $"Hello! The user '{model.User}' has requested the {model.RequestType.GetString()?.ToLower()} '{model.Title}'! Please log in to approve this request. Request Date: {model.DateTime.ToString("f")}"); @@ -96,7 +96,7 @@ namespace Ombi.Services.Notification { Message = html, Subject = $"Ombi: New issue for {model.Title}!", - To = model.UserEmail, + To = settings.RecipientEmail, }; message.Other.Add("PlainTextBody", $"Hello! The user '{model.User}' has reported a new issue {model.Body} for the title {model.Title}!"); @@ -118,7 +118,7 @@ namespace Ombi.Services.Notification { Message = html, Subject = $"Ombi: A request could not be added", - To = model.UserEmail, + To = settings.RecipientEmail, }; message.Other.Add("PlainTextBody", $"Hello! The user '{model.User}' has requested {model.Title} but it could not be added. This has been added into the requests queue and will keep retrying"); @@ -241,7 +241,7 @@ namespace Ombi.Services.Notification { Message = html, Subject = $"Ombi: Test", - To = model.UserEmail, + To = settings.RecipientEmail, }; message.Other.Add("PlainTextBody", "This is just a test! Success!");