diff options
| author | stefan <stefan@hegedues.at> | 2018-09-12 19:26:21 +0200 |
|---|---|---|
| committer | stefan <stefan@hegedues.at> | 2018-09-12 19:26:21 +0200 |
| commit | 48facb797ed912e4ea6b04b17d1ff190ac2daac4 (patch) | |
| tree | 8dae77a31670a888d733484cb17dd4077d5444e8 /Emby.Server.Implementations/TV/TVSeriesManager.cs | |
| parent | c32d8656382a0eacb301692e0084377fc433ae9b (diff) | |
Update to 3.5.2 and .net core 2.1
Diffstat (limited to 'Emby.Server.Implementations/TV/TVSeriesManager.cs')
| -rw-r--r-- | Emby.Server.Implementations/TV/TVSeriesManager.cs | 38 |
1 files changed, 20 insertions, 18 deletions
diff --git a/Emby.Server.Implementations/TV/TVSeriesManager.cs b/Emby.Server.Implementations/TV/TVSeriesManager.cs index d92245a677..1f9cb91645 100644 --- a/Emby.Server.Implementations/TV/TVSeriesManager.cs +++ b/Emby.Server.Implementations/TV/TVSeriesManager.cs @@ -37,48 +37,50 @@ namespace Emby.Server.Implementations.TV } string presentationUniqueKey = null; - int? limit = null; - if (!string.IsNullOrWhiteSpace(request.SeriesId)) + if (!string.IsNullOrEmpty(request.SeriesId)) { var series = _libraryManager.GetItemById(request.SeriesId) as Series; if (series != null) { presentationUniqueKey = GetUniqueSeriesKey(series); - limit = 1; } } - if (!string.IsNullOrWhiteSpace(presentationUniqueKey)) + if (!string.IsNullOrEmpty(presentationUniqueKey)) { return GetResult(GetNextUpEpisodes(request, user, new[] { presentationUniqueKey }, dtoOptions), request); } - var parentIdGuid = string.IsNullOrWhiteSpace(request.ParentId) ? (Guid?)null : new Guid(request.ParentId); + var parentIdGuid = string.IsNullOrEmpty(request.ParentId) ? (Guid?)null : new Guid(request.ParentId); - List<BaseItem> parents; + BaseItem[] parents; if (parentIdGuid.HasValue) { var parent = _libraryManager.GetItemById(parentIdGuid.Value); - parents = new List<BaseItem>(); + if (parent != null) { - parents.Add(parent); + parents = new[] { parent }; + } + else + { + parents = Array.Empty<BaseItem>(); } } else { - parents = user.RootFolder.GetChildren(user, true) + parents = _libraryManager.GetUserRootFolder().GetChildren(user, true) .Where(i => i is Folder) .Where(i => !user.Configuration.LatestItemsExcludes.Contains(i.Id.ToString("N"))) - .ToList(); + .ToArray(); } return GetNextUp(request, parents, dtoOptions); } - public QueryResult<BaseItem> GetNextUp(NextUpQuery request, List<BaseItem> parentsFolders, DtoOptions dtoOptions) + public QueryResult<BaseItem> GetNextUp(NextUpQuery request, BaseItem[] parentsFolders, DtoOptions dtoOptions) { var user = _userManager.GetUserById(request.UserId); @@ -89,7 +91,7 @@ namespace Emby.Server.Implementations.TV string presentationUniqueKey = null; int? limit = null; - if (!string.IsNullOrWhiteSpace(request.SeriesId)) + if (!string.IsNullOrEmpty(request.SeriesId)) { var series = _libraryManager.GetItemById(request.SeriesId) as Series; @@ -100,7 +102,7 @@ namespace Emby.Server.Implementations.TV } } - if (!string.IsNullOrWhiteSpace(presentationUniqueKey)) + if (!string.IsNullOrEmpty(presentationUniqueKey)) { return GetResult(GetNextUpEpisodes(request, user, new[] { presentationUniqueKey }, dtoOptions), request); } @@ -113,7 +115,7 @@ namespace Emby.Server.Implementations.TV var items = _libraryManager.GetItemList(new InternalItemsQuery(user) { IncludeItemTypes = new[] { typeof(Episode).Name }, - OrderBy = new[] { new Tuple<string, SortOrder>(ItemSortBy.DatePlayed, SortOrder.Descending) }, + OrderBy = new[] { new ValueTuple<string, SortOrder>(ItemSortBy.DatePlayed, SortOrder.Descending) }, SeriesPresentationUniqueKey = presentationUniqueKey, Limit = limit, DtoOptions = new MediaBrowser.Controller.Dto.DtoOptions @@ -126,7 +128,7 @@ namespace Emby.Server.Implementations.TV }, GroupBySeriesPresentationUniqueKey = true - }, parentsFolders).Cast<Episode>().Select(GetUniqueSeriesKey); + }, parentsFolders.ToList()).Cast<Episode>().Select(GetUniqueSeriesKey); // Avoid implicitly captured closure var episodes = GetNextUpEpisodes(request, user, items, dtoOptions); @@ -146,7 +148,7 @@ namespace Emby.Server.Implementations.TV // If viewing all next up for all series, remove first episodes // But if that returns empty, keep those first episodes (avoid completely empty view) - var alwaysEnableFirstEpisode = !string.IsNullOrWhiteSpace(request.SeriesId); + var alwaysEnableFirstEpisode = !string.IsNullOrEmpty(request.SeriesId); var anyFound = false; return allNextUp @@ -190,7 +192,7 @@ namespace Emby.Server.Implementations.TV AncestorWithPresentationUniqueKey = null, SeriesPresentationUniqueKey = seriesKey, IncludeItemTypes = new[] { typeof(Episode).Name }, - OrderBy = new[] { new Tuple<string, SortOrder>(ItemSortBy.SortName, SortOrder.Descending) }, + OrderBy = new[] { new ValueTuple<string, SortOrder>(ItemSortBy.SortName, SortOrder.Descending) }, IsPlayed = true, Limit = 1, ParentIndexNumberNotEquals = 0, @@ -212,7 +214,7 @@ namespace Emby.Server.Implementations.TV AncestorWithPresentationUniqueKey = null, SeriesPresentationUniqueKey = seriesKey, IncludeItemTypes = new[] { typeof(Episode).Name }, - OrderBy = new[] { new Tuple<string, SortOrder>(ItemSortBy.SortName, SortOrder.Ascending) }, + OrderBy = new[] { new ValueTuple<string, SortOrder>(ItemSortBy.SortName, SortOrder.Ascending) }, Limit = 1, IsPlayed = false, IsVirtualItem = false, |
