2021-05-06 22:39:20 +00:00
|
|
|
#nullable disable
|
|
|
|
|
2020-11-15 16:03:27 +00:00
|
|
|
using System;
|
2020-11-13 14:13:32 +00:00
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Threading;
|
|
|
|
using MediaBrowser.Controller.Session;
|
|
|
|
using MediaBrowser.Model.SyncPlay;
|
|
|
|
|
2020-11-14 22:40:01 +00:00
|
|
|
namespace MediaBrowser.Controller.SyncPlay.PlaybackRequests
|
2020-11-13 14:13:32 +00:00
|
|
|
{
|
|
|
|
/// <summary>
|
|
|
|
/// Class RemoveFromPlaylistGroupRequest.
|
|
|
|
/// </summary>
|
2020-11-28 15:03:02 +00:00
|
|
|
public class RemoveFromPlaylistGroupRequest : AbstractPlaybackRequest
|
2020-11-13 14:13:32 +00:00
|
|
|
{
|
2020-11-14 22:40:01 +00:00
|
|
|
/// <summary>
|
|
|
|
/// Initializes a new instance of the <see cref="RemoveFromPlaylistGroupRequest"/> class.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="items">The playlist ids of the items to remove.</param>
|
2021-01-24 00:05:17 +00:00
|
|
|
/// <param name="clearPlaylist">Whether to clear the entire playlist. The items list will be ignored.</param>
|
|
|
|
/// <param name="clearPlayingItem">Whether to remove the playing item as well. Used only when clearing the playlist.</param>
|
|
|
|
public RemoveFromPlaylistGroupRequest(IReadOnlyList<Guid> items, bool clearPlaylist = false, bool clearPlayingItem = false)
|
2020-11-14 22:40:01 +00:00
|
|
|
{
|
2020-12-04 19:15:16 +00:00
|
|
|
PlaylistItemIds = items ?? Array.Empty<Guid>();
|
2021-01-24 00:05:17 +00:00
|
|
|
ClearPlaylist = clearPlaylist;
|
|
|
|
ClearPlayingItem = clearPlayingItem;
|
2020-11-14 22:40:01 +00:00
|
|
|
}
|
|
|
|
|
2020-11-13 14:13:32 +00:00
|
|
|
/// <summary>
|
2022-08-15 10:48:34 +00:00
|
|
|
/// Gets the playlist identifiers of the items.
|
2020-11-13 14:13:32 +00:00
|
|
|
/// </summary>
|
2022-08-15 10:48:34 +00:00
|
|
|
/// <value>The playlist identifiers of the items.</value>
|
2020-12-04 19:15:16 +00:00
|
|
|
public IReadOnlyList<Guid> PlaylistItemIds { get; }
|
2020-11-13 14:13:32 +00:00
|
|
|
|
2021-01-24 00:05:17 +00:00
|
|
|
/// <summary>
|
|
|
|
/// Gets a value indicating whether the entire playlist should be cleared.
|
|
|
|
/// </summary>
|
|
|
|
/// <value>Whether the entire playlist should be cleared.</value>
|
|
|
|
public bool ClearPlaylist { get; }
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Gets a value indicating whether the playing item should be removed as well.
|
|
|
|
/// </summary>
|
|
|
|
/// <value>Whether the playing item should be removed as well.</value>
|
|
|
|
public bool ClearPlayingItem { get; }
|
|
|
|
|
2020-11-13 14:13:32 +00:00
|
|
|
/// <inheritdoc />
|
2020-11-28 15:03:02 +00:00
|
|
|
public override PlaybackRequestType Action { get; } = PlaybackRequestType.RemoveFromPlaylist;
|
2020-11-13 14:13:32 +00:00
|
|
|
|
|
|
|
/// <inheritdoc />
|
2020-11-28 15:03:02 +00:00
|
|
|
public override void Apply(IGroupStateContext context, IGroupState state, SessionInfo session, CancellationToken cancellationToken)
|
2020-11-13 14:13:32 +00:00
|
|
|
{
|
2020-12-04 22:16:15 +00:00
|
|
|
state.HandleRequest(this, context, state.Type, session, cancellationToken);
|
2020-11-13 14:13:32 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|