From 662929fe8b544346de688dfe4c9626db128c7b6b Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sat, 22 Mar 2014 12:31:21 -0400 Subject: [PATCH] remove primary version flag --- MediaBrowser.Model/Dto/MediaVersionInfo.cs | 2 -- .../Dto/DtoService.cs | 15 ++++++--------- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/MediaBrowser.Model/Dto/MediaVersionInfo.cs b/MediaBrowser.Model/Dto/MediaVersionInfo.cs index 4dfb32dd5..ddb340787 100644 --- a/MediaBrowser.Model/Dto/MediaVersionInfo.cs +++ b/MediaBrowser.Model/Dto/MediaVersionInfo.cs @@ -22,7 +22,5 @@ namespace MediaBrowser.Model.Dto public Video3DFormat? Video3DFormat { get; set; } public List MediaStreams { get; set; } - - public bool IsPrimaryVersion { get; set; } } } diff --git a/MediaBrowser.Server.Implementations/Dto/DtoService.cs b/MediaBrowser.Server.Implementations/Dto/DtoService.cs index 2c8069880..66a9284d7 100644 --- a/MediaBrowser.Server.Implementations/Dto/DtoService.cs +++ b/MediaBrowser.Server.Implementations/Dto/DtoService.cs @@ -1132,7 +1132,7 @@ namespace MediaBrowser.Server.Implementations.Dto if (dto.MediaSources != null && dto.MediaSources.Count > 0) { - mediaStreams = dto.MediaSources.Where(i => i.IsPrimaryVersion) + mediaStreams = dto.MediaSources.Where(i => new Guid(i.Id) == item.Id) .SelectMany(i => i.MediaStreams) .ToList(); } @@ -1269,9 +1269,9 @@ namespace MediaBrowser.Server.Implementations.Dto private List GetMediaSources(Video item) { - var result = item.GetAlternateVersions().Select(i => GetVersionInfo(i, false)).ToList(); + var result = item.GetAlternateVersions().Select(GetVersionInfo).ToList(); - result.Add(GetVersionInfo(item, true)); + result.Add(GetVersionInfo(item)); return result.OrderBy(i => { @@ -1289,7 +1289,6 @@ namespace MediaBrowser.Server.Implementations.Dto return stream == null || stream.Width == null ? 0 : stream.Width.Value; }) - .ThenBy(i => i.IsPrimaryVersion ? 0 : 1) .ToList(); } @@ -1303,7 +1302,7 @@ namespace MediaBrowser.Server.Implementations.Dto return result; } - private MediaSourceInfo GetVersionInfo(Video i, bool isPrimary) + private MediaSourceInfo GetVersionInfo(Video i) { var mediaStreams = _itemRepo.GetMediaStreams(new MediaStreamQuery { ItemId = i.Id }).ToList(); @@ -1317,8 +1316,7 @@ namespace MediaBrowser.Server.Implementations.Dto Path = GetMappedPath(i), RunTimeTicks = i.RunTimeTicks, Video3DFormat = i.Video3DFormat, - VideoType = i.VideoType, - IsPrimaryVersion = isPrimary + VideoType = i.VideoType }; } @@ -1331,8 +1329,7 @@ namespace MediaBrowser.Server.Implementations.Dto MediaStreams = _itemRepo.GetMediaStreams(new MediaStreamQuery { ItemId = i.Id }).ToList(), Name = i.Name, Path = GetMappedPath(i), - RunTimeTicks = i.RunTimeTicks, - IsPrimaryVersion = isPrimary + RunTimeTicks = i.RunTimeTicks }; }