From eb433867af78907c008d10a1114ba592eaf81135 Mon Sep 17 00:00:00 2001 From: "Jamie.Rees" Date: Tue, 13 Jun 2017 10:39:15 +0100 Subject: [PATCH] Fixed many bugs #865 --- src/Ombi.Core/Engine/TvRequestEngine.cs | 21 ++++++- src/Ombi.Core/Engine/TvSearchEngine.cs | 13 ++--- src/Ombi.Core/MovieSender.cs | 2 +- .../DiscordNotification.cs | 2 +- .../Models/External/RadarrSettings.cs | 1 + src/Ombi/ClientApp/app/app.component.html | 2 +- .../ClientApp/app/interfaces/ISettings.ts | 25 ++++---- .../app/requests/tvrequests.component.html | 58 ++++++++++++------- .../app/requests/tvrequests.component.ts | 8 +++ .../search/seriesinformation.component.html | 4 +- .../app/search/seriesinformation.component.ts | 15 +++-- .../app/search/tvsearch.component.ts | 2 +- .../app/services/notification.service.ts | 1 + .../app/settings/plex/plex.component.html | 7 ++- .../app/settings/radarr/radarr.component.html | 15 ++++- .../app/settings/radarr/radarr.component.ts | 2 + src/Ombi/Styles/Styles.scss | 16 ++++- src/Ombi/Styles/_imports.scss | 3 +- 18 files changed, 135 insertions(+), 62 deletions(-) diff --git a/src/Ombi.Core/Engine/TvRequestEngine.cs b/src/Ombi.Core/Engine/TvRequestEngine.cs index ab319be75..78c4d826c 100644 --- a/src/Ombi.Core/Engine/TvRequestEngine.cs +++ b/src/Ombi.Core/Engine/TvRequestEngine.cs @@ -41,6 +41,25 @@ namespace Ombi.Core.Engine // For some reason the poster path is always http var posterPath = showInfo.image?.medium.Replace("http:", "https:"); + var tvRequests = new List(); + // Only have the TV requests we actually requested and not everything + foreach (var season in tv.SeasonRequests) + { + for (int i = season.Episodes.Count - 1; i >= 0; i--) + { + if (!season.Episodes[i].Requested) + { + season.Episodes.RemoveAt(i); // Remove the episode since it's not requested + } + } + + if (season.Episodes.Any()) + { + tvRequests.Add(season); + } + } + + var childRequest = new ChildTvRequest { Id = tv.Id, @@ -56,7 +75,7 @@ namespace Ombi.Core.Engine Issues = IssueState.None, ProviderId = tv.Id, RequestAll = tv.RequestAll, - SeasonRequests = tv.SeasonRequests + SeasonRequests = tvRequests }; var model = new TvRequestModel diff --git a/src/Ombi.Core/Engine/TvSearchEngine.cs b/src/Ombi.Core/Engine/TvSearchEngine.cs index 953c242ec..abc962136 100644 --- a/src/Ombi.Core/Engine/TvSearchEngine.cs +++ b/src/Ombi.Core/Engine/TvSearchEngine.cs @@ -77,13 +77,12 @@ namespace Ombi.Core.Engine } else { - season.Episodes.Add(new EpisodesRequested - { - Url = e.url, - Title = e.name, - AirDate = DateTime.Parse(e.airstamp), - EpisodeNumber = e.number, - }); + // Find the episode + var ep = season.Episodes.FirstOrDefault(x => x.EpisodeNumber == e.number); + ep.Url = e.url; + ep.Title = e.name; + ep.AirDate = DateTime.Parse(e.airstamp); + ep.EpisodeNumber = e.number; } } diff --git a/src/Ombi.Core/MovieSender.cs b/src/Ombi.Core/MovieSender.cs index 2b8974cbd..8db810101 100644 --- a/src/Ombi.Core/MovieSender.cs +++ b/src/Ombi.Core/MovieSender.cs @@ -66,7 +66,7 @@ namespace Ombi.Core //var rootFolderPath = model.RootFolderSelected <= 0 ? settings.FullRootPath : GetRootPath(model.RootFolderSelected, settings); var rootFolderPath = settings.DefaultRootPath; // TODO Allow changing in the UI - var result = await RadarrApi.AddMovie(model.ProviderId, model.Title, model.ReleaseDate.Year, qualityProfile, rootFolderPath, settings.ApiKey, settings.FullUri, true); + var result = await RadarrApi.AddMovie(model.ProviderId, model.Title, model.ReleaseDate.Year, qualityProfile, rootFolderPath, settings.ApiKey, settings.FullUri, !settings.AddOnly); if (!string.IsNullOrEmpty(result.Error?.message)) { diff --git a/src/Ombi.Notification.Agents/DiscordNotification.cs b/src/Ombi.Notification.Agents/DiscordNotification.cs index aa693b363..c82fb55d4 100644 --- a/src/Ombi.Notification.Agents/DiscordNotification.cs +++ b/src/Ombi.Notification.Agents/DiscordNotification.cs @@ -8,7 +8,7 @@ using Ombi.Notifications; using Ombi.Notifications.Models; using Ombi.Settings.Settings.Models.Notifications; -namespace Ombi.Notification.Discord +namespace Ombi.Notification.Agents { public class DiscordNotification : BaseNotification { diff --git a/src/Ombi.Settings/Settings/Models/External/RadarrSettings.cs b/src/Ombi.Settings/Settings/Models/External/RadarrSettings.cs index b76e56f6e..919ea0377 100644 --- a/src/Ombi.Settings/Settings/Models/External/RadarrSettings.cs +++ b/src/Ombi.Settings/Settings/Models/External/RadarrSettings.cs @@ -9,5 +9,6 @@ namespace Ombi.Settings.Settings.Models.External public string DefaultQualityProfile { get; set; } public string DefaultRootPath { get; set; } public string FullRootPath { get; set; } + public bool AddOnly { get; set; } } } \ No newline at end of file diff --git a/src/Ombi/ClientApp/app/app.component.html b/src/Ombi/ClientApp/app/app.component.html index cdd4cc697..80b50eee4 100644 --- a/src/Ombi/ClientApp/app/app.component.html +++ b/src/Ombi/ClientApp/app/app.component.html @@ -1,4 +1,4 @@ - +