|
|
@ -297,9 +297,9 @@ namespace MediaBrowser.Api.Session
|
|
|
|
Task.WaitAll(task);
|
|
|
|
Task.WaitAll(task);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void Post(CreateKey request)
|
|
|
|
public Task Post(CreateKey request)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var task = _authRepo.Create(new AuthenticationInfo
|
|
|
|
return _authRepo.Create(new AuthenticationInfo
|
|
|
|
{
|
|
|
|
{
|
|
|
|
AppName = request.App,
|
|
|
|
AppName = request.App,
|
|
|
|
IsActive = true,
|
|
|
|
IsActive = true,
|
|
|
@ -307,8 +307,6 @@ namespace MediaBrowser.Api.Session
|
|
|
|
DateCreated = DateTime.UtcNow
|
|
|
|
DateCreated = DateTime.UtcNow
|
|
|
|
|
|
|
|
|
|
|
|
}, CancellationToken.None);
|
|
|
|
}, CancellationToken.None);
|
|
|
|
|
|
|
|
|
|
|
|
Task.WaitAll(task);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void Post(ReportSessionEnded request)
|
|
|
|
public void Post(ReportSessionEnded request)
|
|
|
@ -357,7 +355,7 @@ namespace MediaBrowser.Api.Session
|
|
|
|
return ToOptimizedResult(result.Select(_sessionManager.GetSessionInfoDto).ToList());
|
|
|
|
return ToOptimizedResult(result.Select(_sessionManager.GetSessionInfoDto).ToList());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void Post(SendPlaystateCommand request)
|
|
|
|
public Task Post(SendPlaystateCommand request)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var command = new PlaystateRequest
|
|
|
|
var command = new PlaystateRequest
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -365,16 +363,14 @@ namespace MediaBrowser.Api.Session
|
|
|
|
SeekPositionTicks = request.SeekPositionTicks
|
|
|
|
SeekPositionTicks = request.SeekPositionTicks
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
var task = _sessionManager.SendPlaystateCommand(GetSession().Id, request.Id, command, CancellationToken.None);
|
|
|
|
return _sessionManager.SendPlaystateCommand(GetSession().Id, request.Id, command, CancellationToken.None);
|
|
|
|
|
|
|
|
|
|
|
|
Task.WaitAll(task);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
/// Posts the specified request.
|
|
|
|
/// Posts the specified request.
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="request">The request.</param>
|
|
|
|
/// <param name="request">The request.</param>
|
|
|
|
public void Post(DisplayContent request)
|
|
|
|
public Task Post(DisplayContent request)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var command = new BrowseRequest
|
|
|
|
var command = new BrowseRequest
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -383,40 +379,39 @@ namespace MediaBrowser.Api.Session
|
|
|
|
ItemType = request.ItemType
|
|
|
|
ItemType = request.ItemType
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
var task = _sessionManager.SendBrowseCommand(GetSession().Id, request.Id, command, CancellationToken.None);
|
|
|
|
return _sessionManager.SendBrowseCommand(GetSession().Id, request.Id, command, CancellationToken.None);
|
|
|
|
|
|
|
|
|
|
|
|
Task.WaitAll(task);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
/// Posts the specified request.
|
|
|
|
/// Posts the specified request.
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="request">The request.</param>
|
|
|
|
/// <param name="request">The request.</param>
|
|
|
|
public void Post(SendSystemCommand request)
|
|
|
|
public Task Post(SendSystemCommand request)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
GeneralCommandType commandType;
|
|
|
|
GeneralCommandType commandType;
|
|
|
|
|
|
|
|
var name = request.Command;
|
|
|
|
|
|
|
|
|
|
|
|
if (Enum.TryParse(request.Command, true, out commandType))
|
|
|
|
if (Enum.TryParse(name, true, out commandType))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
name = commandType.ToString();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var currentSession = GetSession();
|
|
|
|
var currentSession = GetSession();
|
|
|
|
|
|
|
|
|
|
|
|
var command = new GeneralCommand
|
|
|
|
var command = new GeneralCommand
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Name = commandType.ToString(),
|
|
|
|
Name = name,
|
|
|
|
ControllingUserId = currentSession.UserId.HasValue ? currentSession.UserId.Value.ToString("N") : null
|
|
|
|
ControllingUserId = currentSession.UserId.HasValue ? currentSession.UserId.Value.ToString("N") : null
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
var task = _sessionManager.SendGeneralCommand(currentSession.Id, request.Id, command, CancellationToken.None);
|
|
|
|
return _sessionManager.SendGeneralCommand(currentSession.Id, request.Id, command, CancellationToken.None);
|
|
|
|
|
|
|
|
|
|
|
|
Task.WaitAll(task);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
/// Posts the specified request.
|
|
|
|
/// Posts the specified request.
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="request">The request.</param>
|
|
|
|
/// <param name="request">The request.</param>
|
|
|
|
public void Post(SendMessageCommand request)
|
|
|
|
public Task Post(SendMessageCommand request)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var command = new MessageCommand
|
|
|
|
var command = new MessageCommand
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -425,16 +420,14 @@ namespace MediaBrowser.Api.Session
|
|
|
|
Text = request.Text
|
|
|
|
Text = request.Text
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
var task = _sessionManager.SendMessageCommand(GetSession().Id, request.Id, command, CancellationToken.None);
|
|
|
|
return _sessionManager.SendMessageCommand(GetSession().Id, request.Id, command, CancellationToken.None);
|
|
|
|
|
|
|
|
|
|
|
|
Task.WaitAll(task);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
/// Posts the specified request.
|
|
|
|
/// Posts the specified request.
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="request">The request.</param>
|
|
|
|
/// <param name="request">The request.</param>
|
|
|
|
public void Post(Play request)
|
|
|
|
public Task Post(Play request)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var command = new PlayRequest
|
|
|
|
var command = new PlayRequest
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -444,12 +437,10 @@ namespace MediaBrowser.Api.Session
|
|
|
|
StartPositionTicks = request.StartPositionTicks
|
|
|
|
StartPositionTicks = request.StartPositionTicks
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
var task = _sessionManager.SendPlayCommand(GetSession().Id, request.Id, command, CancellationToken.None);
|
|
|
|
return _sessionManager.SendPlayCommand(GetSession().Id, request.Id, command, CancellationToken.None);
|
|
|
|
|
|
|
|
|
|
|
|
Task.WaitAll(task);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void Post(SendGeneralCommand request)
|
|
|
|
public Task Post(SendGeneralCommand request)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var currentSession = GetSession();
|
|
|
|
var currentSession = GetSession();
|
|
|
|
|
|
|
|
|
|
|
@ -459,20 +450,16 @@ namespace MediaBrowser.Api.Session
|
|
|
|
ControllingUserId = currentSession.UserId.HasValue ? currentSession.UserId.Value.ToString("N") : null
|
|
|
|
ControllingUserId = currentSession.UserId.HasValue ? currentSession.UserId.Value.ToString("N") : null
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
var task = _sessionManager.SendGeneralCommand(currentSession.Id, request.Id, command, CancellationToken.None);
|
|
|
|
return _sessionManager.SendGeneralCommand(currentSession.Id, request.Id, command, CancellationToken.None);
|
|
|
|
|
|
|
|
|
|
|
|
Task.WaitAll(task);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void Post(SendFullGeneralCommand request)
|
|
|
|
public Task Post(SendFullGeneralCommand request)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var currentSession = GetSession();
|
|
|
|
var currentSession = GetSession();
|
|
|
|
|
|
|
|
|
|
|
|
request.ControllingUserId = currentSession.UserId.HasValue ? currentSession.UserId.Value.ToString("N") : null;
|
|
|
|
request.ControllingUserId = currentSession.UserId.HasValue ? currentSession.UserId.Value.ToString("N") : null;
|
|
|
|
|
|
|
|
|
|
|
|
var task = _sessionManager.SendGeneralCommand(currentSession.Id, request.Id, request, CancellationToken.None);
|
|
|
|
return _sessionManager.SendGeneralCommand(currentSession.Id, request.Id, request, CancellationToken.None);
|
|
|
|
|
|
|
|
|
|
|
|
Task.WaitAll(task);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void Post(AddUserToSession request)
|
|
|
|
public void Post(AddUserToSession request)
|
|
|
|