mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-09-05 21:37:10 -04:00
fixed dlna user reporting
This commit is contained in:
parent
b36aea4ff7
commit
5b3bde4d9a
@ -277,7 +277,7 @@ namespace MediaBrowser.Api
|
|||||||
SeekPositionTicks = request.SeekPositionTicks
|
SeekPositionTicks = request.SeekPositionTicks
|
||||||
};
|
};
|
||||||
|
|
||||||
var task = _sessionManager.SendPlaystateCommand(request.Id, command, CancellationToken.None);
|
var task = _sessionManager.SendPlaystateCommand(GetSession().Id, request.Id, command, CancellationToken.None);
|
||||||
|
|
||||||
Task.WaitAll(task);
|
Task.WaitAll(task);
|
||||||
}
|
}
|
||||||
@ -296,7 +296,7 @@ namespace MediaBrowser.Api
|
|||||||
ItemType = request.ItemType
|
ItemType = request.ItemType
|
||||||
};
|
};
|
||||||
|
|
||||||
var task = _sessionManager.SendBrowseCommand(request.Id, command, CancellationToken.None);
|
var task = _sessionManager.SendBrowseCommand(GetSession().Id, request.Id, command, CancellationToken.None);
|
||||||
|
|
||||||
Task.WaitAll(task);
|
Task.WaitAll(task);
|
||||||
}
|
}
|
||||||
@ -307,7 +307,7 @@ namespace MediaBrowser.Api
|
|||||||
/// <param name="request">The request.</param>
|
/// <param name="request">The request.</param>
|
||||||
public void Post(SendSystemCommand request)
|
public void Post(SendSystemCommand request)
|
||||||
{
|
{
|
||||||
var task = _sessionManager.SendSystemCommand(request.Id, request.Command, CancellationToken.None);
|
var task = _sessionManager.SendSystemCommand(GetSession().Id, request.Id, request.Command, CancellationToken.None);
|
||||||
|
|
||||||
Task.WaitAll(task);
|
Task.WaitAll(task);
|
||||||
}
|
}
|
||||||
@ -325,7 +325,7 @@ namespace MediaBrowser.Api
|
|||||||
Text = request.Text
|
Text = request.Text
|
||||||
};
|
};
|
||||||
|
|
||||||
var task = _sessionManager.SendMessageCommand(request.Id, command, CancellationToken.None);
|
var task = _sessionManager.SendMessageCommand(GetSession().Id, request.Id, command, CancellationToken.None);
|
||||||
|
|
||||||
Task.WaitAll(task);
|
Task.WaitAll(task);
|
||||||
}
|
}
|
||||||
@ -344,7 +344,7 @@ namespace MediaBrowser.Api
|
|||||||
StartPositionTicks = request.StartPositionTicks
|
StartPositionTicks = request.StartPositionTicks
|
||||||
};
|
};
|
||||||
|
|
||||||
var task = _sessionManager.SendPlayCommand(request.Id, command, CancellationToken.None);
|
var task = _sessionManager.SendPlayCommand(GetSession().Id, request.Id, command, CancellationToken.None);
|
||||||
|
|
||||||
Task.WaitAll(task);
|
Task.WaitAll(task);
|
||||||
}
|
}
|
||||||
@ -367,5 +367,14 @@ namespace MediaBrowser.Api
|
|||||||
.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries)
|
.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries)
|
||||||
.ToList();
|
.ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private SessionInfo GetSession()
|
||||||
|
{
|
||||||
|
var auth = AuthorizationRequestFilterAttribute.GetAuthorization(Request);
|
||||||
|
|
||||||
|
return _sessionManager.Sessions.First(i => string.Equals(i.DeviceId, auth.DeviceId) &&
|
||||||
|
string.Equals(i.Client, auth.Client) &&
|
||||||
|
string.Equals(i.ApplicationVersion, auth.Version));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -86,47 +86,52 @@ namespace MediaBrowser.Controller.Session
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Sends the system command.
|
/// Sends the system command.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <param name="controllingSessionId">The controlling session identifier.</param>
|
||||||
/// <param name="sessionId">The session id.</param>
|
/// <param name="sessionId">The session id.</param>
|
||||||
/// <param name="command">The command.</param>
|
/// <param name="command">The command.</param>
|
||||||
/// <param name="cancellationToken">The cancellation token.</param>
|
/// <param name="cancellationToken">The cancellation token.</param>
|
||||||
/// <returns>Task.</returns>
|
/// <returns>Task.</returns>
|
||||||
Task SendSystemCommand(Guid sessionId, SystemCommand command, CancellationToken cancellationToken);
|
Task SendSystemCommand(Guid controllingSessionId, Guid sessionId, SystemCommand command, CancellationToken cancellationToken);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Sends the message command.
|
/// Sends the message command.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <param name="controllingSessionId">The controlling session identifier.</param>
|
||||||
/// <param name="sessionId">The session id.</param>
|
/// <param name="sessionId">The session id.</param>
|
||||||
/// <param name="command">The command.</param>
|
/// <param name="command">The command.</param>
|
||||||
/// <param name="cancellationToken">The cancellation token.</param>
|
/// <param name="cancellationToken">The cancellation token.</param>
|
||||||
/// <returns>Task.</returns>
|
/// <returns>Task.</returns>
|
||||||
Task SendMessageCommand(Guid sessionId, MessageCommand command, CancellationToken cancellationToken);
|
Task SendMessageCommand(Guid controllingSessionId, Guid sessionId, MessageCommand command, CancellationToken cancellationToken);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Sends the play command.
|
/// Sends the play command.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <param name="controllingSessionId">The controlling session identifier.</param>
|
||||||
/// <param name="sessionId">The session id.</param>
|
/// <param name="sessionId">The session id.</param>
|
||||||
/// <param name="command">The command.</param>
|
/// <param name="command">The command.</param>
|
||||||
/// <param name="cancellationToken">The cancellation token.</param>
|
/// <param name="cancellationToken">The cancellation token.</param>
|
||||||
/// <returns>Task.</returns>
|
/// <returns>Task.</returns>
|
||||||
Task SendPlayCommand(Guid sessionId, PlayRequest command, CancellationToken cancellationToken);
|
Task SendPlayCommand(Guid controllingSessionId, Guid sessionId, PlayRequest command, CancellationToken cancellationToken);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Sends the browse command.
|
/// Sends the browse command.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <param name="controllingSessionId">The controlling session identifier.</param>
|
||||||
/// <param name="sessionId">The session id.</param>
|
/// <param name="sessionId">The session id.</param>
|
||||||
/// <param name="command">The command.</param>
|
/// <param name="command">The command.</param>
|
||||||
/// <param name="cancellationToken">The cancellation token.</param>
|
/// <param name="cancellationToken">The cancellation token.</param>
|
||||||
/// <returns>Task.</returns>
|
/// <returns>Task.</returns>
|
||||||
Task SendBrowseCommand(Guid sessionId, BrowseRequest command, CancellationToken cancellationToken);
|
Task SendBrowseCommand(Guid controllingSessionId, Guid sessionId, BrowseRequest command, CancellationToken cancellationToken);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Sends the playstate command.
|
/// Sends the playstate command.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <param name="controllingSessionId">The controlling session identifier.</param>
|
||||||
/// <param name="sessionId">The session id.</param>
|
/// <param name="sessionId">The session id.</param>
|
||||||
/// <param name="command">The command.</param>
|
/// <param name="command">The command.</param>
|
||||||
/// <param name="cancellationToken">The cancellation token.</param>
|
/// <param name="cancellationToken">The cancellation token.</param>
|
||||||
/// <returns>Task.</returns>
|
/// <returns>Task.</returns>
|
||||||
Task SendPlaystateCommand(Guid sessionId, PlaystateRequest command, CancellationToken cancellationToken);
|
Task SendPlaystateCommand(Guid controllingSessionId, Guid sessionId, PlaystateRequest command, CancellationToken cancellationToken);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Sends the restart required message.
|
/// Sends the restart required message.
|
||||||
|
@ -56,11 +56,16 @@ namespace MediaBrowser.Providers.Manager
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the last result.
|
/// Gets the last result.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="itemId">The item identifier.</param>
|
/// <param name="item">The item.</param>
|
||||||
/// <returns>ProviderResult.</returns>
|
/// <returns>ProviderResult.</returns>
|
||||||
protected MetadataStatus GetLastResult(Guid itemId)
|
protected MetadataStatus GetLastResult(IHasMetadata item)
|
||||||
{
|
{
|
||||||
return ProviderRepo.GetMetadataStatus(itemId) ?? new MetadataStatus { ItemId = itemId };
|
if (item.DateLastSaved == default(DateTime))
|
||||||
|
{
|
||||||
|
return new MetadataStatus { ItemId = item.Id };
|
||||||
|
}
|
||||||
|
|
||||||
|
return ProviderRepo.GetMetadataStatus(item.Id) ?? new MetadataStatus { ItemId = item.Id };
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task RefreshMetadata(IHasMetadata item, MetadataRefreshOptions refreshOptions, CancellationToken cancellationToken)
|
public async Task RefreshMetadata(IHasMetadata item, MetadataRefreshOptions refreshOptions, CancellationToken cancellationToken)
|
||||||
@ -74,7 +79,7 @@ namespace MediaBrowser.Providers.Manager
|
|||||||
var config = ProviderManager.GetMetadataOptions(item);
|
var config = ProviderManager.GetMetadataOptions(item);
|
||||||
|
|
||||||
var updateType = ItemUpdateType.None;
|
var updateType = ItemUpdateType.None;
|
||||||
var refreshResult = GetLastResult(item.Id);
|
var refreshResult = GetLastResult(item);
|
||||||
refreshResult.LastErrorMessage = string.Empty;
|
refreshResult.LastErrorMessage = string.Empty;
|
||||||
refreshResult.LastStatus = ProviderRefreshStatus.Success;
|
refreshResult.LastStatus = ProviderRefreshStatus.Success;
|
||||||
|
|
||||||
|
@ -622,42 +622,27 @@ namespace MediaBrowser.Server.Implementations.Session
|
|||||||
return session;
|
return session;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
public Task SendSystemCommand(Guid controllingSessionId, Guid sessionId, SystemCommand command, CancellationToken cancellationToken)
|
||||||
/// Sends the system command.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="sessionId">The session id.</param>
|
|
||||||
/// <param name="command">The command.</param>
|
|
||||||
/// <param name="cancellationToken">The cancellation token.</param>
|
|
||||||
/// <returns>Task.</returns>
|
|
||||||
public Task SendSystemCommand(Guid sessionId, SystemCommand command, CancellationToken cancellationToken)
|
|
||||||
{
|
{
|
||||||
var session = GetSessionForRemoteControl(sessionId);
|
var session = GetSessionForRemoteControl(sessionId);
|
||||||
|
|
||||||
|
var controllingSession = GetSession(controllingSessionId);
|
||||||
|
AssertCanControl(session, controllingSession);
|
||||||
|
|
||||||
return session.SessionController.SendSystemCommand(command, cancellationToken);
|
return session.SessionController.SendSystemCommand(command, cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
public Task SendMessageCommand(Guid controllingSessionId, Guid sessionId, MessageCommand command, CancellationToken cancellationToken)
|
||||||
/// Sends the message command.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="sessionId">The session id.</param>
|
|
||||||
/// <param name="command">The command.</param>
|
|
||||||
/// <param name="cancellationToken">The cancellation token.</param>
|
|
||||||
/// <returns>Task.</returns>
|
|
||||||
public Task SendMessageCommand(Guid sessionId, MessageCommand command, CancellationToken cancellationToken)
|
|
||||||
{
|
{
|
||||||
var session = GetSessionForRemoteControl(sessionId);
|
var session = GetSessionForRemoteControl(sessionId);
|
||||||
|
|
||||||
|
var controllingSession = GetSession(controllingSessionId);
|
||||||
|
AssertCanControl(session, controllingSession);
|
||||||
|
|
||||||
return session.SessionController.SendMessageCommand(command, cancellationToken);
|
return session.SessionController.SendMessageCommand(command, cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
public Task SendPlayCommand(Guid controllingSessionId, Guid sessionId, PlayRequest command, CancellationToken cancellationToken)
|
||||||
/// Sends the play command.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="sessionId">The session id.</param>
|
|
||||||
/// <param name="command">The command.</param>
|
|
||||||
/// <param name="cancellationToken">The cancellation token.</param>
|
|
||||||
/// <returns>Task.</returns>
|
|
||||||
public Task SendPlayCommand(Guid sessionId, PlayRequest command, CancellationToken cancellationToken)
|
|
||||||
{
|
{
|
||||||
var session = GetSessionForRemoteControl(sessionId);
|
var session = GetSessionForRemoteControl(sessionId);
|
||||||
|
|
||||||
@ -690,36 +675,27 @@ namespace MediaBrowser.Server.Implementations.Session
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (session.UserId.HasValue)
|
var controllingSession = GetSession(controllingSessionId);
|
||||||
|
AssertCanControl(session, controllingSession);
|
||||||
|
if (controllingSession.UserId.HasValue)
|
||||||
{
|
{
|
||||||
command.ControllingUserId = session.UserId.Value.ToString("N");
|
command.ControllingUserId = controllingSession.UserId.Value.ToString("N");
|
||||||
}
|
}
|
||||||
|
|
||||||
return session.SessionController.SendPlayCommand(command, cancellationToken);
|
return session.SessionController.SendPlayCommand(command, cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
public Task SendBrowseCommand(Guid controllingSessionId, Guid sessionId, BrowseRequest command, CancellationToken cancellationToken)
|
||||||
/// Sends the browse command.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="sessionId">The session id.</param>
|
|
||||||
/// <param name="command">The command.</param>
|
|
||||||
/// <param name="cancellationToken">The cancellation token.</param>
|
|
||||||
/// <returns>Task.</returns>
|
|
||||||
public Task SendBrowseCommand(Guid sessionId, BrowseRequest command, CancellationToken cancellationToken)
|
|
||||||
{
|
{
|
||||||
var session = GetSessionForRemoteControl(sessionId);
|
var session = GetSessionForRemoteControl(sessionId);
|
||||||
|
|
||||||
|
var controllingSession = GetSession(controllingSessionId);
|
||||||
|
AssertCanControl(session, controllingSession);
|
||||||
|
|
||||||
return session.SessionController.SendBrowseCommand(command, cancellationToken);
|
return session.SessionController.SendBrowseCommand(command, cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
public Task SendPlaystateCommand(Guid controllingSessionId, Guid sessionId, PlaystateRequest command, CancellationToken cancellationToken)
|
||||||
/// Sends the playstate command.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="sessionId">The session id.</param>
|
|
||||||
/// <param name="command">The command.</param>
|
|
||||||
/// <param name="cancellationToken">The cancellation token.</param>
|
|
||||||
/// <returns>Task.</returns>
|
|
||||||
public Task SendPlaystateCommand(Guid sessionId, PlaystateRequest command, CancellationToken cancellationToken)
|
|
||||||
{
|
{
|
||||||
var session = GetSessionForRemoteControl(sessionId);
|
var session = GetSessionForRemoteControl(sessionId);
|
||||||
|
|
||||||
@ -728,14 +704,28 @@ namespace MediaBrowser.Server.Implementations.Session
|
|||||||
throw new ArgumentException(string.Format("Session {0} is unable to seek.", session.Id));
|
throw new ArgumentException(string.Format("Session {0} is unable to seek.", session.Id));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (session.UserId.HasValue)
|
var controllingSession = GetSession(controllingSessionId);
|
||||||
|
AssertCanControl(session, controllingSession);
|
||||||
|
if (controllingSession.UserId.HasValue)
|
||||||
{
|
{
|
||||||
command.ControllingUserId = session.UserId.Value.ToString("N");
|
command.ControllingUserId = controllingSession.UserId.Value.ToString("N");
|
||||||
}
|
}
|
||||||
|
|
||||||
return session.SessionController.SendPlaystateCommand(command, cancellationToken);
|
return session.SessionController.SendPlaystateCommand(command, cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void AssertCanControl(SessionInfo session, SessionInfo controllingSession)
|
||||||
|
{
|
||||||
|
if (session == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException("session");
|
||||||
|
}
|
||||||
|
if (controllingSession == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException("controllingSession");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Sends the restart required message.
|
/// Sends the restart required message.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
Loading…
Reference in New Issue
Block a user