diff --git a/Emby.Server.Implementations/Library/MusicManager.cs b/Emby.Server.Implementations/Library/MusicManager.cs index c83737cec2..3f29099471 100644 --- a/Emby.Server.Implementations/Library/MusicManager.cs +++ b/Emby.Server.Implementations/Library/MusicManager.cs @@ -34,7 +34,7 @@ namespace Emby.Server.Implementations.Library list.AddRange(GetInstantMixFromGenres(item.Genres, user, dtoOptions)); - return list.ToImmutableList(); + return [.. list]; } /// diff --git a/Jellyfin.Api/Controllers/InstantMixController.cs b/Jellyfin.Api/Controllers/InstantMixController.cs index e9dda19ca7..e89e7ce26c 100644 --- a/Jellyfin.Api/Controllers/InstantMixController.cs +++ b/Jellyfin.Api/Controllers/InstantMixController.cs @@ -393,21 +393,17 @@ public class InstantMixController : BaseJellyfinApiController private QueryResult GetResult(IReadOnlyList items, User? user, int? limit, DtoOptions dtoOptions) { - var list = items; + var totalCount = items.Count; - var totalCount = list.Count; - - if (limit.HasValue && limit < list.Count) + if (limit.HasValue && limit < items.Count) { - list = list.Take(limit.Value).ToImmutableArray(); + items = items.Take(limit.Value).ToImmutableArray(); } - var returnList = _dtoService.GetBaseItemDtos(list, dtoOptions, user); - var result = new QueryResult( 0, totalCount, - returnList); + _dtoService.GetBaseItemDtos(items, dtoOptions, user)); return result; } diff --git a/MediaBrowser.Controller/LiveTv/LiveTvChannel.cs b/MediaBrowser.Controller/LiveTv/LiveTvChannel.cs index 64d49d8c48..b10e77e10a 100644 --- a/MediaBrowser.Controller/LiveTv/LiveTvChannel.cs +++ b/MediaBrowser.Controller/LiveTv/LiveTvChannel.cs @@ -120,13 +120,10 @@ namespace MediaBrowser.Controller.LiveTv return "TvChannel"; } - public IEnumerable GetTaggedItems() - => Enumerable.Empty(); + public IEnumerable GetTaggedItems() => []; public override IReadOnlyList GetMediaSources(bool enablePathSubstitution) { - var list = new List(); - var info = new MediaSourceInfo { Id = Id.ToString("N", CultureInfo.InvariantCulture), @@ -139,9 +136,7 @@ namespace MediaBrowser.Controller.LiveTv IsInfiniteStream = RunTimeTicks is null }; - list.Add(info); - - return list.ToImmutableList(); + return [info]; } public override IReadOnlyList GetMediaStreams()