jellyfin/MediaBrowser.Controller/SyncPlay/PlaybackRequests/RemoveFromPlaylistGroupRequest.cs

57 lines
2.3 KiB
C#
Raw Normal View History

#nullable disable
using System;
using System.Collections.Generic;
using System.Threading;
using MediaBrowser.Controller.Session;
using MediaBrowser.Model.SyncPlay;
namespace MediaBrowser.Controller.SyncPlay.PlaybackRequests
{
/// <summary>
/// Class RemoveFromPlaylistGroupRequest.
/// </summary>
public class RemoveFromPlaylistGroupRequest : AbstractPlaybackRequest
{
/// <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-12-04 19:15:16 +00:00
PlaylistItemIds = items ?? Array.Empty<Guid>();
2021-01-24 00:05:17 +00:00
ClearPlaylist = clearPlaylist;
ClearPlayingItem = clearPlayingItem;
}
/// <summary>
/// Gets the playlist identifiers of the items.
/// </summary>
/// <value>The playlist identifiers of the items.</value>
2020-12-04 19:15:16 +00:00
public IReadOnlyList<Guid> PlaylistItemIds { get; }
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; }
/// <inheritdoc />
public override PlaybackRequestType Action { get; } = PlaybackRequestType.RemoveFromPlaylist;
/// <inheritdoc />
public override void Apply(IGroupStateContext context, IGroupState state, SessionInfo session, CancellationToken cancellationToken)
{
2020-12-04 22:16:15 +00:00
state.HandleRequest(this, context, state.Type, session, cancellationToken);
}
}
}