diff options
| author | Nyanmisaka <nst799610810@gmail.com> | 2020-04-10 22:08:49 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-04-10 22:08:49 +0800 |
| commit | bfd87829e3bca42a245287b99e652d091b21c990 (patch) | |
| tree | b71b307057aef887401932259f0ee875f5aa6746 /Emby.Server.Implementations/Dto/DtoService.cs | |
| parent | 645363810370504361cecd5ce4c529343ed28833 (diff) | |
| parent | ec2e9d52badbce6d0c46abd2a14b77f215cfb4b0 (diff) | |
Merge pull request #2 from jellyfin/master
merge
Diffstat (limited to 'Emby.Server.Implementations/Dto/DtoService.cs')
| -rw-r--r-- | Emby.Server.Implementations/Dto/DtoService.cs | 19 |
1 files changed, 4 insertions, 15 deletions
diff --git a/Emby.Server.Implementations/Dto/DtoService.cs b/Emby.Server.Implementations/Dto/DtoService.cs index 65711e89d..34a342cf7 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(); - } - + allExtras = item.GetExtras().ToArray(); dto.SpecialFeatureCount = allExtras.Count(i => i.ExtraType.HasValue && BaseItem.DisplayExtraTypes.Contains(i.ExtraType.Value)); } 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 ??= item.GetExtras().ToArray(); + dto.LocalTrailerCount = allExtras.Count(i => i.ExtraType == ExtraType.Trailer); if (item is IHasTrailers hasTrailers) { - trailerCount += hasTrailers.GetTrailerCount(); + dto.LocalTrailerCount += hasTrailers.GetTrailerCount(); } - - dto.LocalTrailerCount = trailerCount; } // Add EpisodeInfo |
