Minor fixes

pull/3194/head
Ionut Andrei Oanca 4 years ago
parent 93cbf64f88
commit 36fee4e60a

@ -129,7 +129,7 @@ namespace Emby.Server.Implementations.SyncPlay
/// <summary>
/// Checks if a session is in this group.
/// </summary>
/// <param name="sessionId">The session id to check.</param>
/// <param name="sessionId">The session identifier to check.</param>
/// <returns><c>true</c> if the session is in this group; <c>false</c> otherwise.</returns>
private bool ContainsSession(string sessionId)
{
@ -509,7 +509,7 @@ namespace Emby.Server.Implementations.SyncPlay
return false;
}
// Check is participants can access the new playing queue.
// Check if participants can access the new playing queue.
if (!AllUsersHaveAccessToQueue(playQueue))
{
return false;
@ -583,7 +583,7 @@ namespace Emby.Server.Implementations.SyncPlay
return false;
}
// Check is participants can access the new playing queue.
// Check if participants can access the new playing queue.
if (!AllUsersHaveAccessToQueue(newItems))
{
return false;

@ -72,7 +72,7 @@ namespace MediaBrowser.Controller.SyncPlay
context.LastActivity = currentTime;
// Seek only if playback actually started.
// Pause request may be issued during the delay added to account for latency.
context.PositionTicks += elapsedTime.Ticks > 0 ? elapsedTime.Ticks : 0;
context.PositionTicks += Math.Max(elapsedTime.Ticks, 0);
var command = context.NewSyncPlayCommand(SendCommandType.Pause);
context.SendCommand(session, SyncPlayBroadcastType.AllGroup, command, cancellationToken);

@ -61,7 +61,7 @@ namespace MediaBrowser.Controller.SyncPlay
context.LastActivity = currentTime;
// Seek only if playback actually started.
// Event may happen during the delay added to account for latency.
context.PositionTicks += elapsedTime.Ticks > 0 ? elapsedTime.Ticks : 0;
context.PositionTicks += Math.Max(elapsedTime.Ticks, 0);
}
// Prepare new session.
@ -151,7 +151,7 @@ namespace MediaBrowser.Controller.SyncPlay
var update = context.NewSyncPlayGroupUpdate(GroupUpdateType.PlayQueue, playQueueUpdate);
context.SendGroupUpdate(session, SyncPlayBroadcastType.AllGroup, update, cancellationToken);
// Reset status of sessions and await for all Ready events before sending Play command.
// Reset status of sessions and await for all Ready events.
context.SetAllBuffering(true);
_logger.LogDebug("HandleRequest: {0} in group {1}, {2} set a new play queue.", request.GetRequestType(), context.GroupId.ToString(), session.Id.ToString());
@ -176,7 +176,7 @@ namespace MediaBrowser.Controller.SyncPlay
var update = context.NewSyncPlayGroupUpdate(GroupUpdateType.PlayQueue, playQueueUpdate);
context.SendGroupUpdate(session, SyncPlayBroadcastType.AllGroup, update, cancellationToken);
// Reset status of sessions and await for all Ready events before sending Play command.
// Reset status of sessions and await for all Ready events.
context.SetAllBuffering(true);
}
else
@ -221,7 +221,7 @@ namespace MediaBrowser.Controller.SyncPlay
var update = context.NewSyncPlayGroupUpdate(GroupUpdateType.PlayQueue, playQueueUpdate);
context.SendGroupUpdate(session, SyncPlayBroadcastType.AllGroup, update, cancellationToken);
// Reset status of sessions and await for all Ready events before sending Play command.
// Reset status of sessions and await for all Ready events.
context.SetAllBuffering(true);
_logger.LogDebug("HandleRequest: {0} in group {1}, waiting for all ready events.", request.GetRequestType(), context.GroupId.ToString());
@ -314,7 +314,7 @@ namespace MediaBrowser.Controller.SyncPlay
var command = context.NewSyncPlayCommand(SendCommandType.Seek);
context.SendCommand(session, SyncPlayBroadcastType.AllGroup, command, cancellationToken);
// Reset status of sessions and await for all Ready events before sending Play command.
// Reset status of sessions and await for all Ready events.
context.SetAllBuffering(true);
// Notify relevant state change event.
@ -355,7 +355,7 @@ namespace MediaBrowser.Controller.SyncPlay
var currentTime = DateTime.UtcNow;
var elapsedTime = currentTime - context.LastActivity;
context.LastActivity = currentTime;
context.PositionTicks += elapsedTime.Ticks > 0 ? elapsedTime.Ticks : 0;
context.PositionTicks += Math.Max(elapsedTime.Ticks, 0);
// Send pause command to all non-buffering sessions.
var command = context.NewSyncPlayCommand(SendCommandType.Pause);
@ -559,7 +559,7 @@ namespace MediaBrowser.Controller.SyncPlay
// Make sure the client knows the playing item, to avoid duplicate requests.
if (!request.PlaylistItemId.Equals(context.PlayQueue.GetPlayingItemPlaylistId()))
{
_logger.LogDebug("HandleRequest: {0} in group {1}, client provided the wrong playlist id.", request.GetRequestType(), context.GroupId.ToString());
_logger.LogDebug("HandleRequest: {0} in group {1}, client provided the wrong playlist identifier.", request.GetRequestType(), context.GroupId.ToString());
return;
}
@ -571,7 +571,7 @@ namespace MediaBrowser.Controller.SyncPlay
var update = context.NewSyncPlayGroupUpdate(GroupUpdateType.PlayQueue, playQueueUpdate);
context.SendGroupUpdate(session, SyncPlayBroadcastType.AllGroup, update, cancellationToken);
// Reset status of sessions and await for all Ready events before sending Play command.
// Reset status of sessions and await for all Ready events.
context.SetAllBuffering(true);
}
else
@ -612,7 +612,7 @@ namespace MediaBrowser.Controller.SyncPlay
// Make sure the client knows the playing item, to avoid duplicate requests.
if (!request.PlaylistItemId.Equals(context.PlayQueue.GetPlayingItemPlaylistId()))
{
_logger.LogDebug("HandleRequest: {0} in group {1}, client provided the wrong playlist id.", request.GetRequestType(), context.GroupId.ToString());
_logger.LogDebug("HandleRequest: {0} in group {1}, client provided the wrong playlist identifier.", request.GetRequestType(), context.GroupId.ToString());
return;
}
@ -624,7 +624,7 @@ namespace MediaBrowser.Controller.SyncPlay
var update = context.NewSyncPlayGroupUpdate(GroupUpdateType.PlayQueue, playQueueUpdate);
context.SendGroupUpdate(session, SyncPlayBroadcastType.AllGroup, update, cancellationToken);
// Reset status of sessions and await for all Ready events before sending Play command.
// Reset status of sessions and await for all Ready events.
context.SetAllBuffering(true);
}
else

@ -26,7 +26,7 @@ namespace MediaBrowser.Controller.SyncPlay
/// <summary>
/// Checks if the group is empty.
/// </summary>
/// <returns>If the group is empty.</returns>
/// <returns><c>true</c> if the group is empty, <c>false</c> otherwise</returns>
bool IsGroupEmpty();
/// <summary>

@ -23,7 +23,7 @@ namespace MediaBrowser.Controller.SyncPlay
/// Adds the session to a group.
/// </summary>
/// <param name="session">The session.</param>
/// <param name="groupId">The group id.</param>
/// <param name="groupId">The group identifier.</param>
/// <param name="request">The request.</param>
/// <param name="cancellationToken">The cancellation token.</param>
void JoinGroup(SessionInfo session, Guid groupId, JoinGroupRequest request, CancellationToken cancellationToken);

@ -16,7 +16,7 @@ namespace MediaBrowser.Controller.SyncPlay
GroupState GetGroupState();
/// <summary>
/// Handle a session that joined the group.
/// Handles a session that joined the group.
/// </summary>
/// <param name="context">The context of the state.</param>
/// <param name="prevState">The previous state.</param>
@ -25,7 +25,7 @@ namespace MediaBrowser.Controller.SyncPlay
void SessionJoined(ISyncPlayStateContext context, GroupState prevState, SessionInfo session, CancellationToken cancellationToken);
/// <summary>
/// Handle a session that is leaving the group.
/// Handles a session that is leaving the group.
/// </summary>
/// <param name="context">The context of the state.</param>
/// <param name="prevState">The previous state.</param>

@ -71,7 +71,7 @@ namespace MediaBrowser.Controller.SyncPlay
/// Builds a new playback command with some default values.
/// </summary>
/// <param name="type">The command type.</param>
/// <returns>The SendCommand.</returns>
/// <returns>The command.</returns>
SendCommand NewSyncPlayCommand(SendCommandType type);
/// <summary>
@ -79,7 +79,7 @@ namespace MediaBrowser.Controller.SyncPlay
/// </summary>
/// <param name="type">The update type.</param>
/// <param name="data">The data to send.</param>
/// <returns>The GroupUpdate.</returns>
/// <returns>The group update.</returns>
GroupUpdate<T> NewSyncPlayGroupUpdate<T>(GroupUpdateType type, T data);
/// <summary>
@ -93,7 +93,7 @@ namespace MediaBrowser.Controller.SyncPlay
/// Sanitizes the PositionTicks, considers the current playing item when available.
/// </summary>
/// <param name="positionTicks">The PositionTicks.</param>
/// <returns>The sanitized PositionTicks.</returns>
/// <returns>The sanitized position ticks.</returns>
long SanitizePositionTicks(long? positionTicks);
/// <summary>
@ -141,14 +141,14 @@ namespace MediaBrowser.Controller.SyncPlay
/// <param name="playQueue">The new play queue.</param>
/// <param name="playingItemPosition">The playing item position in the play queue.</param>
/// <param name="startPositionTicks">The start position ticks.</param>
/// <returns><c>true</c> if the play queue has been changed; <c>false</c> is something went wrong.</returns>
/// <returns><c>true</c> if the play queue has been changed; <c>false</c> if something went wrong.</returns>
bool SetPlayQueue(Guid[] playQueue, int playingItemPosition, long startPositionTicks);
/// <summary>
/// Sets the playing item.
/// </summary>
/// <param name="playlistItemId">The new playing item id.</param>
/// <returns><c>true</c> if the play queue has been changed; <c>false</c> is something went wrong.</returns>
/// <param name="playlistItemId">The new playing item identifier.</param>
/// <returns><c>true</c> if the play queue has been changed; <c>false</c> if something went wrong.</returns>
bool SetPlayingItem(string playlistItemId);
/// <summary>
@ -161,9 +161,9 @@ namespace MediaBrowser.Controller.SyncPlay
/// <summary>
/// Moves an item in the play queue.
/// </summary>
/// <param name="playlistItemId">The playlist id of the item to move.</param>
/// <param name="playlistItemId">The playlist identifier of the item to move.</param>
/// <param name="newIndex">The new position.</param>
/// <returns><c>true</c> if item has been moved; <c>false</c> is something went wrong.</returns>
/// <returns><c>true</c> if item has been moved; <c>false</c> if something went wrong.</returns>
bool MoveItemInPlayQueue(string playlistItemId, int newIndex);
/// <summary>
@ -171,7 +171,7 @@ namespace MediaBrowser.Controller.SyncPlay
/// </summary>
/// <param name="newItems">The new items to add to the play queue.</param>
/// <param name="mode">The mode with which the items will be added.</param>
/// <returns><c>true</c> if the play queue has been changed; <c>false</c> is something went wrong.</returns>
/// <returns><c>true</c> if the play queue has been changed; <c>false</c> if something went wrong.</returns>
bool AddToPlayQueue(Guid[] newItems, string mode);
/// <summary>

@ -6,7 +6,7 @@ using MediaBrowser.Controller.Session;
namespace MediaBrowser.Controller.SyncPlay
{
/// <summary>
/// Class BufferingGroupRequest.
/// Class BufferGroupRequest.
/// </summary>
public class BufferGroupRequest : IPlaybackGroupRequest
{
@ -29,9 +29,9 @@ namespace MediaBrowser.Controller.SyncPlay
public bool IsPlaying { get; set; }
/// <summary>
/// Gets or sets the playlist item id of the playing item.
/// Gets or sets the playlist item identifier of the playing item.
/// </summary>
/// <value>The playlist item id.</value>
/// <value>The playlist item identifier.</value>
public string PlaylistItemId { get; set; }
/// <inheritdoc />

@ -10,9 +10,9 @@ namespace MediaBrowser.Controller.SyncPlay
public class MovePlaylistItemGroupRequest : IPlaybackGroupRequest
{
/// <summary>
/// Gets or sets the playlist id of the item.
/// Gets or sets the playlist identifier of the item.
/// </summary>
/// <value>The playlist id of the item.</value>
/// <value>The playlist identifier of the item.</value>
public string PlaylistItemId { get; set; }
/// <summary>
@ -24,7 +24,7 @@ namespace MediaBrowser.Controller.SyncPlay
/// <inheritdoc />
public PlaybackRequestType GetRequestType()
{
return PlaybackRequestType.Queue;
return PlaybackRequestType.MovePlaylistItem;
}
/// <inheritdoc />

@ -10,9 +10,9 @@ namespace MediaBrowser.Controller.SyncPlay
public class NextTrackGroupRequest : IPlaybackGroupRequest
{
/// <summary>
/// Gets or sets the playing item id.
/// Gets or sets the playing item identifier.
/// </summary>
/// <value>The playing item id.</value>
/// <value>The playing item identifier.</value>
public string PlaylistItemId { get; set; }
/// <inheritdoc />

@ -5,7 +5,7 @@ using MediaBrowser.Controller.Session;
namespace MediaBrowser.Controller.SyncPlay
{
/// <summary>
/// Class UpdatePingGroupRequest.
/// Class PingGroupRequest.
/// </summary>
public class PingGroupRequest : IPlaybackGroupRequest
{

@ -10,9 +10,9 @@ namespace MediaBrowser.Controller.SyncPlay
public class PreviousTrackGroupRequest : IPlaybackGroupRequest
{
/// <summary>
/// Gets or sets the playing item id.
/// Gets or sets the playing item identifier.
/// </summary>
/// <value>The playing item id.</value>
/// <value>The playing item identifier.</value>
public string PlaylistItemId { get; set; }
/// <inheritdoc />

@ -6,7 +6,7 @@ using MediaBrowser.Controller.Session;
namespace MediaBrowser.Controller.SyncPlay
{
/// <summary>
/// Class BufferingDoneGroupRequest.
/// Class ReadyGroupRequest.
/// </summary>
public class ReadyGroupRequest : IPlaybackGroupRequest
{
@ -29,9 +29,9 @@ namespace MediaBrowser.Controller.SyncPlay
public bool IsPlaying { get; set; }
/// <summary>
/// Gets or sets the playlist item id of the playing item.
/// Gets or sets the playlist item identifier of the playing item.
/// </summary>
/// <value>The playlist item id.</value>
/// <value>The playlist item identifier.</value>
public string PlaylistItemId { get; set; }
/// <inheritdoc />

@ -10,15 +10,15 @@ namespace MediaBrowser.Controller.SyncPlay
public class RemoveFromPlaylistGroupRequest : IPlaybackGroupRequest
{
/// <summary>
/// Gets or sets the playlist ids ot the items.
/// Gets or sets the playlist identifiers ot the items.
/// </summary>
/// <value>The playlist ids ot the items.</value>
/// <value>The playlist identifiers ot the items.</value>
public string[] PlaylistItemIds { get; set; }
/// <inheritdoc />
public PlaybackRequestType GetRequestType()
{
return PlaybackRequestType.Queue;
return PlaybackRequestType.RemoveFromPlaylist;
}
/// <inheritdoc />

@ -10,9 +10,9 @@ namespace MediaBrowser.Controller.SyncPlay
public class SetPlaylistItemGroupRequest : IPlaybackGroupRequest
{
/// <summary>
/// Gets or sets the playlist id of the playing item.
/// Gets or sets the playlist identifier of the playing item.
/// </summary>
/// <value>The playlist id of the playing item.</value>
/// <value>The playlist identifier of the playing item.</value>
public string PlaylistItemId { get; set; }
/// <inheritdoc />

@ -64,9 +64,9 @@ namespace MediaBrowser.Controller.SyncPlay
public GroupRepeatMode RepeatMode { get; private set; } = GroupRepeatMode.RepeatNone;
/// <summary>
/// Gets or sets the progressive id counter.
/// Gets or sets the progressive identifier counter.
/// </summary>
/// <value>The progressive id.</value>
/// <value>The progressive identifier.</value>
private int ProgressiveId { get; set; } = 0;
private bool _disposed = false;
@ -101,15 +101,15 @@ namespace MediaBrowser.Controller.SyncPlay
}
/// <summary>
/// Gets the next available id.
/// Gets the next available identifier.
/// </summary>
/// <returns>The next available id.</returns>
/// <returns>The next available identifier.</returns>
private int GetNextProgressiveId() {
return ProgressiveId++;
}
/// <summary>
/// Creates a list from the array of items. Each item is given an unique playlist id.
/// Creates a list from the array of items. Each item is given an unique playlist identifier.
/// </summary>
/// <returns>The list of queue items.</returns>
private List<QueueItem> CreateQueueItemsFromArray(Guid[] items)
@ -276,9 +276,9 @@ namespace MediaBrowser.Controller.SyncPlay
}
/// <summary>
/// Gets playlist id of the playing item, if any.
/// Gets playlist identifier of the playing item, if any.
/// </summary>
/// <returns>The playlist id of the playing item.</returns>
/// <returns>The playlist identifier of the playing item.</returns>
public string GetPlayingItemPlaylistId()
{
if (PlayingItemIndex < 0)
@ -299,9 +299,9 @@ namespace MediaBrowser.Controller.SyncPlay
}
/// <summary>
/// Gets the playing item id, if any.
/// Gets the playing item identifier, if any.
/// </summary>
/// <returns>The playing item id.</returns>
/// <returns>The playing item identifier.</returns>
public Guid GetPlayingItemId()
{
if (PlayingItemIndex < 0)
@ -322,9 +322,9 @@ namespace MediaBrowser.Controller.SyncPlay
}
/// <summary>
/// Sets the playing item using its id. If not in the playlist, the playing item is reset.
/// Sets the playing item using its identifier. If not in the playlist, the playing item is reset.
/// </summary>
/// <param name="itemId">The new playing item id.</param>
/// <param name="itemId">The new playing item identifier.</param>
public void SetPlayingItemById(Guid itemId)
{
var itemIds = GetPlaylistAsList().Select(queueItem => queueItem.ItemId).ToList();
@ -333,9 +333,9 @@ namespace MediaBrowser.Controller.SyncPlay
}
/// <summary>
/// Sets the playing item using its playlist id. If not in the playlist, the playing item is reset.
/// Sets the playing item using its playlist identifier. If not in the playlist, the playing item is reset.
/// </summary>
/// <param name="playlistItemId">The new playing item id.</param>
/// <param name="playlistItemId">The new playing item identifier.</param>
/// <returns><c>true</c> if playing item has been set; <c>false</c> if item is not in the playlist.</returns>
public bool SetPlayingItemByPlaylistId(string playlistItemId)
{

@ -31,7 +31,7 @@ namespace MediaBrowser.Model.SyncPlay
StateUpdate,
/// <summary>
/// The play-queue update. Tells a user what's the playing queue of the group.
/// The play-queue update. Tells a user the playing queue of the group.
/// </summary>
PlayQueue,

@ -8,9 +8,9 @@ namespace MediaBrowser.Model.SyncPlay
public class JoinGroupRequest
{
/// <summary>
/// Gets or sets the group id.
/// Gets or sets the group identifier.
/// </summary>
/// <value>The id of the group to join.</value>
/// <value>The identifier of the group to join.</value>
public Guid GroupId { get; set; }
}
}

@ -10,15 +10,15 @@ namespace MediaBrowser.Model.SyncPlay
public class QueueItem
{
/// <summary>
/// Gets or sets the item id.
/// Gets or sets the item identifier.
/// </summary>
/// <value>The item id.</value>
/// <value>The item identifier.</value>
public Guid ItemId { get; set; }
/// <summary>
/// Gets or sets the playlist id of the item.
/// Gets or sets the playlist identifier of the item.
/// </summary>
/// <value>The playlist id of the item.</value>
/// <value>The playlist identifier of the item.</value>
public string PlaylistItemId { get; set; }
}
}

@ -14,9 +14,9 @@ namespace MediaBrowser.Model.SyncPlay
public string GroupId { get; set; }
/// <summary>
/// Gets or sets the playlist id of the playing item.
/// Gets or sets the playlist identifier of the playing item.
/// </summary>
/// <value>The playlist id of the playing item.</value>
/// <value>The playlist identifier of the playing item.</value>
public string PlaylistItemId { get; set; }
/// <summary>

Loading…
Cancel
Save