aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Server.Implementations/Playlists
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2014-08-06 00:18:13 -0400
committerLuke Pulverenti <luke.pulverenti@gmail.com>2014-08-06 00:18:13 -0400
commit284bd3e9f562ae499ad8d8b778392196ac99ed3a (patch)
tree09282153a5db75bc70ef2fa61ab528c97ac87a1e /MediaBrowser.Server.Implementations/Playlists
parente3c52b6f73d938033d5d4d5db1284a2367c75ecd (diff)
updated nuget
Diffstat (limited to 'MediaBrowser.Server.Implementations/Playlists')
-rw-r--r--MediaBrowser.Server.Implementations/Playlists/PlaylistManager.cs24
1 files changed, 22 insertions, 2 deletions
diff --git a/MediaBrowser.Server.Implementations/Playlists/PlaylistManager.cs b/MediaBrowser.Server.Implementations/Playlists/PlaylistManager.cs
index 79b673283d..6ab306c0ba 100644
--- a/MediaBrowser.Server.Implementations/Playlists/PlaylistManager.cs
+++ b/MediaBrowser.Server.Implementations/Playlists/PlaylistManager.cs
@@ -190,9 +190,29 @@ namespace MediaBrowser.Server.Implementations.Playlists
}, CancellationToken.None).ConfigureAwait(false);
}
- public Task RemoveFromPlaylist(string playlistId, IEnumerable<int> indeces)
+ public async Task RemoveFromPlaylist(string playlistId, IEnumerable<string> entryIds)
{
- throw new NotImplementedException();
+ var playlist = _libraryManager.GetItemById(playlistId) as Playlist;
+
+ if (playlist == null)
+ {
+ throw new ArgumentException("No Playlist exists with the supplied Id");
+ }
+
+ var children = playlist.LinkedChildren.ToList();
+
+ var idList = entryIds.ToList();
+
+ var removals = children.Where(i => idList.Contains(i.Id));
+
+ playlist.LinkedChildren = children.Except(removals)
+ .ToList();
+
+ await playlist.UpdateToRepository(ItemUpdateType.MetadataEdit, CancellationToken.None).ConfigureAwait(false);
+ await playlist.RefreshMetadata(new MetadataRefreshOptions
+ {
+ ForceSave = true
+ }, CancellationToken.None).ConfigureAwait(false);
}
public Folder GetPlaylistsFolder(string userId)