The Free Software Media System - Server Backend & API
Enable nullable for InternalItemsQuery
Bond_0092b321d8b89bd
diff --git a/Emby.Server.Implementations/Data/SqliteItemRepository.cs b/Emby.Server.Implementations/Data/SqliteItemRepository.csindex 835eb06924..4ae7a842c6 100644--- a/Emby.Server.Implementations/Data/SqliteItemRepository.cs+++ b/Emby.Server.Implementations/Data/SqliteItemRepository.cs@@ -4427,7 +4427,7 @@ namespace Emby.Server.Implementations.DatawhereClauses.Add(string.Join(" AND ", excludeIds));}- if (query.ExcludeProviderIds.Count > 0)+ if (query.ExcludeProviderIds != null && query.ExcludeProviderIds.Count > 0){var excludeIds = new List<string>();@@ -4457,7 +4457,7 @@ namespace Emby.Server.Implementations.Data}}- if (query.HasAnyProviderId.Count > 0)+ if (query.HasAnyProviderId != null && query.HasAnyProviderId.Count > 0){var hasProviderIds = new List<string>();diff --git a/MediaBrowser.Controller/Entities/InternalItemsQuery.cs b/MediaBrowser.Controller/Entities/InternalItemsQuery.csindex c060210296..75fea365ba 100644--- a/MediaBrowser.Controller/Entities/InternalItemsQuery.cs+++ b/MediaBrowser.Controller/Entities/InternalItemsQuery.cs@@ -1,5 +1,3 @@-#nullable disable-#pragma warning disable CS1591using System;@@ -20,9 +18,9 @@ namespace MediaBrowser.Controller.Entitiespublic int? Limit { get; set; }- public User User { get; set; }+ public User? User { get; set; }- public BaseItem SimilarTo { get; set; }+ public BaseItem? SimilarTo { get; set; }public bool? IsFolder { get; set; }@@ -58,23 +56,23 @@ namespace MediaBrowser.Controller.Entitiespublic bool? CollapseBoxSetItems { get; set; }- public string NameStartsWithOrGreater { get; set; }+ public string? NameStartsWithOrGreater { get; set; }- public string NameStartsWith { get; set; }+ public string? NameStartsWith { get; set; }- public string NameLessThan { get; set; }+ public string? NameLessThan { get; set; }- public string NameContains { get; set; }+ public string? NameContains { get; set; }- public string MinSortName { get; set; }+ public string? MinSortName { get; set; }- public string PresentationUniqueKey { get; set; }+ public string? PresentationUniqueKey { get; set; }- public string Path { get; set; }+ public string? Path { get; set; }- public string Name { get; set; }+ public string? Name { get; set; }- public string Person { get; set; }+ public string? Person { get; set; }public Guid[] PersonIds { get; set; }@@ -82,7 +80,7 @@ namespace MediaBrowser.Controller.Entitiespublic Guid[] ExcludeItemIds { get; set; }- public string AdjacentTo { get; set; }+ public string? AdjacentTo { get; set; }public string[] PersonTypes { get; set; }@@ -182,13 +180,13 @@ namespace MediaBrowser.Controller.Entitiespublic Guid ParentId { get; set; }- public string ParentType { get; set; }+ public string? ParentType { get; set; }public Guid[] AncestorIds { get; set; }public Guid[] TopParentIds { get; set; }- public BaseItem Parent+ public BaseItem? Parent{set{@@ -213,9 +211,9 @@ namespace MediaBrowser.Controller.Entitiespublic SeriesStatus[] SeriesStatuses { get; set; }- public string ExternalSeriesId { get; set; }+ public string? ExternalSeriesId { get; set; }- public string ExternalId { get; set; }+ public string? ExternalId { get; set; }public Guid[] AlbumIds { get; set; }@@ -223,9 +221,9 @@ namespace MediaBrowser.Controller.Entitiespublic Guid[] ExcludeArtistIds { get; set; }- public string AncestorWithPresentationUniqueKey { get; set; }+ public string? AncestorWithPresentationUniqueKey { get; set; }- public string SeriesPresentationUniqueKey { get; set; }+ public string? SeriesPresentationUniqueKey { get; set; }public bool GroupByPresentationUniqueKey { get; set; }@@ -235,7 +233,7 @@ namespace MediaBrowser.Controller.Entitiespublic bool ForceDirect { get; set; }- public Dictionary<string, string> ExcludeProviderIds { get; set; }+ public Dictionary<string, string>? ExcludeProviderIds { get; set; }public bool EnableGroupByMetadataKey { get; set; }@@ -253,13 +251,13 @@ namespace MediaBrowser.Controller.Entitiespublic int MinSimilarityScore { get; set; }- public string HasNoAudioTrackWithLanguage { get; set; }+ public string? HasNoAudioTrackWithLanguage { get; set; }- public string HasNoInternalSubtitleTrackWithLanguage { get; set; }+ public string? HasNoInternalSubtitleTrackWithLanguage { get; set; }- public string HasNoExternalSubtitleTrackWithLanguage { get; set; }+ public string? HasNoExternalSubtitleTrackWithLanguage { get; set; }- public string HasNoSubtitleTrackWithLanguage { get; set; }+ public string? HasNoSubtitleTrackWithLanguage { get; set; }public bool? IsDeadArtist { get; set; }@@ -283,12 +281,10 @@ namespace MediaBrowser.Controller.EntitiesExcludeInheritedTags = Array.Empty<string>();ExcludeItemIds = Array.Empty<Guid>();ExcludeItemTypes = Array.Empty<string>();- ExcludeProviderIds = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);ExcludeTags = Array.Empty<string>();GenreIds = Array.Empty<Guid>();Genres = Array.Empty<string>();GroupByPresentationUniqueKey = true;- HasAnyProviderId = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);ImageTypes = Array.Empty<ImageType>();IncludeItemTypes = Array.Empty<string>();ItemIds = Array.Empty<Guid>();@@ -309,32 +305,33 @@ namespace MediaBrowser.Controller.EntitiesYears = Array.Empty<int>();}- public InternalItemsQuery(User user)+ public InternalItemsQuery(User? user): this(){- SetUser(user);+ if (user != null)+ {+ SetUser(user);+ }}public void SetUser(User user){- if (user != null)- {- MaxParentalRating = user.MaxParentalAgeRating;+ MaxParentalRating = user.MaxParentalAgeRating;- if (MaxParentalRating.HasValue)- {- BlockUnratedItems = user.GetPreference(PreferenceKind.BlockUnratedItems)- .Where(i => i != UnratedItem.Other.ToString())- .Select(e => Enum.Parse<UnratedItem>(e, true)).ToArray();- }+ if (MaxParentalRating.HasValue)+ {+ string other = UnratedItem.Other.ToString();+ BlockUnratedItems = user.GetPreference(PreferenceKind.BlockUnratedItems)+ .Where(i => i != other)+ .Select(e => Enum.Parse<UnratedItem>(e, true)).ToArray();+ }- ExcludeInheritedTags = user.GetPreference(PreferenceKind.BlockedTags);+ ExcludeInheritedTags = user.GetPreference(PreferenceKind.BlockedTags);- User = user;- }+ User = user;}- public Dictionary<string, string> HasAnyProviderId { get; set; }+ public Dictionary<string, string>? HasAnyProviderId { get; set; }public Guid[] AlbumArtistIds { get; set; }@@ -356,8 +353,8 @@ namespace MediaBrowser.Controller.Entitiespublic int? MinWidth { get; set; }- public string SearchTerm { get; set; }+ public string? SearchTerm { get; set; }- public string SeriesTimerId { get; set; }+ public string? SeriesTimerId { get; set; }}}