From 9b9ef0e29f9a2f50085692a19f2010a88db3b66e Mon Sep 17 00:00:00 2001 From: Anojh Date: Thu, 17 May 2018 20:21:49 -0700 Subject: [PATCH 1/8] fix #1745 --- src/Ombi.Core/Senders/TvSender.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Ombi.Core/Senders/TvSender.cs b/src/Ombi.Core/Senders/TvSender.cs index cdf834fa5..c5771eb9f 100644 --- a/src/Ombi.Core/Senders/TvSender.cs +++ b/src/Ombi.Core/Senders/TvSender.cs @@ -160,13 +160,13 @@ namespace Ombi.Core.Senders // Montitor the correct seasons, // If we have that season in the model then it's monitored! var seasonsToAdd = new List(); - for (var i = 1; i < model.ParentRequest.TotalSeasons + 1; i++) + for (var i = 0; i < model.ParentRequest.TotalSeasons + 1; i++) { var index = i; var season = new Season { seasonNumber = i, - monitored = model.SeasonRequests.Any(x => x.SeasonNumber == index) + monitored = model.SeasonRequests.Any(x => x.SeasonNumber == index && x.SeasonNumber != 0) }; seasonsToAdd.Add(season); } From c574dbe82bac0e728c263bf458e733d008fa83cd Mon Sep 17 00:00:00 2001 From: Anojh Date: Fri, 18 May 2018 12:20:06 -0700 Subject: [PATCH 2/8] fix newsletter card background overflow when only one item is available --- src/Ombi.Schedule/Jobs/Ombi/HtmlTemplateGenerator.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Ombi.Schedule/Jobs/Ombi/HtmlTemplateGenerator.cs b/src/Ombi.Schedule/Jobs/Ombi/HtmlTemplateGenerator.cs index a28133bc2..51e920b15 100644 --- a/src/Ombi.Schedule/Jobs/Ombi/HtmlTemplateGenerator.cs +++ b/src/Ombi.Schedule/Jobs/Ombi/HtmlTemplateGenerator.cs @@ -7,7 +7,7 @@ namespace Ombi.Schedule.Jobs.Ombi protected virtual void AddBackgroundInsideTable(StringBuilder sb, string url) { sb.Append(""); - sb.AppendFormat("", url); + sb.AppendFormat("
", url); sb.Append(""); sb.Append("
"); sb.Append(""); From b7dcb80ae9cf566c818f5a78d8f3d4eaaea9875b Mon Sep 17 00:00:00 2001 From: Joe Harvey Date: Sat, 19 May 2018 16:40:25 +1200 Subject: [PATCH 3/8] Sort TvRequests by latest request --- src/Ombi.Core/Engine/TvRequestEngine.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Ombi.Core/Engine/TvRequestEngine.cs b/src/Ombi.Core/Engine/TvRequestEngine.cs index d74b45e5e..ddf84376e 100644 --- a/src/Ombi.Core/Engine/TvRequestEngine.cs +++ b/src/Ombi.Core/Engine/TvRequestEngine.cs @@ -142,7 +142,8 @@ namespace Ombi.Core.Engine .Include(x => x.ChildRequests) .ThenInclude(x => x.SeasonRequests) .ThenInclude(x => x.Episodes) - .Skip(position).Take(count).OrderByDescending(x => x.ReleaseDate).ToListAsync(); + .OrderByDescending(x => x.ChildRequests.Max(y => y.RequestedDate)) + .Skip(position).Take(count).ToListAsync(); // Filter out children @@ -154,7 +155,8 @@ namespace Ombi.Core.Engine .Include(x => x.ChildRequests) .ThenInclude(x => x.SeasonRequests) .ThenInclude(x => x.Episodes) - .Skip(position).Take(count).OrderByDescending(x => x.ReleaseDate).ToListAsync(); + .OrderByDescending(x => x.ChildRequests.Max(y => y.RequestedDate)) + .Skip(position).Take(count).ToListAsync(); } allRequests.ForEach(async r => { await CheckForSubscription(shouldHide, r); }); @@ -172,6 +174,7 @@ namespace Ombi.Core.Engine .Include(x => x.ChildRequests) .ThenInclude(x => x.SeasonRequests) .ThenInclude(x => x.Episodes) + .OrderByDescending(x => x.ChildRequests.Max(y => y.RequestedDate)) .Skip(position).Take(count).ToListAsync(); FilterChildren(allRequests, shouldHide); @@ -182,6 +185,7 @@ namespace Ombi.Core.Engine .Include(x => x.ChildRequests) .ThenInclude(x => x.SeasonRequests) .ThenInclude(x => x.Episodes) + .OrderByDescending(x => x.ChildRequests.Max(y => y.RequestedDate)) .Skip(position).Take(count).ToListAsync(); } From 4afe4fc9fceefcebead1f2783ddc85340cbaaacb Mon Sep 17 00:00:00 2001 From: Jamie Rees Date: Tue, 22 May 2018 15:12:10 +0100 Subject: [PATCH 4/8] Added a default set of root folders and qualities for Anime in Sonarr --- src/Ombi.Core/Senders/TvSender.cs | 26 ++++++++++++++----- .../Models/External/SonarrSettings.cs | 4 +++ .../ClientApp/app/interfaces/ISettings.ts | 2 ++ .../app/settings/sonarr/sonarr.component.html | 17 ++++++++++++ .../app/settings/sonarr/sonarr.component.ts | 6 +++++ 5 files changed, 49 insertions(+), 6 deletions(-) diff --git a/src/Ombi.Core/Senders/TvSender.cs b/src/Ombi.Core/Senders/TvSender.cs index cdf834fa5..9ebe3c328 100644 --- a/src/Ombi.Core/Senders/TvSender.cs +++ b/src/Ombi.Core/Senders/TvSender.cs @@ -118,17 +118,31 @@ namespace Ombi.Core.Senders return null; } - int.TryParse(s.QualityProfile, out var qualityToUse); + int qualityToUse; + string rootFolderPath; + + if (model.SeriesType == SeriesType.Anime) + { + // Get the root path from the rootfolder selected. + // For some reason, if we haven't got one use the first root folder in Sonarr + // TODO make this overrideable via the UI + rootFolderPath = await GetSonarrRootPath(model.ParentRequest.RootFolder ?? int.Parse(s.RootPathAnime), s); + int.TryParse(s.QualityProfileAnime, out qualityToUse); + } + else + { + int.TryParse(s.QualityProfile, out qualityToUse); + } if (model.ParentRequest.QualityOverride.HasValue) { + // Get the root path from the rootfolder selected. + // For some reason, if we haven't got one use the first root folder in Sonarr + // TODO make this overrideable via the UI + rootFolderPath = await GetSonarrRootPath(model.ParentRequest.RootFolder ?? int.Parse(s.RootPath), s); qualityToUse = model.ParentRequest.QualityOverride.Value; } - - // Get the root path from the rootfolder selected. - // For some reason, if we haven't got one use the first root folder in Sonarr - // TODO make this overrideable via the UI - var rootFolderPath = await GetSonarrRootPath(model.ParentRequest.RootFolder ?? int.Parse(s.RootPath), s); + try { // Does the series actually exist? diff --git a/src/Ombi.Settings/Settings/Models/External/SonarrSettings.cs b/src/Ombi.Settings/Settings/Models/External/SonarrSettings.cs index 789b8f384..0c7e17900 100644 --- a/src/Ombi.Settings/Settings/Models/External/SonarrSettings.cs +++ b/src/Ombi.Settings/Settings/Models/External/SonarrSettings.cs @@ -13,6 +13,10 @@ /// The root path. /// public string RootPath { get; set; } + + + public string QualityProfileAnime { get; set; } + public string RootPathAnime { get; set; } public bool AddOnly { get; set; } } } \ No newline at end of file diff --git a/src/Ombi/ClientApp/app/interfaces/ISettings.ts b/src/Ombi/ClientApp/app/interfaces/ISettings.ts index 8e7fdbe1c..dc1825c83 100644 --- a/src/Ombi/ClientApp/app/interfaces/ISettings.ts +++ b/src/Ombi/ClientApp/app/interfaces/ISettings.ts @@ -65,8 +65,10 @@ export interface ISonarrSettings extends IExternalSettings { apiKey: string; enabled: boolean; qualityProfile: string; + qualityProfileAnime: string; seasonFolders: boolean; rootPath: string; + rootPathAnime: string; fullRootPath: string; addOnly: boolean; } diff --git a/src/Ombi/ClientApp/app/settings/sonarr/sonarr.component.html b/src/Ombi/ClientApp/app/settings/sonarr/sonarr.component.html index e041ab0d0..6a419feab 100644 --- a/src/Ombi/ClientApp/app/settings/sonarr/sonarr.component.html +++ b/src/Ombi/ClientApp/app/settings/sonarr/sonarr.component.html @@ -68,6 +68,14 @@ A Default Quality Profile is required +
+ +
+ +
+
@@ -85,6 +93,15 @@ A Default Root Path is required
+
+ +
+ +
+ +
diff --git a/src/Ombi/ClientApp/app/settings/sonarr/sonarr.component.ts b/src/Ombi/ClientApp/app/settings/sonarr/sonarr.component.ts index bb69760ef..03fadb2b7 100644 --- a/src/Ombi/ClientApp/app/settings/sonarr/sonarr.component.ts +++ b/src/Ombi/ClientApp/app/settings/sonarr/sonarr.component.ts @@ -15,7 +15,9 @@ import { SettingsService } from "../../services"; export class SonarrComponent implements OnInit { public qualities: ISonarrProfile[]; + public qualitiesAnime: ISonarrProfile[]; public rootFolders: ISonarrRootFolder[]; + public rootFoldersAnime: ISonarrRootFolder[]; public selectedRootFolder: ISonarrRootFolder; public selectedQuality: ISonarrProfile; public profilesRunning: boolean; @@ -37,6 +39,8 @@ export class SonarrComponent implements OnInit { apiKey: [x.apiKey, [Validators.required]], qualityProfile: [x.qualityProfile, [Validators.required]], rootPath: [x.rootPath, [Validators.required]], + qualityProfileAnime: [x.qualityProfileAnime], + rootPathAnime: [x.rootPathAnime], ssl: [x.ssl], subDir: [x.subDir], ip: [x.ip, [Validators.required]], @@ -64,6 +68,7 @@ export class SonarrComponent implements OnInit { .subscribe(x => { this.qualities = x; this.qualities.unshift({ name: "Please Select", id: -1 }); + this.qualitiesAnime = x; this.profilesRunning = false; this.notificationService.success("Successfully retrieved the Quality Profiles"); @@ -76,6 +81,7 @@ export class SonarrComponent implements OnInit { .subscribe(x => { this.rootFolders = x; this.rootFolders.unshift({ path: "Please Select", id: -1 }); + this.rootFoldersAnime = x; this.rootFoldersRunning = false; this.notificationService.success("Successfully retrieved the Root Folders"); From 948e1dad3a3d0931584864edd18bd652cba77cc9 Mon Sep 17 00:00:00 2001 From: Jamie Rees Date: Tue, 22 May 2018 16:24:14 +0100 Subject: [PATCH 5/8] Fixed build --- src/Ombi.Core/Senders/TvSender.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Ombi.Core/Senders/TvSender.cs b/src/Ombi.Core/Senders/TvSender.cs index 549467feb..151ad0f7b 100644 --- a/src/Ombi.Core/Senders/TvSender.cs +++ b/src/Ombi.Core/Senders/TvSender.cs @@ -132,14 +132,14 @@ namespace Ombi.Core.Senders else { int.TryParse(s.QualityProfile, out qualityToUse); - } - - if (model.ParentRequest.QualityOverride.HasValue) - { // Get the root path from the rootfolder selected. // For some reason, if we haven't got one use the first root folder in Sonarr // TODO make this overrideable via the UI rootFolderPath = await GetSonarrRootPath(model.ParentRequest.RootFolder ?? int.Parse(s.RootPath), s); + } + + if (model.ParentRequest.QualityOverride.HasValue) + { qualityToUse = model.ParentRequest.QualityOverride.Value; } From b323db18646820a8ebdbe243271efaffec80eaa4 Mon Sep 17 00:00:00 2001 From: Jamie Date: Sat, 26 May 2018 23:23:28 +0100 Subject: [PATCH 6/8] Fixed a issue where the Plex Content Sync wouldn't pick up new shows #2276 #2244 #2261 --- .../Jobs/Plex/PlexContentSync.cs | 60 ++++++++++++++----- src/Ombi.Store/Repository/IRepository.cs | 2 +- src/Ombi.Store/Repository/Repository.cs | 7 ++- 3 files changed, 50 insertions(+), 19 deletions(-) diff --git a/src/Ombi.Schedule/Jobs/Plex/PlexContentSync.cs b/src/Ombi.Schedule/Jobs/Plex/PlexContentSync.cs index 95cd3ba38..57804d0f3 100644 --- a/src/Ombi.Schedule/Jobs/Plex/PlexContentSync.cs +++ b/src/Ombi.Schedule/Jobs/Plex/PlexContentSync.cs @@ -119,7 +119,7 @@ namespace Ombi.Schedule.Jobs.Plex { try { - Logger.LogInformation("Starting to cache the content on server {0}", servers.Name); + Logger.LogInformation("Starting to cache the content on server {0}", servers.Name); if (recentlyAddedSearch) { @@ -162,8 +162,10 @@ namespace Ombi.Schedule.Jobs.Plex if (content.viewGroup.Equals(PlexMediaType.Episode.ToString(), StringComparison.CurrentCultureIgnoreCase)) { Logger.LogInformation("Found some episodes, this must be a recently added sync"); + var count = 0; foreach (var epInfo in content.Metadata) { + count++; var grandParentKey = epInfo.grandparentRatingKey; // Lookup the rating key var showMetadata = await PlexApi.GetMetadata(servers.PlexAuthToken, servers.FullUri, grandParentKey); @@ -174,18 +176,59 @@ namespace Ombi.Schedule.Jobs.Plex } await ProcessTvShow(servers, show, contentToAdd, recentlyAddedSearch, processedContent); + if (contentToAdd.Any()) + { + await Repo.AddRange(contentToAdd, false); + if (recentlyAddedSearch) + { + foreach (var plexServerContent in contentToAdd) + { + processedContent.Add(plexServerContent.Id); + } + } + contentToAdd.Clear(); + } + if (count > 200) + { + await Repo.SaveChangesAsync(); + + } } + // Save just to make sure we don't leave anything hanging + await Repo.SaveChangesAsync(); + await EpisodeSync.ProcessEpsiodes(content.Metadata, allEps); } if (content.viewGroup.Equals(PlexMediaType.Show.ToString(), StringComparison.CurrentCultureIgnoreCase)) { // Process Shows Logger.LogInformation("Processing TV Shows"); + var count = 0; foreach (var show in content.Metadata ?? new Metadata[] { }) { + count++; await ProcessTvShow(servers, show, contentToAdd, recentlyAddedSearch, processedContent); + + if (contentToAdd.Any()) + { + await Repo.AddRange(contentToAdd, false); + if (recentlyAddedSearch) + { + foreach (var plexServerContent in contentToAdd) + { + processedContent.Add(plexServerContent.Id); + } + } + contentToAdd.Clear(); + } + if (count > 200) + { + await Repo.SaveChangesAsync(); + } } + + await Repo.SaveChangesAsync(); } if (content.viewGroup.Equals(PlexMediaType.Movie.ToString(), StringComparison.CurrentCultureIgnoreCase)) { @@ -464,21 +507,6 @@ namespace Ombi.Schedule.Jobs.Plex show.title); } } - - if (contentToAdd.Count > 500 || recentlyAdded) - { - await Repo.AddRange(contentToAdd); - foreach (var plexServerContent in contentToAdd) - { - contentProcessed.Add(plexServerContent.Id); - } - contentToAdd.Clear(); - } - - if (contentToAdd.Any()) - { - await Repo.AddRange(contentToAdd); - } } /// diff --git a/src/Ombi.Store/Repository/IRepository.cs b/src/Ombi.Store/Repository/IRepository.cs index c85b45d8f..810b586a3 100644 --- a/src/Ombi.Store/Repository/IRepository.cs +++ b/src/Ombi.Store/Repository/IRepository.cs @@ -14,7 +14,7 @@ namespace Ombi.Store.Repository Task Find(object key); IQueryable GetAll(); Task FirstOrDefaultAsync(Expression> predicate); - Task AddRange(IEnumerable content); + Task AddRange(IEnumerable content, bool save = true); Task Add(T content); Task DeleteRange(IEnumerable req); Task Delete(T request); diff --git a/src/Ombi.Store/Repository/Repository.cs b/src/Ombi.Store/Repository/Repository.cs index 049da0356..8c07c2371 100644 --- a/src/Ombi.Store/Repository/Repository.cs +++ b/src/Ombi.Store/Repository/Repository.cs @@ -35,10 +35,13 @@ namespace Ombi.Store.Repository return await _db.FirstOrDefaultAsync(predicate); } - public async Task AddRange(IEnumerable content) + public async Task AddRange(IEnumerable content, bool save = true) { _db.AddRange(content); - await _ctx.SaveChangesAsync(); + if (save) + { + await _ctx.SaveChangesAsync(); + } } public async Task Add(T content) From a6a024d6d9837196427cc5df068c8d7685566589 Mon Sep 17 00:00:00 2001 From: Jamie Date: Sat, 26 May 2018 23:24:21 +0100 Subject: [PATCH 7/8] Fixed #2243 The refresh metadata was being run everytime we launched Ombi... --- src/Ombi.Schedule/JobSetup.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/Ombi.Schedule/JobSetup.cs b/src/Ombi.Schedule/JobSetup.cs index 44997f272..e24e4bd87 100644 --- a/src/Ombi.Schedule/JobSetup.cs +++ b/src/Ombi.Schedule/JobSetup.cs @@ -68,8 +68,6 @@ namespace Ombi.Schedule RecurringJob.AddOrUpdate(() => _embyUserImporter.Start(), JobSettingsHelper.UserImporter(s)); RecurringJob.AddOrUpdate(() => _plexUserImporter.Start(), JobSettingsHelper.UserImporter(s)); RecurringJob.AddOrUpdate(() => _newsletter.Start(), JobSettingsHelper.Newsletter(s)); - - BackgroundJob.Enqueue(() => _refreshMetadata.Start()); } From 44a151d8ba54c45ece212545a1c5f072eb6d0450 Mon Sep 17 00:00:00 2001 From: Jamie Date: Sat, 26 May 2018 23:25:24 +0100 Subject: [PATCH 8/8] !wip changelog --- CHANGELOG.md | 35 ++++++++++++++++++++++++++++++----- 1 file changed, 30 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5f39765e5..fb2e7fd50 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,26 +4,51 @@ ### **New Features** -- Finished adding subscriptions for TV Shows. [Jamie Rees] +- Added a default set of root folders and qualities for Anime in Sonarr. [Jamie Rees] + +### **Fixes** + +- Fixed #2243 The refresh metadata was being run everytime we launched Ombi... [Jamie] + +- Fixed a issue where the Plex Content Sync wouldn't pick up new shows #2276 #2244 #2261. [Jamie] + +- Sort TvRequests by latest request. [Joe Harvey] + +- Fixed build. [Jamie Rees] + +- Fix newsletter card background overflow when only one item is available. [Anojh] + +- Fix #1745. [Anojh] + + +## v3.0.3330 (2018-05-17) + +### **New Features** - Added the test button for mobile notifications. [Jamie Rees] - Added classes to donation html elements. [Anojh] -- Enhanced newsletter styling to support more mail clients. [Anojh] - -- Improved the way we sync the plex content and then get the metadata. #2243. [Jamie Rees] - ### **Fixes** +- !changelog. [Jamie Rees] + - Fixed #2257. [Jamie Rees] +- Improved the way we sync the plex content and then get the metadata. #2243. [Jamie Rees] + - Fixed the issue when enabling the Hide Request Users included system users e.g. API key user #2232. [Jamie Rees] +- Removed the test button from the mobile screen since it did nada. [Jamie Rees] + +- Finished adding subscriptions for TV Shows. [Jamie Rees] + - Fix #2167. [Anojh] - Fix #2228. [Anojh] +- Enhanced newsletter styling to support more mail clients. [Anojh] + - Fix #2246. [Anojh] - Fix #2234. [Anojh]