From fde84a1e00b0c781ce10acc73a9103db51aab67b Mon Sep 17 00:00:00 2001 From: cvium Date: Tue, 7 Dec 2021 15:18:17 +0100 Subject: Refactor extras parsing --- MediaBrowser.Controller/Entities/IHasTrailers.cs | 68 ++---------------------- 1 file changed, 4 insertions(+), 64 deletions(-) (limited to 'MediaBrowser.Controller/Entities/IHasTrailers.cs') diff --git a/MediaBrowser.Controller/Entities/IHasTrailers.cs b/MediaBrowser.Controller/Entities/IHasTrailers.cs index f4271678d..bb4a6ea94 100644 --- a/MediaBrowser.Controller/Entities/IHasTrailers.cs +++ b/MediaBrowser.Controller/Entities/IHasTrailers.cs @@ -2,7 +2,6 @@ #pragma warning disable CS1591 -using System; using System.Collections.Generic; using MediaBrowser.Model.Entities; @@ -17,18 +16,10 @@ namespace MediaBrowser.Controller.Entities IReadOnlyList RemoteTrailers { get; set; } /// - /// Gets or sets the local trailer ids. + /// Gets the local trailers. /// - /// The local trailer ids. - IReadOnlyList LocalTrailerIds { get; set; } - - /// - /// Gets or sets the remote trailer ids. - /// - /// The remote trailer ids. - IReadOnlyList RemoteTrailerIds { get; set; } - - Guid Id { get; set; } + /// The local trailers. + IReadOnlyList LocalTrailers { get; } } /// @@ -42,57 +33,6 @@ namespace MediaBrowser.Controller.Entities /// Media item. /// . public static int GetTrailerCount(this IHasTrailers item) - => item.LocalTrailerIds.Count + item.RemoteTrailerIds.Count; - - /// - /// Gets the trailer ids. - /// - /// Media item. - /// . - public static IReadOnlyList GetTrailerIds(this IHasTrailers item) - { - var localIds = item.LocalTrailerIds; - var remoteIds = item.RemoteTrailerIds; - - var all = new Guid[localIds.Count + remoteIds.Count]; - var index = 0; - foreach (var id in localIds) - { - all[index++] = id; - } - - foreach (var id in remoteIds) - { - all[index++] = id; - } - - return all; - } - - /// - /// Gets the trailers. - /// - /// Media item. - /// . - public static IReadOnlyList GetTrailers(this IHasTrailers item) - { - var localIds = item.LocalTrailerIds; - var remoteIds = item.RemoteTrailerIds; - var libraryManager = BaseItem.LibraryManager; - - var all = new BaseItem[localIds.Count + remoteIds.Count]; - var index = 0; - foreach (var id in localIds) - { - all[index++] = libraryManager.GetItemById(id); - } - - foreach (var id in remoteIds) - { - all[index++] = libraryManager.GetItemById(id); - } - - return all; - } + => item.LocalTrailers.Count + item.RemoteTrailers.Count; } } -- cgit v1.2.3