aboutsummaryrefslogtreecommitdiff
path: root/Emby.Server.Implementations
diff options
context:
space:
mode:
authorMark Monteiro <marknr.monteiro@protonmail.com>2020-03-28 13:40:56 +0100
committerMark Monteiro <marknr.monteiro@protonmail.com>2020-03-28 13:40:56 +0100
commit5fcbedc194a7a8a7a8026a69b44f8192120d14e1 (patch)
tree5e054f3b0bd2650d479debfebb0b7687c223acac /Emby.Server.Implementations
parentbd4269cb5914bd9e90aaa508fa63f4d7e47e7397 (diff)
Display extras with an unknown type
Diffstat (limited to 'Emby.Server.Implementations')
-rw-r--r--Emby.Server.Implementations/Dto/DtoService.cs21
1 files changed, 5 insertions, 16 deletions
diff --git a/Emby.Server.Implementations/Dto/DtoService.cs b/Emby.Server.Implementations/Dto/DtoService.cs
index 65711e89d..a10e17f6a 100644
--- a/Emby.Server.Implementations/Dto/DtoService.cs
+++ b/Emby.Server.Implementations/Dto/DtoService.cs
@@ -1056,30 +1056,19 @@ namespace Emby.Server.Implementations.Dto
if (options.ContainsField(ItemFields.SpecialFeatureCount))
{
- if (allExtras == null)
- {
- allExtras = item.GetExtras().ToArray();
- }
-
- dto.SpecialFeatureCount = allExtras.Count(i => i.ExtraType.HasValue && BaseItem.DisplayExtraTypes.Contains(i.ExtraType.Value));
+ allExtras = item.GetExtras().ToArray();
+ dto.SpecialFeatureCount = allExtras.Count(i => i.HasExtraType(BaseItem.DisplayExtraTypes, true));
}
if (options.ContainsField(ItemFields.LocalTrailerCount))
{
- int trailerCount = 0;
- if (allExtras == null)
- {
- allExtras = item.GetExtras().ToArray();
- }
-
- trailerCount += allExtras.Count(i => i.ExtraType.HasValue && i.ExtraType.Value == ExtraType.Trailer);
+ allExtras = allExtras ?? item.GetExtras().ToArray();
+ dto.LocalTrailerCount = allExtras.Count(i => i.HasExtraType(new[] { ExtraType.Trailer }, false));
if (item is IHasTrailers hasTrailers)
{
- trailerCount += hasTrailers.GetTrailerCount();
+ dto.LocalTrailerCount += hasTrailers.GetTrailerCount();
}
-
- dto.LocalTrailerCount = trailerCount;
}
// Add EpisodeInfo