Rename Syncplay to SyncPlay

This commit is contained in:
gion 2020-05-06 23:42:53 +02:00
parent 6e22e9222b
commit 8a6ec2fb71
22 changed files with 166 additions and 166 deletions

View File

@ -47,7 +47,7 @@ using Emby.Server.Implementations.Session;
using Emby.Server.Implementations.SocketSharp;
using Emby.Server.Implementations.TV;
using Emby.Server.Implementations.Updates;
using Emby.Server.Implementations.Syncplay;
using Emby.Server.Implementations.SyncPlay;
using MediaBrowser.Api;
using MediaBrowser.Common;
using MediaBrowser.Common.Configuration;
@ -81,7 +81,7 @@ using MediaBrowser.Controller.Session;
using MediaBrowser.Controller.Sorting;
using MediaBrowser.Controller.Subtitles;
using MediaBrowser.Controller.TV;
using MediaBrowser.Controller.Syncplay;
using MediaBrowser.Controller.SyncPlay;
using MediaBrowser.LocalMetadata.Savers;
using MediaBrowser.MediaEncoding.BdInfo;
using MediaBrowser.Model.Activity;
@ -645,7 +645,7 @@ namespace Emby.Server.Implementations
serviceCollection.AddSingleton<IPlaylistManager, PlaylistManager>();
serviceCollection.AddSingleton<ISyncplayManager, SyncplayManager>();
serviceCollection.AddSingleton<ISyncPlayManager, SyncPlayManager>();
serviceCollection.AddSingleton<LiveTvDtoService>();
serviceCollection.AddSingleton<ILiveTvManager, LiveTvManager>();

View File

@ -25,7 +25,7 @@ using MediaBrowser.Model.Events;
using MediaBrowser.Model.Library;
using MediaBrowser.Model.Querying;
using MediaBrowser.Model.Session;
using MediaBrowser.Model.Syncplay;
using MediaBrowser.Model.SyncPlay;
using Microsoft.Extensions.Logging;
namespace Emby.Server.Implementations.Session
@ -1156,19 +1156,19 @@ namespace Emby.Server.Implementations.Session
}
/// <inheritdoc />
public async Task SendSyncplayCommand(string sessionId, SendCommand command, CancellationToken cancellationToken)
public async Task SendSyncPlayCommand(string sessionId, SendCommand command, CancellationToken cancellationToken)
{
CheckDisposed();
var session = GetSessionToRemoteControl(sessionId);
await SendMessageToSession(session, "SyncplayCommand", command, cancellationToken).ConfigureAwait(false);
await SendMessageToSession(session, "SyncPlayCommand", command, cancellationToken).ConfigureAwait(false);
}
/// <inheritdoc />
public async Task SendSyncplayGroupUpdate<T>(string sessionId, GroupUpdate<T> command, CancellationToken cancellationToken)
public async Task SendSyncPlayGroupUpdate<T>(string sessionId, GroupUpdate<T> command, CancellationToken cancellationToken)
{
CheckDisposed();
var session = GetSessionToRemoteControl(sessionId);
await SendMessageToSession(session, "SyncplayGroupUpdate", command, cancellationToken).ConfigureAwait(false);
await SendMessageToSession(session, "SyncPlayGroupUpdate", command, cancellationToken).ConfigureAwait(false);
}
private IEnumerable<BaseItem> TranslateItemForPlayback(Guid id, User user)

View File

@ -4,19 +4,19 @@ using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using MediaBrowser.Controller.Session;
using MediaBrowser.Controller.Syncplay;
using MediaBrowser.Controller.SyncPlay;
using MediaBrowser.Model.Session;
using MediaBrowser.Model.Syncplay;
using MediaBrowser.Model.SyncPlay;
namespace Emby.Server.Implementations.Syncplay
namespace Emby.Server.Implementations.SyncPlay
{
/// <summary>
/// Class SyncplayController.
/// Class SyncPlayController.
/// </summary>
/// <remarks>
/// Class is not thread-safe, external locking is required when accessing methods.
/// </remarks>
public class SyncplayController : ISyncplayController, IDisposable
public class SyncPlayController : ISyncPlayController, IDisposable
{
/// <summary>
/// Used to filter the sessions of a group.
@ -47,9 +47,9 @@ namespace Emby.Server.Implementations.Syncplay
private readonly ISessionManager _sessionManager;
/// <summary>
/// The syncplay manager.
/// The SyncPlay manager.
/// </summary>
private readonly ISyncplayManager _syncplayManager;
private readonly ISyncPlayManager _syncPlayManager;
/// <summary>
/// The group to manage.
@ -67,12 +67,12 @@ namespace Emby.Server.Implementations.Syncplay
private bool _disposed = false;
public SyncplayController(
public SyncPlayController(
ISessionManager sessionManager,
ISyncplayManager syncplayManager)
ISyncPlayManager syncPlayManager)
{
_sessionManager = sessionManager;
_syncplayManager = syncplayManager;
_syncPlayManager = syncPlayManager;
}
/// <inheritdoc />
@ -163,7 +163,7 @@ namespace Emby.Server.Implementations.Syncplay
SessionInfo[] sessions = FilterSessions(from, type);
foreach (var session in sessions)
{
yield return _sessionManager.SendSyncplayGroupUpdate(session.Id.ToString(), message, cancellationToken);
yield return _sessionManager.SendSyncPlayGroupUpdate(session.Id.ToString(), message, cancellationToken);
}
}
@ -185,7 +185,7 @@ namespace Emby.Server.Implementations.Syncplay
SessionInfo[] sessions = FilterSessions(from, type);
foreach (var session in sessions)
{
yield return _sessionManager.SendSyncplayCommand(session.Id.ToString(), message, cancellationToken);
yield return _sessionManager.SendSyncPlayCommand(session.Id.ToString(), message, cancellationToken);
}
}
@ -197,7 +197,7 @@ namespace Emby.Server.Implementations.Syncplay
/// </summary>
/// <param name="type">The command type.</param>
/// <value>The SendCommand.</value>
private SendCommand NewSyncplayCommand(SendCommandType type)
private SendCommand NewSyncPlayCommand(SendCommandType type)
{
return new SendCommand()
{
@ -215,7 +215,7 @@ namespace Emby.Server.Implementations.Syncplay
/// <param name="type">The update type.</param>
/// <param name="data">The data to send.</param>
/// <value>The GroupUpdate.</value>
private GroupUpdate<T> NewSyncplayGroupUpdate<T>(GroupUpdateType type, T data)
private GroupUpdate<T> NewSyncPlayGroupUpdate<T>(GroupUpdateType type, T data)
{
return new GroupUpdate<T>()
{
@ -229,16 +229,16 @@ namespace Emby.Server.Implementations.Syncplay
public void InitGroup(SessionInfo session, CancellationToken cancellationToken)
{
_group.AddSession(session);
_syncplayManager.AddSessionToGroup(session, this);
_syncPlayManager.AddSessionToGroup(session, this);
_group.PlayingItem = session.FullNowPlayingItem;
_group.IsPaused = true;
_group.PositionTicks = session.PlayState.PositionTicks ?? 0;
_group.LastActivity = DateTime.UtcNow;
var updateSession = NewSyncplayGroupUpdate(GroupUpdateType.GroupJoined, DateToUTCString(DateTime.UtcNow));
var updateSession = NewSyncPlayGroupUpdate(GroupUpdateType.GroupJoined, DateToUTCString(DateTime.UtcNow));
SendGroupUpdate(session, BroadcastType.CurrentSession, updateSession, cancellationToken);
var pauseCommand = NewSyncplayCommand(SendCommandType.Pause);
var pauseCommand = NewSyncPlayCommand(SendCommandType.Pause);
SendCommand(session, BroadcastType.CurrentSession, pauseCommand, cancellationToken);
}
@ -248,23 +248,23 @@ namespace Emby.Server.Implementations.Syncplay
if (session.NowPlayingItem?.Id == _group.PlayingItem.Id && request.PlayingItemId == _group.PlayingItem.Id)
{
_group.AddSession(session);
_syncplayManager.AddSessionToGroup(session, this);
_syncPlayManager.AddSessionToGroup(session, this);
var updateSession = NewSyncplayGroupUpdate(GroupUpdateType.GroupJoined, DateToUTCString(DateTime.UtcNow));
var updateSession = NewSyncPlayGroupUpdate(GroupUpdateType.GroupJoined, DateToUTCString(DateTime.UtcNow));
SendGroupUpdate(session, BroadcastType.CurrentSession, updateSession, cancellationToken);
var updateOthers = NewSyncplayGroupUpdate(GroupUpdateType.UserJoined, session.UserName);
var updateOthers = NewSyncPlayGroupUpdate(GroupUpdateType.UserJoined, session.UserName);
SendGroupUpdate(session, BroadcastType.AllExceptCurrentSession, updateOthers, cancellationToken);
// Client join and play, syncing will happen client side
if (!_group.IsPaused)
{
var playCommand = NewSyncplayCommand(SendCommandType.Play);
var playCommand = NewSyncPlayCommand(SendCommandType.Play);
SendCommand(session, BroadcastType.CurrentSession, playCommand, cancellationToken);
}
else
{
var pauseCommand = NewSyncplayCommand(SendCommandType.Pause);
var pauseCommand = NewSyncPlayCommand(SendCommandType.Pause);
SendCommand(session, BroadcastType.CurrentSession, pauseCommand, cancellationToken);
}
}
@ -273,7 +273,7 @@ namespace Emby.Server.Implementations.Syncplay
var playRequest = new PlayRequest();
playRequest.ItemIds = new Guid[] { _group.PlayingItem.Id };
playRequest.StartPositionTicks = _group.PositionTicks;
var update = NewSyncplayGroupUpdate(GroupUpdateType.PrepareSession, playRequest);
var update = NewSyncPlayGroupUpdate(GroupUpdateType.PrepareSession, playRequest);
SendGroupUpdate(session, BroadcastType.CurrentSession, update, cancellationToken);
}
}
@ -282,12 +282,12 @@ namespace Emby.Server.Implementations.Syncplay
public void SessionLeave(SessionInfo session, CancellationToken cancellationToken)
{
_group.RemoveSession(session);
_syncplayManager.RemoveSessionFromGroup(session, this);
_syncPlayManager.RemoveSessionFromGroup(session, this);
var updateSession = NewSyncplayGroupUpdate(GroupUpdateType.GroupLeft, _group.PositionTicks);
var updateSession = NewSyncPlayGroupUpdate(GroupUpdateType.GroupLeft, _group.PositionTicks);
SendGroupUpdate(session, BroadcastType.CurrentSession, updateSession, cancellationToken);
var updateOthers = NewSyncplayGroupUpdate(GroupUpdateType.UserLeft, session.UserName);
var updateOthers = NewSyncPlayGroupUpdate(GroupUpdateType.UserLeft, session.UserName);
SendGroupUpdate(session, BroadcastType.AllExceptCurrentSession, updateOthers, cancellationToken);
}
@ -344,13 +344,13 @@ namespace Emby.Server.Implementations.Syncplay
delay
);
var command = NewSyncplayCommand(SendCommandType.Play);
var command = NewSyncPlayCommand(SendCommandType.Play);
SendCommand(session, BroadcastType.AllGroup, command, cancellationToken);
}
else
{
// Client got lost, sending current state
var command = NewSyncplayCommand(SendCommandType.Play);
var command = NewSyncPlayCommand(SendCommandType.Play);
SendCommand(session, BroadcastType.CurrentSession, command, cancellationToken);
}
}
@ -374,13 +374,13 @@ namespace Emby.Server.Implementations.Syncplay
// (a pause request may be issued during the delay added to account for latency)
_group.PositionTicks += elapsedTime.Ticks > 0 ? elapsedTime.Ticks : 0;
var command = NewSyncplayCommand(SendCommandType.Pause);
var command = NewSyncPlayCommand(SendCommandType.Pause);
SendCommand(session, BroadcastType.AllGroup, command, cancellationToken);
}
else
{
// Client got lost, sending current state
var command = NewSyncplayCommand(SendCommandType.Pause);
var command = NewSyncPlayCommand(SendCommandType.Pause);
SendCommand(session, BroadcastType.CurrentSession, command, cancellationToken);
}
}
@ -401,7 +401,7 @@ namespace Emby.Server.Implementations.Syncplay
_group.PositionTicks = ticks;
_group.LastActivity = DateTime.UtcNow;
var command = NewSyncplayCommand(SendCommandType.Seek);
var command = NewSyncPlayCommand(SendCommandType.Seek);
SendCommand(session, BroadcastType.AllGroup, command, cancellationToken);
}
@ -425,16 +425,16 @@ namespace Emby.Server.Implementations.Syncplay
_group.SetBuffering(session, true);
// Send pause command to all non-buffering sessions
var command = NewSyncplayCommand(SendCommandType.Pause);
var command = NewSyncPlayCommand(SendCommandType.Pause);
SendCommand(session, BroadcastType.AllReady, command, cancellationToken);
var updateOthers = NewSyncplayGroupUpdate(GroupUpdateType.GroupWait, session.UserName);
var updateOthers = NewSyncPlayGroupUpdate(GroupUpdateType.GroupWait, session.UserName);
SendGroupUpdate(session, BroadcastType.AllExceptCurrentSession, updateOthers, cancellationToken);
}
else
{
// Client got lost, sending current state
var command = NewSyncplayCommand(SendCommandType.Pause);
var command = NewSyncPlayCommand(SendCommandType.Pause);
SendCommand(session, BroadcastType.CurrentSession, command, cancellationToken);
}
}
@ -462,7 +462,7 @@ namespace Emby.Server.Implementations.Syncplay
if (_group.IsBuffering())
{
// Others are still buffering, tell this client to pause when ready
var command = NewSyncplayCommand(SendCommandType.Pause);
var command = NewSyncPlayCommand(SendCommandType.Pause);
var pauseAtTime = currentTime.AddMilliseconds(delay);
command.When = DateToUTCString(pauseAtTime);
SendCommand(session, BroadcastType.CurrentSession, command, cancellationToken);
@ -478,7 +478,7 @@ namespace Emby.Server.Implementations.Syncplay
_group.LastActivity = currentTime.AddMilliseconds(
delay
);
var command = NewSyncplayCommand(SendCommandType.Play);
var command = NewSyncPlayCommand(SendCommandType.Play);
SendCommand(session, BroadcastType.AllExceptCurrentSession, command, cancellationToken);
}
else
@ -491,7 +491,7 @@ namespace Emby.Server.Implementations.Syncplay
delay
);
var command = NewSyncplayCommand(SendCommandType.Play);
var command = NewSyncPlayCommand(SendCommandType.Play);
SendCommand(session, BroadcastType.AllGroup, command, cancellationToken);
}
}
@ -499,7 +499,7 @@ namespace Emby.Server.Implementations.Syncplay
else
{
// Group was not waiting, make sure client has latest state
var command = NewSyncplayCommand(SendCommandType.Play);
var command = NewSyncPlayCommand(SendCommandType.Play);
SendCommand(session, BroadcastType.CurrentSession, command, cancellationToken);
}
}

View File

@ -7,16 +7,16 @@ using Microsoft.Extensions.Logging;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Session;
using MediaBrowser.Controller.Syncplay;
using MediaBrowser.Controller.SyncPlay;
using MediaBrowser.Model.Configuration;
using MediaBrowser.Model.Syncplay;
using MediaBrowser.Model.SyncPlay;
namespace Emby.Server.Implementations.Syncplay
namespace Emby.Server.Implementations.SyncPlay
{
/// <summary>
/// Class SyncplayManager.
/// Class SyncPlayManager.
/// </summary>
public class SyncplayManager : ISyncplayManager, IDisposable
public class SyncPlayManager : ISyncPlayManager, IDisposable
{
/// <summary>
/// The logger.
@ -41,14 +41,14 @@ namespace Emby.Server.Implementations.Syncplay
/// <summary>
/// The map between sessions and groups.
/// </summary>
private readonly Dictionary<string, ISyncplayController> _sessionToGroupMap =
new Dictionary<string, ISyncplayController>(StringComparer.OrdinalIgnoreCase);
private readonly Dictionary<string, ISyncPlayController> _sessionToGroupMap =
new Dictionary<string, ISyncPlayController>(StringComparer.OrdinalIgnoreCase);
/// <summary>
/// The groups.
/// </summary>
private readonly Dictionary<string, ISyncplayController> _groups =
new Dictionary<string, ISyncplayController>(StringComparer.OrdinalIgnoreCase);
private readonly Dictionary<string, ISyncPlayController> _groups =
new Dictionary<string, ISyncPlayController>(StringComparer.OrdinalIgnoreCase);
/// <summary>
/// Lock used for accesing any group.
@ -57,8 +57,8 @@ namespace Emby.Server.Implementations.Syncplay
private bool _disposed = false;
public SyncplayManager(
ILogger<SyncplayManager> logger,
public SyncPlayManager(
ILogger<SyncPlayManager> logger,
IUserManager userManager,
ISessionManager sessionManager,
ILibraryManager libraryManager)
@ -76,7 +76,7 @@ namespace Emby.Server.Implementations.Syncplay
/// Gets all groups.
/// </summary>
/// <value>All groups.</value>
public IEnumerable<ISyncplayController> Groups => _groups.Values;
public IEnumerable<ISyncPlayController> Groups => _groups.Values;
/// <inheritdoc />
public void Dispose()
@ -156,7 +156,7 @@ namespace Emby.Server.Implementations.Syncplay
private Guid? GetSessionGroup(SessionInfo session)
{
ISyncplayController group;
ISyncPlayController group;
_sessionToGroupMap.TryGetValue(session.Id, out group);
if (group != null)
{
@ -173,7 +173,7 @@ namespace Emby.Server.Implementations.Syncplay
{
var user = _userManager.GetUserById(session.UserId);
if (user.Policy.SyncplayAccess != SyncplayAccess.CreateAndJoinGroups)
if (user.Policy.SyncPlayAccess != SyncPlayAccess.CreateAndJoinGroups)
{
_logger.LogWarning("NewGroup: {0} does not have permission to create groups.", session.Id);
@ -181,7 +181,7 @@ namespace Emby.Server.Implementations.Syncplay
{
Type = GroupUpdateType.CreateGroupDenied
};
_sessionManager.SendSyncplayGroupUpdate(session.Id.ToString(), error, CancellationToken.None);
_sessionManager.SendSyncPlayGroupUpdate(session.Id.ToString(), error, CancellationToken.None);
return;
}
@ -192,7 +192,7 @@ namespace Emby.Server.Implementations.Syncplay
LeaveGroup(session, cancellationToken);
}
var group = new SyncplayController(_sessionManager, this);
var group = new SyncPlayController(_sessionManager, this);
_groups[group.GetGroupId().ToString()] = group;
group.InitGroup(session, cancellationToken);
@ -204,21 +204,21 @@ namespace Emby.Server.Implementations.Syncplay
{
var user = _userManager.GetUserById(session.UserId);
if (user.Policy.SyncplayAccess == SyncplayAccess.None)
if (user.Policy.SyncPlayAccess == SyncPlayAccess.None)
{
_logger.LogWarning("JoinGroup: {0} does not have access to Syncplay.", session.Id);
_logger.LogWarning("JoinGroup: {0} does not have access to SyncPlay.", session.Id);
var error = new GroupUpdate<string>()
{
Type = GroupUpdateType.JoinGroupDenied
};
_sessionManager.SendSyncplayGroupUpdate(session.Id.ToString(), error, CancellationToken.None);
_sessionManager.SendSyncPlayGroupUpdate(session.Id.ToString(), error, CancellationToken.None);
return;
}
lock (_groupsLock)
{
ISyncplayController group;
ISyncPlayController group;
_groups.TryGetValue(groupId, out group);
if (group == null)
@ -229,7 +229,7 @@ namespace Emby.Server.Implementations.Syncplay
{
Type = GroupUpdateType.GroupDoesNotExist
};
_sessionManager.SendSyncplayGroupUpdate(session.Id.ToString(), error, CancellationToken.None);
_sessionManager.SendSyncPlayGroupUpdate(session.Id.ToString(), error, CancellationToken.None);
return;
}
@ -242,7 +242,7 @@ namespace Emby.Server.Implementations.Syncplay
GroupId = group.GetGroupId().ToString(),
Type = GroupUpdateType.LibraryAccessDenied
};
_sessionManager.SendSyncplayGroupUpdate(session.Id.ToString(), error, CancellationToken.None);
_sessionManager.SendSyncPlayGroupUpdate(session.Id.ToString(), error, CancellationToken.None);
return;
}
@ -262,7 +262,7 @@ namespace Emby.Server.Implementations.Syncplay
// TODO: determine what happens to users that are in a group and get their permissions revoked
lock (_groupsLock)
{
ISyncplayController group;
ISyncPlayController group;
_sessionToGroupMap.TryGetValue(session.Id, out group);
if (group == null)
@ -273,7 +273,7 @@ namespace Emby.Server.Implementations.Syncplay
{
Type = GroupUpdateType.NotInGroup
};
_sessionManager.SendSyncplayGroupUpdate(session.Id.ToString(), error, CancellationToken.None);
_sessionManager.SendSyncPlayGroupUpdate(session.Id.ToString(), error, CancellationToken.None);
return;
}
@ -292,7 +292,7 @@ namespace Emby.Server.Implementations.Syncplay
{
var user = _userManager.GetUserById(session.UserId);
if (user.Policy.SyncplayAccess == SyncplayAccess.None)
if (user.Policy.SyncPlayAccess == SyncPlayAccess.None)
{
return new List<GroupInfoView>();
}
@ -322,21 +322,21 @@ namespace Emby.Server.Implementations.Syncplay
{
var user = _userManager.GetUserById(session.UserId);
if (user.Policy.SyncplayAccess == SyncplayAccess.None)
if (user.Policy.SyncPlayAccess == SyncPlayAccess.None)
{
_logger.LogWarning("HandleRequest: {0} does not have access to Syncplay.", session.Id);
_logger.LogWarning("HandleRequest: {0} does not have access to SyncPlay.", session.Id);
var error = new GroupUpdate<string>()
{
Type = GroupUpdateType.JoinGroupDenied
};
_sessionManager.SendSyncplayGroupUpdate(session.Id.ToString(), error, CancellationToken.None);
_sessionManager.SendSyncPlayGroupUpdate(session.Id.ToString(), error, CancellationToken.None);
return;
}
lock (_groupsLock)
{
ISyncplayController group;
ISyncPlayController group;
_sessionToGroupMap.TryGetValue(session.Id, out group);
if (group == null)
@ -347,7 +347,7 @@ namespace Emby.Server.Implementations.Syncplay
{
Type = GroupUpdateType.NotInGroup
};
_sessionManager.SendSyncplayGroupUpdate(session.Id.ToString(), error, CancellationToken.None);
_sessionManager.SendSyncPlayGroupUpdate(session.Id.ToString(), error, CancellationToken.None);
return;
}
@ -356,7 +356,7 @@ namespace Emby.Server.Implementations.Syncplay
}
/// <inheritdoc />
public void AddSessionToGroup(SessionInfo session, ISyncplayController group)
public void AddSessionToGroup(SessionInfo session, ISyncPlayController group)
{
if (IsSessionInGroup(session))
{
@ -366,14 +366,14 @@ namespace Emby.Server.Implementations.Syncplay
}
/// <inheritdoc />
public void RemoveSessionFromGroup(SessionInfo session, ISyncplayController group)
public void RemoveSessionFromGroup(SessionInfo session, ISyncPlayController group)
{
if (!IsSessionInGroup(session))
{
throw new InvalidOperationException("Session not in any group!");
}
ISyncplayController tempGroup;
ISyncPlayController tempGroup;
_sessionToGroupMap.Remove(session.Id, out tempGroup);
if (!tempGroup.GetGroupId().Equals(group.GetGroupId()))

View File

@ -4,24 +4,24 @@ using System.Collections.Generic;
using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Net;
using MediaBrowser.Controller.Session;
using MediaBrowser.Controller.Syncplay;
using MediaBrowser.Controller.SyncPlay;
using MediaBrowser.Model.Services;
using MediaBrowser.Model.Syncplay;
using MediaBrowser.Model.SyncPlay;
using Microsoft.Extensions.Logging;
namespace MediaBrowser.Api.Syncplay
namespace MediaBrowser.Api.SyncPlay
{
[Route("/Syncplay/{SessionId}/NewGroup", "POST", Summary = "Create a new Syncplay group")]
[Route("/SyncPlay/{SessionId}/NewGroup", "POST", Summary = "Create a new SyncPlay group")]
[Authenticated]
public class SyncplayNewGroup : IReturnVoid
public class SyncPlayNewGroup : IReturnVoid
{
[ApiMember(Name = "SessionId", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "POST")]
public string SessionId { get; set; }
}
[Route("/Syncplay/{SessionId}/JoinGroup", "POST", Summary = "Join an existing Syncplay group")]
[Route("/SyncPlay/{SessionId}/JoinGroup", "POST", Summary = "Join an existing SyncPlay group")]
[Authenticated]
public class SyncplayJoinGroup : IReturnVoid
public class SyncPlayJoinGroup : IReturnVoid
{
[ApiMember(Name = "SessionId", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "POST")]
public string SessionId { get; set; }
@ -41,17 +41,17 @@ namespace MediaBrowser.Api.Syncplay
public string PlayingItemId { get; set; }
}
[Route("/Syncplay/{SessionId}/LeaveGroup", "POST", Summary = "Leave joined Syncplay group")]
[Route("/SyncPlay/{SessionId}/LeaveGroup", "POST", Summary = "Leave joined SyncPlay group")]
[Authenticated]
public class SyncplayLeaveGroup : IReturnVoid
public class SyncPlayLeaveGroup : IReturnVoid
{
[ApiMember(Name = "SessionId", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "POST")]
public string SessionId { get; set; }
}
[Route("/Syncplay/{SessionId}/ListGroups", "POST", Summary = "List Syncplay groups")]
[Route("/SyncPlay/{SessionId}/ListGroups", "POST", Summary = "List SyncPlay groups")]
[Authenticated]
public class SyncplayListGroups : IReturnVoid
public class SyncPlayListGroups : IReturnVoid
{
[ApiMember(Name = "SessionId", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "POST")]
public string SessionId { get; set; }
@ -64,25 +64,25 @@ namespace MediaBrowser.Api.Syncplay
public string FilterItemId { get; set; }
}
[Route("/Syncplay/{SessionId}/PlayRequest", "POST", Summary = "Request play in Syncplay group")]
[Route("/SyncPlay/{SessionId}/PlayRequest", "POST", Summary = "Request play in SyncPlay group")]
[Authenticated]
public class SyncplayPlayRequest : IReturnVoid
public class SyncPlayPlayRequest : IReturnVoid
{
[ApiMember(Name = "SessionId", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "POST")]
public string SessionId { get; set; }
}
[Route("/Syncplay/{SessionId}/PauseRequest", "POST", Summary = "Request pause in Syncplay group")]
[Route("/SyncPlay/{SessionId}/PauseRequest", "POST", Summary = "Request pause in SyncPlay group")]
[Authenticated]
public class SyncplayPauseRequest : IReturnVoid
public class SyncPlayPauseRequest : IReturnVoid
{
[ApiMember(Name = "SessionId", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "POST")]
public string SessionId { get; set; }
}
[Route("/Syncplay/{SessionId}/SeekRequest", "POST", Summary = "Request seek in Syncplay group")]
[Route("/SyncPlay/{SessionId}/SeekRequest", "POST", Summary = "Request seek in SyncPlay group")]
[Authenticated]
public class SyncplaySeekRequest : IReturnVoid
public class SyncPlaySeekRequest : IReturnVoid
{
[ApiMember(Name = "SessionId", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "POST")]
public string SessionId { get; set; }
@ -91,9 +91,9 @@ namespace MediaBrowser.Api.Syncplay
public long PositionTicks { get; set; }
}
[Route("/Syncplay/{SessionId}/BufferingRequest", "POST", Summary = "Request group wait in Syncplay group while buffering")]
[Route("/SyncPlay/{SessionId}/BufferingRequest", "POST", Summary = "Request group wait in SyncPlay group while buffering")]
[Authenticated]
public class SyncplayBufferingRequest : IReturnVoid
public class SyncPlayBufferingRequest : IReturnVoid
{
[ApiMember(Name = "SessionId", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "POST")]
public string SessionId { get; set; }
@ -116,9 +116,9 @@ namespace MediaBrowser.Api.Syncplay
public bool BufferingDone { get; set; }
}
[Route("/Syncplay/{SessionId}/UpdatePing", "POST", Summary = "Update session ping")]
[Route("/SyncPlay/{SessionId}/UpdatePing", "POST", Summary = "Update session ping")]
[Authenticated]
public class SyncplayUpdatePing : IReturnVoid
public class SyncPlayUpdatePing : IReturnVoid
{
[ApiMember(Name = "SessionId", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "POST")]
public string SessionId { get; set; }
@ -128,9 +128,9 @@ namespace MediaBrowser.Api.Syncplay
}
/// <summary>
/// Class SyncplayService.
/// Class SyncPlayService.
/// </summary>
public class SyncplayService : BaseApiService
public class SyncPlayService : BaseApiService
{
/// <summary>
/// The session context.
@ -138,37 +138,37 @@ namespace MediaBrowser.Api.Syncplay
private readonly ISessionContext _sessionContext;
/// <summary>
/// The Syncplay manager.
/// The SyncPlay manager.
/// </summary>
private readonly ISyncplayManager _syncplayManager;
private readonly ISyncPlayManager _syncPlayManager;
public SyncplayService(
ILogger<SyncplayService> logger,
public SyncPlayService(
ILogger<SyncPlayService> logger,
IServerConfigurationManager serverConfigurationManager,
IHttpResultFactory httpResultFactory,
ISessionContext sessionContext,
ISyncplayManager syncplayManager)
ISyncPlayManager syncPlayManager)
: base(logger, serverConfigurationManager, httpResultFactory)
{
_sessionContext = sessionContext;
_syncplayManager = syncplayManager;
_syncPlayManager = syncPlayManager;
}
/// <summary>
/// Handles the specified request.
/// </summary>
/// <param name="request">The request.</param>
public void Post(SyncplayNewGroup request)
public void Post(SyncPlayNewGroup request)
{
var currentSession = GetSession(_sessionContext);
_syncplayManager.NewGroup(currentSession, CancellationToken.None);
_syncPlayManager.NewGroup(currentSession, CancellationToken.None);
}
/// <summary>
/// Handles the specified request.
/// </summary>
/// <param name="request">The request.</param>
public void Post(SyncplayJoinGroup request)
public void Post(SyncPlayJoinGroup request)
{
var currentSession = GetSession(_sessionContext);
var joinRequest = new JoinGroupRequest()
@ -195,17 +195,17 @@ namespace MediaBrowser.Api.Syncplay
return;
}
}
_syncplayManager.JoinGroup(currentSession, request.GroupId, joinRequest, CancellationToken.None);
_syncPlayManager.JoinGroup(currentSession, request.GroupId, joinRequest, CancellationToken.None);
}
/// <summary>
/// Handles the specified request.
/// </summary>
/// <param name="request">The request.</param>
public void Post(SyncplayLeaveGroup request)
public void Post(SyncPlayLeaveGroup request)
{
var currentSession = GetSession(_sessionContext);
_syncplayManager.LeaveGroup(currentSession, CancellationToken.None);
_syncPlayManager.LeaveGroup(currentSession, CancellationToken.None);
}
/// <summary>
@ -213,7 +213,7 @@ namespace MediaBrowser.Api.Syncplay
/// </summary>
/// <param name="request">The request.</param>
/// <value>The requested list of groups.</value>
public List<GroupInfoView> Post(SyncplayListGroups request)
public List<GroupInfoView> Post(SyncPlayListGroups request)
{
var currentSession = GetSession(_sessionContext);
var filterItemId = Guid.Empty;
@ -232,81 +232,81 @@ namespace MediaBrowser.Api.Syncplay
Logger.LogWarning("ListGroups: {0} is not a valid format for FilterItemId. Ignoring filter.", request.FilterItemId);
}
}
return _syncplayManager.ListGroups(currentSession, filterItemId);
return _syncPlayManager.ListGroups(currentSession, filterItemId);
}
/// <summary>
/// Handles the specified request.
/// </summary>
/// <param name="request">The request.</param>
public void Post(SyncplayPlayRequest request)
public void Post(SyncPlayPlayRequest request)
{
var currentSession = GetSession(_sessionContext);
var syncplayRequest = new PlaybackRequest()
var syncPlayRequest = new PlaybackRequest()
{
Type = PlaybackRequestType.Play
};
_syncplayManager.HandleRequest(currentSession, syncplayRequest, CancellationToken.None);
_syncPlayManager.HandleRequest(currentSession, syncPlayRequest, CancellationToken.None);
}
/// <summary>
/// Handles the specified request.
/// </summary>
/// <param name="request">The request.</param>
public void Post(SyncplayPauseRequest request)
public void Post(SyncPlayPauseRequest request)
{
var currentSession = GetSession(_sessionContext);
var syncplayRequest = new PlaybackRequest()
var syncPlayRequest = new PlaybackRequest()
{
Type = PlaybackRequestType.Pause
};
_syncplayManager.HandleRequest(currentSession, syncplayRequest, CancellationToken.None);
_syncPlayManager.HandleRequest(currentSession, syncPlayRequest, CancellationToken.None);
}
/// <summary>
/// Handles the specified request.
/// </summary>
/// <param name="request">The request.</param>
public void Post(SyncplaySeekRequest request)
public void Post(SyncPlaySeekRequest request)
{
var currentSession = GetSession(_sessionContext);
var syncplayRequest = new PlaybackRequest()
var syncPlayRequest = new PlaybackRequest()
{
Type = PlaybackRequestType.Seek,
PositionTicks = request.PositionTicks
};
_syncplayManager.HandleRequest(currentSession, syncplayRequest, CancellationToken.None);
_syncPlayManager.HandleRequest(currentSession, syncPlayRequest, CancellationToken.None);
}
/// <summary>
/// Handles the specified request.
/// </summary>
/// <param name="request">The request.</param>
public void Post(SyncplayBufferingRequest request)
public void Post(SyncPlayBufferingRequest request)
{
var currentSession = GetSession(_sessionContext);
var syncplayRequest = new PlaybackRequest()
var syncPlayRequest = new PlaybackRequest()
{
Type = request.BufferingDone ? PlaybackRequestType.BufferingDone : PlaybackRequestType.Buffering,
When = DateTime.Parse(request.When),
PositionTicks = request.PositionTicks
};
_syncplayManager.HandleRequest(currentSession, syncplayRequest, CancellationToken.None);
_syncPlayManager.HandleRequest(currentSession, syncPlayRequest, CancellationToken.None);
}
/// <summary>
/// Handles the specified request.
/// </summary>
/// <param name="request">The request.</param>
public void Post(SyncplayUpdatePing request)
public void Post(SyncPlayUpdatePing request)
{
var currentSession = GetSession(_sessionContext);
var syncplayRequest = new PlaybackRequest()
var syncPlayRequest = new PlaybackRequest()
{
Type = PlaybackRequestType.UpdatePing,
Ping = Convert.ToInt64(request.Ping)
};
_syncplayManager.HandleRequest(currentSession, syncplayRequest, CancellationToken.None);
_syncPlayManager.HandleRequest(currentSession, syncPlayRequest, CancellationToken.None);
}
}
}

View File

@ -2,10 +2,10 @@ using System;
using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Net;
using MediaBrowser.Model.Services;
using MediaBrowser.Model.Syncplay;
using MediaBrowser.Model.SyncPlay;
using Microsoft.Extensions.Logging;
namespace MediaBrowser.Api.Syncplay
namespace MediaBrowser.Api.SyncPlay
{
[Route("/GetUtcTime", "GET", Summary = "Get UtcTime")]
public class GetUtcTime : IReturnVoid

View File

@ -9,7 +9,7 @@ using MediaBrowser.Controller.Security;
using MediaBrowser.Model.Dto;
using MediaBrowser.Model.Events;
using MediaBrowser.Model.Session;
using MediaBrowser.Model.Syncplay;
using MediaBrowser.Model.SyncPlay;
namespace MediaBrowser.Controller.Session
{
@ -142,22 +142,22 @@ namespace MediaBrowser.Controller.Session
Task SendPlayCommand(string controllingSessionId, string sessionId, PlayRequest command, CancellationToken cancellationToken);
/// <summary>
/// Sends the SyncplayCommand.
/// Sends the SyncPlayCommand.
/// </summary>
/// <param name="sessionId">The session id.</param>
/// <param name="command">The command.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task.</returns>
Task SendSyncplayCommand(string sessionId, SendCommand command, CancellationToken cancellationToken);
Task SendSyncPlayCommand(string sessionId, SendCommand command, CancellationToken cancellationToken);
/// <summary>
/// Sends the SyncplayGroupUpdate.
/// Sends the SyncPlayGroupUpdate.
/// </summary>
/// <param name="sessionId">The session id.</param>
/// <param name="command">The group update.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task.</returns>
Task SendSyncplayGroupUpdate<T>(string sessionId, GroupUpdate<T> command, CancellationToken cancellationToken);
Task SendSyncPlayGroupUpdate<T>(string sessionId, GroupUpdate<T> command, CancellationToken cancellationToken);
/// <summary>
/// Sends the browse command.

View File

@ -3,7 +3,7 @@ using System.Collections.Generic;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Session;
namespace MediaBrowser.Controller.Syncplay
namespace MediaBrowser.Controller.SyncPlay
{
/// <summary>
/// Class GroupInfo.

View File

@ -1,6 +1,6 @@
using MediaBrowser.Controller.Session;
namespace MediaBrowser.Controller.Syncplay
namespace MediaBrowser.Controller.SyncPlay
{
/// <summary>
/// Class GroupMember.

View File

@ -1,14 +1,14 @@
using System;
using System.Threading;
using MediaBrowser.Controller.Session;
using MediaBrowser.Model.Syncplay;
using MediaBrowser.Model.SyncPlay;
namespace MediaBrowser.Controller.Syncplay
namespace MediaBrowser.Controller.SyncPlay
{
/// <summary>
/// Interface ISyncplayController.
/// Interface ISyncPlayController.
/// </summary>
public interface ISyncplayController
public interface ISyncPlayController
{
/// <summary>
/// Gets the group id.

View File

@ -2,14 +2,14 @@ using System;
using System.Collections.Generic;
using System.Threading;
using MediaBrowser.Controller.Session;
using MediaBrowser.Model.Syncplay;
using MediaBrowser.Model.SyncPlay;
namespace MediaBrowser.Controller.Syncplay
namespace MediaBrowser.Controller.SyncPlay
{
/// <summary>
/// Interface ISyncplayManager.
/// Interface ISyncPlayManager.
/// </summary>
public interface ISyncplayManager
public interface ISyncPlayManager
{
/// <summary>
/// Creates a new group.
@ -56,7 +56,7 @@ namespace MediaBrowser.Controller.Syncplay
/// <param name="session">The session.</param>
/// <param name="group">The group.</param>
/// <exception cref="InvalidOperationException"></exception>
void AddSessionToGroup(SessionInfo session, ISyncplayController group);
void AddSessionToGroup(SessionInfo session, ISyncPlayController group);
/// <summary>
/// Unmaps a session from a group.
@ -64,6 +64,6 @@ namespace MediaBrowser.Controller.Syncplay
/// <param name="session">The session.</param>
/// <param name="group">The group.</param>
/// <exception cref="InvalidOperationException"></exception>
void RemoveSessionFromGroup(SessionInfo session, ISyncplayController group);
void RemoveSessionFromGroup(SessionInfo session, ISyncPlayController group);
}
}

View File

@ -1,9 +1,9 @@
namespace MediaBrowser.Model.Configuration
{
/// <summary>
/// Enum SyncplayAccess.
/// Enum SyncPlayAccess.
/// </summary>
public enum SyncplayAccess
public enum SyncPlayAccess
{
/// <summary>
/// User can create groups and join them.
@ -16,7 +16,7 @@ namespace MediaBrowser.Model.Configuration
JoinGroups,
/// <summary>
/// Syncplay is disabled for the user.
/// SyncPlay is disabled for the user.
/// </summary>
None
}

View File

@ -1,4 +1,4 @@
namespace MediaBrowser.Model.Syncplay
namespace MediaBrowser.Model.SyncPlay
{
/// <summary>
/// Class GroupInfoView.

View File

@ -1,4 +1,4 @@
namespace MediaBrowser.Model.Syncplay
namespace MediaBrowser.Model.SyncPlay
{
/// <summary>
/// Class GroupUpdate.

View File

@ -1,4 +1,4 @@
namespace MediaBrowser.Model.Syncplay
namespace MediaBrowser.Model.SyncPlay
{
/// <summary>
/// Enum GroupUpdateType.

View File

@ -1,6 +1,6 @@
using System;
namespace MediaBrowser.Model.Syncplay
namespace MediaBrowser.Model.SyncPlay
{
/// <summary>
/// Class JoinGroupRequest.

View File

@ -1,6 +1,6 @@
using System;
namespace MediaBrowser.Model.Syncplay
namespace MediaBrowser.Model.SyncPlay
{
/// <summary>
/// Class PlaybackRequest.

View File

@ -1,4 +1,4 @@
namespace MediaBrowser.Model.Syncplay
namespace MediaBrowser.Model.SyncPlay
{
/// <summary>
/// Enum PlaybackRequestType

View File

@ -1,4 +1,4 @@
namespace MediaBrowser.Model.Syncplay
namespace MediaBrowser.Model.SyncPlay
{
/// <summary>
/// Class SendCommand.

View File

@ -1,4 +1,4 @@
namespace MediaBrowser.Model.Syncplay
namespace MediaBrowser.Model.SyncPlay
{
/// <summary>
/// Enum SendCommandType.

View File

@ -1,4 +1,4 @@
namespace MediaBrowser.Model.Syncplay
namespace MediaBrowser.Model.SyncPlay
{
/// <summary>
/// Class UtcTimeResponse.

View File

@ -81,10 +81,10 @@ namespace MediaBrowser.Model.Users
public string PasswordResetProviderId { get; set; }
/// <summary>
/// Gets or sets a value indicating what Syncplay features the user can access.
/// Gets or sets a value indicating what SyncPlay features the user can access.
/// </summary>
/// <value>Access level to Syncplay features.</value>
public SyncplayAccess SyncplayAccess { get; set; }
/// <value>Access level to SyncPlay features.</value>
public SyncPlayAccess SyncPlayAccess { get; set; }
public UserPolicy()
{
@ -131,7 +131,7 @@ namespace MediaBrowser.Model.Users
EnableContentDownloading = true;
EnablePublicSharing = true;
EnableRemoteAccess = true;
SyncplayAccess = SyncplayAccess.CreateAndJoinGroups;
SyncPlayAccess = SyncPlayAccess.CreateAndJoinGroups;
}
}
}