aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Controller/Entities/BaseItem.cs
diff options
context:
space:
mode:
authorMark Monteiro <marknr.monteiro@protonmail.com>2020-03-28 14:17:33 +0100
committerMark Monteiro <marknr.monteiro@protonmail.com>2020-03-28 14:17:33 +0100
commite266ad51c52763f11a2eab9ac86f638542a4ddb0 (patch)
treed0f352914003d9ca32d76d6ae91c9676a702f7eb /MediaBrowser.Controller/Entities/BaseItem.cs
parentea306e8f6d28e4c4acb78ee7208508d329473414 (diff)
Simplify logic; remove unnecessary methods
Diffstat (limited to 'MediaBrowser.Controller/Entities/BaseItem.cs')
-rw-r--r--MediaBrowser.Controller/Entities/BaseItem.cs32
1 files changed, 5 insertions, 27 deletions
diff --git a/MediaBrowser.Controller/Entities/BaseItem.cs b/MediaBrowser.Controller/Entities/BaseItem.cs
index 66917e442..2424293fe 100644
--- a/MediaBrowser.Controller/Entities/BaseItem.cs
+++ b/MediaBrowser.Controller/Entities/BaseItem.cs
@@ -2895,14 +2895,13 @@ namespace MediaBrowser.Controller.Entities
/// Get all extras with specific types that are associated with this item.
/// </summary>
/// <param name="extraTypes">The types of extras to retrieve.</param>
- /// <param name="includeUnknownTypes">If true, include extras whose type could not be determined.</param>
/// <returns>An enumerable containing the extras.</returns>
- public IEnumerable<BaseItem> GetExtras(IReadOnlyCollection<ExtraType> extraTypes, bool includeUnknownTypes)
+ public IEnumerable<BaseItem> GetExtras(IReadOnlyCollection<ExtraType?> extraTypes)
{
return ExtraIds
.Select(LibraryManager.GetItemById)
.Where(i => i != null)
- .Where(i => i.HasExtraType(extraTypes, includeUnknownTypes));
+ .Where(i => extraTypes.Contains(i.ExtraType));
}
public IEnumerable<BaseItem> GetTrailers()
@@ -2913,29 +2912,6 @@ namespace MediaBrowser.Controller.Entities
return Array.Empty<BaseItem>();
}
- /// <summary>
- /// Get all extras associated with this item that should be displayed as "Special Features" in the UI. This is
- /// all extras with either an unknown type, or a type contained in <see cref="DisplayExtraTypes"/>.
- /// </summary>
- /// <returns>An IEnumerable containing the extra items.</returns>
- public IEnumerable<BaseItem> GetDisplayExtras()
- {
- return GetExtras(DisplayExtraTypes, true);
- }
-
- /// <summary>
- /// Check if this item is an extra with a type that matches a given set.
- /// </summary>
- /// <param name="extraTypes">The types of extras to match with.</param>
- /// <param name="includeUnknownTypes">If true, include extras whose type could not be determined.</param>
- /// <returns>True if this item matches, otherwise false.</returns>
- public bool HasExtraType(IReadOnlyCollection<ExtraType> extraTypes, bool includeUnknownTypes)
- {
- return
- (includeUnknownTypes && (ExtraType == null || ExtraType == 0))
- || (ExtraType.HasValue && extraTypes.Contains(ExtraType.Value));
- }
-
public virtual bool IsHD => Height >= 720;
public bool IsShortcut { get; set; }
@@ -2956,8 +2932,10 @@ namespace MediaBrowser.Controller.Entities
/// <summary>
/// Extra types that should be counted and displayed as "Special Features" in the UI.
/// </summary>
- public static readonly IReadOnlyCollection<ExtraType> DisplayExtraTypes = new HashSet<ExtraType>
+ public static readonly IReadOnlyCollection<ExtraType?> DisplayExtraTypes = new HashSet<ExtraType?>
{
+ null,
+ 0,
Model.Entities.ExtraType.BehindTheScenes,
Model.Entities.ExtraType.Clip,
Model.Entities.ExtraType.DeletedScene,