aboutsummaryrefslogtreecommitdiff
path: root/Emby.Server.Implementations/Playlists
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2017-08-10 14:01:31 -0400
committerLuke Pulverenti <luke.pulverenti@gmail.com>2017-08-10 14:01:31 -0400
commite7425e6205fd9accb768084503c5174e820eaf7d (patch)
tree8ea3c573aa2223a141fa0b6e414a9d330c828cc5 /Emby.Server.Implementations/Playlists
parentc147b64de86f2245ff11087f21738a290f876065 (diff)
revert servicestack.text update
Diffstat (limited to 'Emby.Server.Implementations/Playlists')
-rw-r--r--Emby.Server.Implementations/Playlists/PlaylistManager.cs23
1 files changed, 14 insertions, 9 deletions
diff --git a/Emby.Server.Implementations/Playlists/PlaylistManager.cs b/Emby.Server.Implementations/Playlists/PlaylistManager.cs
index e0e133e38d..578a2321cc 100644
--- a/Emby.Server.Implementations/Playlists/PlaylistManager.cs
+++ b/Emby.Server.Implementations/Playlists/PlaylistManager.cs
@@ -12,10 +12,9 @@ using System.IO;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
-
using MediaBrowser.Controller.Dto;
-using MediaBrowser.Controller.IO;
using MediaBrowser.Model.IO;
+using MediaBrowser.Model.Extensions;
namespace Emby.Server.Implementations.Playlists
{
@@ -164,7 +163,7 @@ namespace Emby.Server.Implementations.Playlists
return path;
}
- private IEnumerable<BaseItem> GetPlaylistItems(IEnumerable<string> itemIds, string playlistMediaType, User user, DtoOptions options)
+ private List<BaseItem> GetPlaylistItems(IEnumerable<string> itemIds, string playlistMediaType, User user, DtoOptions options)
{
var items = itemIds.Select(i => _libraryManager.GetItemById(i)).Where(i => i != null);
@@ -206,7 +205,9 @@ namespace Emby.Server.Implementations.Playlists
list.Add(LinkedChild.Create(item));
}
- playlist.LinkedChildren.AddRange(list);
+ var newList = playlist.LinkedChildren.ToList();
+ newList.AddRange(list);
+ playlist.LinkedChildren = newList.ToArray(newList.Count);
await playlist.UpdateToRepository(ItemUpdateType.MetadataEdit, CancellationToken.None).ConfigureAwait(false);
@@ -234,7 +235,7 @@ namespace Emby.Server.Implementations.Playlists
playlist.LinkedChildren = children.Except(removals)
.Select(i => i.Item1)
- .ToList();
+ .ToArray();
await playlist.UpdateToRepository(ItemUpdateType.MetadataEdit, CancellationToken.None).ConfigureAwait(false);
@@ -265,17 +266,21 @@ namespace Emby.Server.Implementations.Playlists
var item = playlist.LinkedChildren[oldIndex];
- playlist.LinkedChildren.Remove(item);
+ var newList = playlist.LinkedChildren.ToList();
- if (newIndex >= playlist.LinkedChildren.Count)
+ newList.Remove(item);
+
+ if (newIndex >= newList.Count)
{
- playlist.LinkedChildren.Add(item);
+ newList.Add(item);
}
else
{
- playlist.LinkedChildren.Insert(newIndex, item);
+ newList.Insert(newIndex, item);
}
+ playlist.LinkedChildren = newList.ToArray(newList.Count);
+
await playlist.UpdateToRepository(ItemUpdateType.MetadataEdit, CancellationToken.None).ConfigureAwait(false);
}