diff options
| author | Patrick Barron <barronpm@gmail.com> | 2020-04-05 17:58:39 -0400 |
|---|---|---|
| committer | Patrick Barron <barronpm@gmail.com> | 2020-04-05 17:58:39 -0400 |
| commit | 81b4a4c54c63822692cd3936fc3c7d8d6e45397c (patch) | |
| tree | c0b4093a156fd0d9879d3841ed86bb4ed3e17cd8 /MediaBrowser.Api/VideosService.cs | |
| parent | e1958e3902ae81931c82a31f355cefc2b02a8a2d (diff) | |
Implement various suggestions
Diffstat (limited to 'MediaBrowser.Api/VideosService.cs')
| -rw-r--r-- | MediaBrowser.Api/VideosService.cs | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/MediaBrowser.Api/VideosService.cs b/MediaBrowser.Api/VideosService.cs index 76e9f421d..b11fd48d3 100644 --- a/MediaBrowser.Api/VideosService.cs +++ b/MediaBrowser.Api/VideosService.cs @@ -138,15 +138,23 @@ namespace MediaBrowser.Api var videosWithVersions = items.Where(i => i.MediaSourceCount > 1) .ToList(); - var primaryVersion = videosWithVersions.FirstOrDefault() ?? items.OrderBy(i - => (i.Video3DFormat.HasValue || i.VideoType != Model.Entities.VideoType.VideoFile) ? 1 : 0) - .ThenByDescending(i => - { - var stream = i.GetDefaultVideoStream(); - - return stream?.Width ?? 0; - - }).First(); + var primaryVersion = videosWithVersions.FirstOrDefault(); + if (primaryVersion == null) + { + primaryVersion = items.OrderBy(i => + { + if (i.Video3DFormat.HasValue || i.VideoType != Model.Entities.VideoType.VideoFile) + { + return 1; + } + + return 0; + }) + .ThenByDescending(i => + { + return i.GetDefaultVideoStream()?.Width ?? 0; + }).First(); + } var list = primaryVersion.LinkedAlternateVersions.ToList(); |
