From 63fe0239e35caec6aba1c5e65581d2d1e7a4e4bd Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sun, 20 Mar 2016 20:15:56 -0400 Subject: [PATCH] update album queries --- MediaBrowser.Api/Reports/ReportsService.cs | 14 ++------------ MediaBrowser.Api/UserLibrary/ItemsService.cs | 14 ++------------ MediaBrowser.Controller/Entities/Folder.cs | 6 ++++++ .../Entities/InternalItemsQuery.cs | 3 ++- .../Entities/UserViewBuilder.cs | 11 +++++++++++ 5 files changed, 23 insertions(+), 25 deletions(-) diff --git a/MediaBrowser.Api/Reports/ReportsService.cs b/MediaBrowser.Api/Reports/ReportsService.cs index 4ff3dcf26..5b492d8b4 100644 --- a/MediaBrowser.Api/Reports/ReportsService.cs +++ b/MediaBrowser.Api/Reports/ReportsService.cs @@ -260,7 +260,8 @@ namespace MediaBrowser.Api.Reports MinCommunityRating = request.MinCommunityRating, MinCriticRating = request.MinCriticRating, ParentIndexNumber = request.ParentIndexNumber, - AiredDuringSeason = request.AiredDuringSeason + AiredDuringSeason = request.AiredDuringSeason, + AlbumArtistStartsWithOrGreater = request.AlbumArtistStartsWithOrGreater }; if (!string.IsNullOrWhiteSpace(request.Ids)) @@ -477,17 +478,6 @@ namespace MediaBrowser.Api.Reports } } - if (!string.IsNullOrEmpty(request.AlbumArtistStartsWithOrGreater)) - { - var ok = new[] { i }.OfType() - .Any(p => string.Compare(request.AlbumArtistStartsWithOrGreater, p.AlbumArtists.FirstOrDefault(), StringComparison.CurrentCultureIgnoreCase) < 1); - - if (!ok) - { - return false; - } - } - return true; } diff --git a/MediaBrowser.Api/UserLibrary/ItemsService.cs b/MediaBrowser.Api/UserLibrary/ItemsService.cs index c54f25973..92b2d6002 100644 --- a/MediaBrowser.Api/UserLibrary/ItemsService.cs +++ b/MediaBrowser.Api/UserLibrary/ItemsService.cs @@ -233,7 +233,8 @@ namespace MediaBrowser.Api.UserLibrary MinCriticRating = request.MinCriticRating, ParentId = string.IsNullOrWhiteSpace(request.ParentId) ? (Guid?)null : new Guid(request.ParentId), ParentIndexNumber = request.ParentIndexNumber, - AiredDuringSeason = request.AiredDuringSeason + AiredDuringSeason = request.AiredDuringSeason, + AlbumArtistStartsWithOrGreater = request.AlbumArtistStartsWithOrGreater }; if (!string.IsNullOrWhiteSpace(request.Ids)) @@ -435,17 +436,6 @@ namespace MediaBrowser.Api.UserLibrary } } - if (!string.IsNullOrEmpty(request.AlbumArtistStartsWithOrGreater)) - { - var ok = new[] { i }.OfType() - .Any(p => string.Compare(request.AlbumArtistStartsWithOrGreater, p.AlbumArtists.FirstOrDefault(), StringComparison.CurrentCultureIgnoreCase) < 1); - - if (!ok) - { - return false; - } - } - return true; } } diff --git a/MediaBrowser.Controller/Entities/Folder.cs b/MediaBrowser.Controller/Entities/Folder.cs index dc0a8d0aa..dcdd10dd6 100644 --- a/MediaBrowser.Controller/Entities/Folder.cs +++ b/MediaBrowser.Controller/Entities/Folder.cs @@ -1188,6 +1188,12 @@ namespace MediaBrowser.Controller.Entities return true; } + if (!string.IsNullOrWhiteSpace(query.AlbumArtistStartsWithOrGreater)) + { + Logger.Debug("Query requires post-filtering due to AlbumArtistStartsWithOrGreater"); + return true; + } + return false; } diff --git a/MediaBrowser.Controller/Entities/InternalItemsQuery.cs b/MediaBrowser.Controller/Entities/InternalItemsQuery.cs index 2f98ac70d..da76e7db0 100644 --- a/MediaBrowser.Controller/Entities/InternalItemsQuery.cs +++ b/MediaBrowser.Controller/Entities/InternalItemsQuery.cs @@ -125,7 +125,8 @@ namespace MediaBrowser.Controller.Entities public DayOfWeek[] AirDays { get; set; } public SeriesStatus[] SeriesStatuses { get; set; } - + public string AlbumArtistStartsWithOrGreater { get; set; } + public InternalItemsQuery() { BlockUnratedItems = new UnratedItem[] { }; diff --git a/MediaBrowser.Controller/Entities/UserViewBuilder.cs b/MediaBrowser.Controller/Entities/UserViewBuilder.cs index 645e6e37d..ccb842cf4 100644 --- a/MediaBrowser.Controller/Entities/UserViewBuilder.cs +++ b/MediaBrowser.Controller/Entities/UserViewBuilder.cs @@ -1752,6 +1752,17 @@ namespace MediaBrowser.Controller.Entities } } + if (!string.IsNullOrEmpty(query.AlbumArtistStartsWithOrGreater)) + { + var ok = new[] { item }.OfType() + .Any(p => string.Compare(query.AlbumArtistStartsWithOrGreater, p.AlbumArtists.FirstOrDefault(), StringComparison.CurrentCultureIgnoreCase) < 1); + + if (!ok) + { + return false; + } + } + return true; }