diff options
| author | Eric Reed <ebr@mediabrowser3.com> | 2013-09-25 14:32:36 -0400 |
|---|---|---|
| committer | Eric Reed <ebr@mediabrowser3.com> | 2013-09-25 14:32:36 -0400 |
| commit | c02c0db35af078e1a78897aecdade2efe57d3f06 (patch) | |
| tree | af9ef64305efd2e353a202c27b188d2c44cd9b5b /MediaBrowser.Controller/Session | |
| parent | c6e57c6448c04998bcae5a906e7a064300542e75 (diff) | |
| parent | 2d9b48d00fd31aaa96676c82a054b2794493fbf9 (diff) | |
Merge branch 'master' of https://github.com/MediaBrowser/MediaBrowser
Diffstat (limited to 'MediaBrowser.Controller/Session')
| -rw-r--r-- | MediaBrowser.Controller/Session/ISessionManager.cs | 60 | ||||
| -rw-r--r-- | MediaBrowser.Controller/Session/ISessionRemoteController.cs | 61 | ||||
| -rw-r--r-- | MediaBrowser.Controller/Session/PlaybackInfo.cs | 38 | ||||
| -rw-r--r-- | MediaBrowser.Controller/Session/SessionInfo.cs | 19 |
4 files changed, 171 insertions, 7 deletions
diff --git a/MediaBrowser.Controller/Session/ISessionManager.cs b/MediaBrowser.Controller/Session/ISessionManager.cs index 1976c653a..0932ee52d 100644 --- a/MediaBrowser.Controller/Session/ISessionManager.cs +++ b/MediaBrowser.Controller/Session/ISessionManager.cs @@ -1,7 +1,9 @@ using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Library; +using MediaBrowser.Model.Session; using System; using System.Collections.Generic; +using System.Threading; using System.Threading.Tasks; namespace MediaBrowser.Controller.Session @@ -12,6 +14,12 @@ namespace MediaBrowser.Controller.Session public interface ISessionManager { /// <summary> + /// Adds the parts. + /// </summary> + /// <param name="remoteControllers">The remote controllers.</param> + void AddParts(IEnumerable<ISessionRemoteController> remoteControllers); + + /// <summary> /// Occurs when [playback start]. /// </summary> event EventHandler<PlaybackProgressEventArgs> PlaybackStart; @@ -47,11 +55,9 @@ namespace MediaBrowser.Controller.Session /// <summary> /// Used to report that playback has started for an item /// </summary> - /// <param name="item">The item.</param> - /// <param name="sessionId">The session id.</param> + /// <param name="info">The info.</param> /// <returns>Task.</returns> - /// <exception cref="System.ArgumentNullException"></exception> - Task OnPlaybackStart(BaseItem item, Guid sessionId); + Task OnPlaybackStart(PlaybackInfo info); /// <summary> /// Used to report playback progress for an item @@ -59,6 +65,7 @@ namespace MediaBrowser.Controller.Session /// <param name="item">The item.</param> /// <param name="positionTicks">The position ticks.</param> /// <param name="isPaused">if set to <c>true</c> [is paused].</param> + /// <param name="isMuted">if set to <c>true</c> [is muted].</param> /// <param name="sessionId">The session id.</param> /// <returns>Task.</returns> /// <exception cref="System.ArgumentNullException"></exception> @@ -73,5 +80,50 @@ namespace MediaBrowser.Controller.Session /// <returns>Task.</returns> /// <exception cref="System.ArgumentNullException"></exception> Task OnPlaybackStopped(BaseItem item, long? positionTicks, Guid sessionId); + + /// <summary> + /// 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> + Task SendSystemCommand(Guid sessionId, SystemCommand command, CancellationToken cancellationToken); + + /// <summary> + /// 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> + Task SendMessageCommand(Guid sessionId, MessageCommand command, CancellationToken cancellationToken); + + /// <summary> + /// 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> + Task SendPlayCommand(Guid sessionId, PlayRequest command, CancellationToken cancellationToken); + + /// <summary> + /// 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> + Task SendBrowseCommand(Guid sessionId, BrowseRequest command, CancellationToken cancellationToken); + + /// <summary> + /// 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> + Task SendPlaystateCommand(Guid sessionId, PlaystateRequest command, CancellationToken cancellationToken); } }
\ No newline at end of file diff --git a/MediaBrowser.Controller/Session/ISessionRemoteController.cs b/MediaBrowser.Controller/Session/ISessionRemoteController.cs new file mode 100644 index 000000000..9ba5c983d --- /dev/null +++ b/MediaBrowser.Controller/Session/ISessionRemoteController.cs @@ -0,0 +1,61 @@ +using MediaBrowser.Model.Session; +using System.Threading; +using System.Threading.Tasks; + +namespace MediaBrowser.Controller.Session +{ + public interface ISessionRemoteController + { + /// <summary> + /// Supportses the specified session. + /// </summary> + /// <param name="session">The session.</param> + /// <returns><c>true</c> if XXXX, <c>false</c> otherwise</returns> + bool Supports(SessionInfo session); + + /// <summary> + /// Sends the system command. + /// </summary> + /// <param name="session">The session.</param> + /// <param name="command">The command.</param> + /// <param name="cancellationToken">The cancellation token.</param> + /// <returns>Task.</returns> + Task SendSystemCommand(SessionInfo session, SystemCommand command, CancellationToken cancellationToken); + + /// <summary> + /// Sends the message command. + /// </summary> + /// <param name="session">The session.</param> + /// <param name="command">The command.</param> + /// <param name="cancellationToken">The cancellation token.</param> + /// <returns>Task.</returns> + Task SendMessageCommand(SessionInfo session, MessageCommand command, CancellationToken cancellationToken); + + /// <summary> + /// Sends the play command. + /// </summary> + /// <param name="session">The session.</param> + /// <param name="command">The command.</param> + /// <param name="cancellationToken">The cancellation token.</param> + /// <returns>Task.</returns> + Task SendPlayCommand(SessionInfo session, PlayRequest command, CancellationToken cancellationToken); + + /// <summary> + /// Sends the browse command. + /// </summary> + /// <param name="session">The session.</param> + /// <param name="command">The command.</param> + /// <param name="cancellationToken">The cancellation token.</param> + /// <returns>Task.</returns> + Task SendBrowseCommand(SessionInfo session, BrowseRequest command, CancellationToken cancellationToken); + + /// <summary> + /// Sends the playstate command. + /// </summary> + /// <param name="session">The session.</param> + /// <param name="command">The command.</param> + /// <param name="cancellationToken">The cancellation token.</param> + /// <returns>Task.</returns> + Task SendPlaystateCommand(SessionInfo session, PlaystateRequest command, CancellationToken cancellationToken); + } +} diff --git a/MediaBrowser.Controller/Session/PlaybackInfo.cs b/MediaBrowser.Controller/Session/PlaybackInfo.cs new file mode 100644 index 000000000..ab3111e76 --- /dev/null +++ b/MediaBrowser.Controller/Session/PlaybackInfo.cs @@ -0,0 +1,38 @@ +using MediaBrowser.Controller.Entities; +using System; +using System.Collections.Generic; + +namespace MediaBrowser.Controller.Session +{ + public class PlaybackInfo + { + public PlaybackInfo() + { + QueueableMediaTypes = new List<string>(); + } + + /// <summary> + /// Gets or sets a value indicating whether this instance can seek. + /// </summary> + /// <value><c>true</c> if this instance can seek; otherwise, <c>false</c>.</value> + public bool CanSeek { get; set; } + + /// <summary> + /// Gets or sets the queueable media types. + /// </summary> + /// <value>The queueable media types.</value> + public List<string> QueueableMediaTypes { get; set; } + + /// <summary> + /// Gets or sets the item. + /// </summary> + /// <value>The item.</value> + public BaseItem Item { get; set; } + + /// <summary> + /// Gets or sets the session id. + /// </summary> + /// <value>The session id.</value> + public Guid SessionId { get; set; } + } +} diff --git a/MediaBrowser.Controller/Session/SessionInfo.cs b/MediaBrowser.Controller/Session/SessionInfo.cs index 6c0f1a085..dc934b70a 100644 --- a/MediaBrowser.Controller/Session/SessionInfo.cs +++ b/MediaBrowser.Controller/Session/SessionInfo.cs @@ -15,9 +15,22 @@ namespace MediaBrowser.Controller.Session public SessionInfo() { WebSockets = new List<IWebSocketConnection>(); + QueueableMediaTypes = new List<string>(); } /// <summary> + /// Gets or sets a value indicating whether this instance can seek. + /// </summary> + /// <value><c>true</c> if this instance can seek; otherwise, <c>false</c>.</value> + public bool CanSeek { get; set; } + + /// <summary> + /// Gets or sets the queueable media types. + /// </summary> + /// <value>The queueable media types.</value> + public List<string> QueueableMediaTypes { get; set; } + + /// <summary> /// Gets or sets the id. /// </summary> /// <value>The id.</value> @@ -70,7 +83,7 @@ namespace MediaBrowser.Controller.Session /// </summary> /// <value>The name of the now viewing item.</value> public string NowViewingItemName { get; set; } - + /// <summary> /// Gets or sets the now playing item. /// </summary> @@ -94,7 +107,7 @@ namespace MediaBrowser.Controller.Session /// </summary> /// <value><c>true</c> if this instance is muted; otherwise, <c>false</c>.</value> public bool IsMuted { get; set; } - + /// <summary> /// Gets or sets the device id. /// </summary> @@ -126,7 +139,7 @@ namespace MediaBrowser.Controller.Session return WebSockets.Any(i => i.State == WebSocketState.Open); } - return (DateTime.UtcNow - LastActivityDate).TotalMinutes <= 5; + return (DateTime.UtcNow - LastActivityDate).TotalMinutes <= 10; } } |
