2013-05-09 17:38:02 +00:00
|
|
|
|
using MediaBrowser.Controller.Entities;
|
|
|
|
|
using MediaBrowser.Controller.Library;
|
2014-04-16 02:17:48 +00:00
|
|
|
|
using MediaBrowser.Model.Entities;
|
2013-09-24 15:42:30 +00:00
|
|
|
|
using MediaBrowser.Model.Session;
|
2013-05-09 17:38:02 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
2013-09-24 15:42:30 +00:00
|
|
|
|
using System.Threading;
|
2013-05-09 17:38:02 +00:00
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
|
|
namespace MediaBrowser.Controller.Session
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Interface ISessionManager
|
|
|
|
|
/// </summary>
|
|
|
|
|
public interface ISessionManager
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Occurs when [playback start].
|
|
|
|
|
/// </summary>
|
|
|
|
|
event EventHandler<PlaybackProgressEventArgs> PlaybackStart;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Occurs when [playback progress].
|
|
|
|
|
/// </summary>
|
|
|
|
|
event EventHandler<PlaybackProgressEventArgs> PlaybackProgress;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Occurs when [playback stopped].
|
|
|
|
|
/// </summary>
|
2013-12-30 17:18:18 +00:00
|
|
|
|
event EventHandler<PlaybackStopEventArgs> PlaybackStopped;
|
2013-05-09 17:38:02 +00:00
|
|
|
|
|
2014-04-06 17:53:23 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Occurs when [session started].
|
|
|
|
|
/// </summary>
|
|
|
|
|
event EventHandler<SessionEventArgs> SessionStarted;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Occurs when [session ended].
|
|
|
|
|
/// </summary>
|
|
|
|
|
event EventHandler<SessionEventArgs> SessionEnded;
|
2014-05-14 00:46:45 +00:00
|
|
|
|
|
|
|
|
|
event EventHandler<SessionEventArgs> SessionActivity;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Occurs when [capabilities changed].
|
|
|
|
|
/// </summary>
|
|
|
|
|
event EventHandler<SessionEventArgs> CapabilitiesChanged;
|
2014-04-06 17:53:23 +00:00
|
|
|
|
|
2013-05-09 17:38:02 +00:00
|
|
|
|
/// <summary>
|
2013-05-10 12:18:07 +00:00
|
|
|
|
/// Gets the sessions.
|
2013-05-09 17:38:02 +00:00
|
|
|
|
/// </summary>
|
2013-05-10 12:18:07 +00:00
|
|
|
|
/// <value>The sessions.</value>
|
|
|
|
|
IEnumerable<SessionInfo> Sessions { get; }
|
2013-05-09 17:38:02 +00:00
|
|
|
|
|
2013-12-25 14:39:46 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Adds the parts.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sessionFactories">The session factories.</param>
|
|
|
|
|
void AddParts(IEnumerable<ISessionControllerFactory> sessionFactories);
|
|
|
|
|
|
2013-05-09 17:38:02 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Logs the user activity.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="clientType">Type of the client.</param>
|
2013-07-09 16:11:16 +00:00
|
|
|
|
/// <param name="appVersion">The app version.</param>
|
2013-05-09 17:38:02 +00:00
|
|
|
|
/// <param name="deviceId">The device id.</param>
|
|
|
|
|
/// <param name="deviceName">Name of the device.</param>
|
2013-12-25 14:39:46 +00:00
|
|
|
|
/// <param name="remoteEndPoint">The remote end point.</param>
|
2013-05-09 17:38:02 +00:00
|
|
|
|
/// <param name="user">The user.</param>
|
|
|
|
|
/// <returns>Task.</returns>
|
|
|
|
|
/// <exception cref="System.ArgumentNullException">user</exception>
|
2013-12-25 14:39:46 +00:00
|
|
|
|
Task<SessionInfo> LogSessionActivity(string clientType, string appVersion, string deviceId, string deviceName, string remoteEndPoint, User user);
|
2013-05-09 17:38:02 +00:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Used to report that playback has started for an item
|
|
|
|
|
/// </summary>
|
2013-09-24 15:08:51 +00:00
|
|
|
|
/// <param name="info">The info.</param>
|
2013-07-09 16:11:16 +00:00
|
|
|
|
/// <returns>Task.</returns>
|
2014-04-16 02:17:48 +00:00
|
|
|
|
Task OnPlaybackStart(PlaybackStartInfo info);
|
2013-05-09 17:38:02 +00:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Used to report playback progress for an item
|
|
|
|
|
/// </summary>
|
2013-09-30 15:05:07 +00:00
|
|
|
|
/// <param name="info">The info.</param>
|
2013-05-09 17:38:02 +00:00
|
|
|
|
/// <returns>Task.</returns>
|
|
|
|
|
/// <exception cref="System.ArgumentNullException"></exception>
|
2013-09-30 15:05:07 +00:00
|
|
|
|
Task OnPlaybackProgress(PlaybackProgressInfo info);
|
2013-05-09 17:38:02 +00:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Used to report that playback has ended for an item
|
|
|
|
|
/// </summary>
|
2013-09-30 15:05:07 +00:00
|
|
|
|
/// <param name="info">The info.</param>
|
2013-05-09 17:38:02 +00:00
|
|
|
|
/// <returns>Task.</returns>
|
|
|
|
|
/// <exception cref="System.ArgumentNullException"></exception>
|
2013-09-30 15:05:07 +00:00
|
|
|
|
Task OnPlaybackStopped(PlaybackStopInfo info);
|
2013-09-24 15:42:30 +00:00
|
|
|
|
|
2014-03-10 02:33:19 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Reports the session ended.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sessionId">The session identifier.</param>
|
|
|
|
|
/// <returns>Task.</returns>
|
2014-04-16 02:17:48 +00:00
|
|
|
|
Task ReportSessionEnded(string sessionId);
|
2014-03-10 02:33:19 +00:00
|
|
|
|
|
2014-04-06 17:53:23 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets the session info dto.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="session">The session.</param>
|
|
|
|
|
/// <returns>SessionInfoDto.</returns>
|
|
|
|
|
SessionInfoDto GetSessionInfoDto(SessionInfo session);
|
|
|
|
|
|
2013-09-24 15:42:30 +00:00
|
|
|
|
/// <summary>
|
2014-03-31 21:04:22 +00:00
|
|
|
|
/// Sends the general command.
|
2013-09-24 15:42:30 +00:00
|
|
|
|
/// </summary>
|
2014-03-16 16:15:10 +00:00
|
|
|
|
/// <param name="controllingSessionId">The controlling session identifier.</param>
|
2014-03-31 21:04:22 +00:00
|
|
|
|
/// <param name="sessionId">The session identifier.</param>
|
2013-09-24 15:42:30 +00:00
|
|
|
|
/// <param name="command">The command.</param>
|
|
|
|
|
/// <param name="cancellationToken">The cancellation token.</param>
|
|
|
|
|
/// <returns>Task.</returns>
|
2014-04-16 02:17:48 +00:00
|
|
|
|
Task SendGeneralCommand(string controllingSessionId, string sessionId, GeneralCommand command, CancellationToken cancellationToken);
|
2014-03-31 21:04:22 +00:00
|
|
|
|
|
2013-09-24 19:54:42 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Sends the message command.
|
|
|
|
|
/// </summary>
|
2014-03-16 16:15:10 +00:00
|
|
|
|
/// <param name="controllingSessionId">The controlling session identifier.</param>
|
2013-09-24 19:54:42 +00:00
|
|
|
|
/// <param name="sessionId">The session id.</param>
|
|
|
|
|
/// <param name="command">The command.</param>
|
|
|
|
|
/// <param name="cancellationToken">The cancellation token.</param>
|
|
|
|
|
/// <returns>Task.</returns>
|
2014-04-16 02:17:48 +00:00
|
|
|
|
Task SendMessageCommand(string controllingSessionId, string sessionId, MessageCommand command, CancellationToken cancellationToken);
|
2013-09-24 19:54:42 +00:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Sends the play command.
|
|
|
|
|
/// </summary>
|
2014-03-16 16:15:10 +00:00
|
|
|
|
/// <param name="controllingSessionId">The controlling session identifier.</param>
|
2013-09-24 19:54:42 +00:00
|
|
|
|
/// <param name="sessionId">The session id.</param>
|
|
|
|
|
/// <param name="command">The command.</param>
|
|
|
|
|
/// <param name="cancellationToken">The cancellation token.</param>
|
|
|
|
|
/// <returns>Task.</returns>
|
2014-04-16 02:17:48 +00:00
|
|
|
|
Task SendPlayCommand(string controllingSessionId, string sessionId, PlayRequest command, CancellationToken cancellationToken);
|
2013-09-24 19:54:42 +00:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Sends the browse command.
|
|
|
|
|
/// </summary>
|
2014-03-16 16:15:10 +00:00
|
|
|
|
/// <param name="controllingSessionId">The controlling session identifier.</param>
|
2013-09-24 19:54:42 +00:00
|
|
|
|
/// <param name="sessionId">The session id.</param>
|
|
|
|
|
/// <param name="command">The command.</param>
|
|
|
|
|
/// <param name="cancellationToken">The cancellation token.</param>
|
|
|
|
|
/// <returns>Task.</returns>
|
2014-04-16 02:17:48 +00:00
|
|
|
|
Task SendBrowseCommand(string controllingSessionId, string sessionId, BrowseRequest command, CancellationToken cancellationToken);
|
2013-09-24 19:54:42 +00:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Sends the playstate command.
|
|
|
|
|
/// </summary>
|
2014-03-16 16:15:10 +00:00
|
|
|
|
/// <param name="controllingSessionId">The controlling session identifier.</param>
|
2013-09-24 19:54:42 +00:00
|
|
|
|
/// <param name="sessionId">The session id.</param>
|
|
|
|
|
/// <param name="command">The command.</param>
|
|
|
|
|
/// <param name="cancellationToken">The cancellation token.</param>
|
|
|
|
|
/// <returns>Task.</returns>
|
2014-04-16 02:17:48 +00:00
|
|
|
|
Task SendPlaystateCommand(string controllingSessionId, string sessionId, PlaystateRequest command, CancellationToken cancellationToken);
|
2013-10-03 01:22:50 +00:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Sends the restart required message.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="cancellationToken">The cancellation token.</param>
|
|
|
|
|
/// <returns>Task.</returns>
|
2013-10-03 18:02:23 +00:00
|
|
|
|
Task SendRestartRequiredNotification(CancellationToken cancellationToken);
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Sends the server shutdown notification.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="cancellationToken">The cancellation token.</param>
|
|
|
|
|
/// <returns>Task.</returns>
|
|
|
|
|
Task SendServerShutdownNotification(CancellationToken cancellationToken);
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Sends the server restart notification.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="cancellationToken">The cancellation token.</param>
|
|
|
|
|
/// <returns>Task.</returns>
|
|
|
|
|
Task SendServerRestartNotification(CancellationToken cancellationToken);
|
2014-01-04 02:35:41 +00:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Adds the additional user.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sessionId">The session identifier.</param>
|
|
|
|
|
/// <param name="userId">The user identifier.</param>
|
2014-04-16 02:17:48 +00:00
|
|
|
|
void AddAdditionalUser(string sessionId, Guid userId);
|
2014-01-04 02:35:41 +00:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Removes the additional user.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sessionId">The session identifier.</param>
|
|
|
|
|
/// <param name="userId">The user identifier.</param>
|
2014-04-16 02:17:48 +00:00
|
|
|
|
void RemoveAdditionalUser(string sessionId, Guid userId);
|
2014-01-11 23:07:56 +00:00
|
|
|
|
|
2014-04-16 02:17:48 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Reports the now viewing item.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sessionId">The session identifier.</param>
|
|
|
|
|
/// <param name="itemId">The item identifier.</param>
|
2014-05-01 03:24:55 +00:00
|
|
|
|
void ReportNowViewingItem(string sessionId, string itemId);
|
2014-04-16 02:17:48 +00:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Reports the now viewing item.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sessionId">The session identifier.</param>
|
|
|
|
|
/// <param name="item">The item.</param>
|
2014-05-01 03:24:55 +00:00
|
|
|
|
void ReportNowViewingItem(string sessionId, BaseItemInfo item);
|
2014-04-16 02:17:48 +00:00
|
|
|
|
|
2014-01-11 23:07:56 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Authenticates the new session.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="user">The user.</param>
|
|
|
|
|
/// <param name="password">The password.</param>
|
|
|
|
|
/// <param name="clientType">Type of the client.</param>
|
|
|
|
|
/// <param name="appVersion">The application version.</param>
|
|
|
|
|
/// <param name="deviceId">The device identifier.</param>
|
|
|
|
|
/// <param name="deviceName">Name of the device.</param>
|
|
|
|
|
/// <param name="remoteEndPoint">The remote end point.</param>
|
|
|
|
|
/// <returns>Task{SessionInfo}.</returns>
|
|
|
|
|
Task<SessionInfo> AuthenticateNewSession(User user, string password, string clientType, string appVersion, string deviceId, string deviceName, string remoteEndPoint);
|
2014-03-21 03:31:40 +00:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Reports the capabilities.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sessionId">The session identifier.</param>
|
|
|
|
|
/// <param name="capabilities">The capabilities.</param>
|
2014-04-16 02:17:48 +00:00
|
|
|
|
void ReportCapabilities(string sessionId, SessionCapabilities capabilities);
|
2013-05-09 17:38:02 +00:00
|
|
|
|
}
|
|
|
|
|
}
|