| | 1 | | #nullable disable |
| | 2 | |
|
| | 3 | | using System; |
| | 4 | | using System.Collections.Generic; |
| | 5 | | using System.Threading; |
| | 6 | | using MediaBrowser.Controller.Session; |
| | 7 | | using MediaBrowser.Model.SyncPlay; |
| | 8 | |
|
| | 9 | | namespace MediaBrowser.Controller.SyncPlay.PlaybackRequests |
| | 10 | | { |
| | 11 | | /// <summary> |
| | 12 | | /// Class RemoveFromPlaylistGroupRequest. |
| | 13 | | /// </summary> |
| | 14 | | public class RemoveFromPlaylistGroupRequest : AbstractPlaybackRequest |
| | 15 | | { |
| | 16 | | /// <summary> |
| | 17 | | /// Initializes a new instance of the <see cref="RemoveFromPlaylistGroupRequest"/> class. |
| | 18 | | /// </summary> |
| | 19 | | /// <param name="items">The playlist ids of the items to remove.</param> |
| | 20 | | /// <param name="clearPlaylist">Whether to clear the entire playlist. The items list will be ignored.</param> |
| | 21 | | /// <param name="clearPlayingItem">Whether to remove the playing item as well. Used only when clearing the playl |
| 0 | 22 | | public RemoveFromPlaylistGroupRequest(IReadOnlyList<Guid> items, bool clearPlaylist = false, bool clearPlayingIt |
| | 23 | | { |
| 0 | 24 | | PlaylistItemIds = items ?? Array.Empty<Guid>(); |
| | 25 | | ClearPlaylist = clearPlaylist; |
| | 26 | | ClearPlayingItem = clearPlayingItem; |
| 0 | 27 | | } |
| | 28 | |
|
| | 29 | | /// <summary> |
| | 30 | | /// Gets the playlist identifiers of the items. |
| | 31 | | /// </summary> |
| | 32 | | /// <value>The playlist identifiers of the items.</value> |
| | 33 | | public IReadOnlyList<Guid> PlaylistItemIds { get; } |
| | 34 | |
|
| | 35 | | /// <summary> |
| | 36 | | /// Gets a value indicating whether the entire playlist should be cleared. |
| | 37 | | /// </summary> |
| | 38 | | /// <value>Whether the entire playlist should be cleared.</value> |
| | 39 | | public bool ClearPlaylist { get; } |
| | 40 | |
|
| | 41 | | /// <summary> |
| | 42 | | /// Gets a value indicating whether the playing item should be removed as well. |
| | 43 | | /// </summary> |
| | 44 | | /// <value>Whether the playing item should be removed as well.</value> |
| | 45 | | public bool ClearPlayingItem { get; } |
| | 46 | |
|
| | 47 | | /// <inheritdoc /> |
| | 48 | | public override PlaybackRequestType Action { get; } = PlaybackRequestType.RemoveFromPlaylist; |
| | 49 | |
|
| | 50 | | /// <inheritdoc /> |
| | 51 | | public override void Apply(IGroupStateContext context, IGroupState state, SessionInfo session, CancellationToken |
| | 52 | | { |
| 0 | 53 | | state.HandleRequest(this, context, state.Type, session, cancellationToken); |
| 0 | 54 | | } |
| | 55 | | } |
| | 56 | | } |