diff --git a/MediaBrowser.Controller/Entities/Folder.cs b/MediaBrowser.Controller/Entities/Folder.cs index 07fbe6035..17786fc9a 100644 --- a/MediaBrowser.Controller/Entities/Folder.cs +++ b/MediaBrowser.Controller/Entities/Folder.cs @@ -809,9 +809,17 @@ namespace MediaBrowser.Controller.Entities public QueryResult GetItems(InternalItemsQuery query) { - if (query.ItemIds.Length > 0) + if (query.ItemIds.Length > 1) { - return LibraryManager.GetItemsResult(query); + var result = LibraryManager.GetItemsResult(query); + + if (query.OrderBy.Count == 0) + { + var ids = query.ItemIds.ToList(); + // Try to preserve order, "Play To" relies on it + result.Items = result.Items.OrderBy(i => ids.IndexOf(i.Id)).ToArray(); + } + return result; } return GetItemsInternal(query); @@ -821,9 +829,17 @@ namespace MediaBrowser.Controller.Entities { query.EnableTotalRecordCount = false; - if (query.ItemIds.Length > 0) + if (query.ItemIds.Length > 1) { - return LibraryManager.GetItemList(query); + var result = LibraryManager.GetItemList(query); + + if (query.OrderBy.Count == 0) + { + var ids = query.ItemIds.ToList(); + // Try to preserve order, "Play To" relies on it + return result.OrderBy(i => ids.IndexOf(i.Id)).ToArray(); + } + return result.ToArray(); } return GetItemsInternal(query).Items;