From 44f33fdb555aa9be3d710f7e81b995730ae836be Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Fri, 10 May 2013 08:18:07 -0400 Subject: progress on remote control --- MediaBrowser.Controller/Session/ISessionManager.cs | 16 ++----- MediaBrowser.Controller/Session/SessionInfo.cs | 54 ++++++++++++++++++++++ 2 files changed, 59 insertions(+), 11 deletions(-) (limited to 'MediaBrowser.Controller/Session') diff --git a/MediaBrowser.Controller/Session/ISessionManager.cs b/MediaBrowser.Controller/Session/ISessionManager.cs index 66facdf6d..8227170d4 100644 --- a/MediaBrowser.Controller/Session/ISessionManager.cs +++ b/MediaBrowser.Controller/Session/ISessionManager.cs @@ -3,7 +3,6 @@ using MediaBrowser.Controller.Library; using System; using System.Collections.Generic; using System.Threading.Tasks; -using MediaBrowser.Model.Session; namespace MediaBrowser.Controller.Session { @@ -28,16 +27,10 @@ namespace MediaBrowser.Controller.Session event EventHandler PlaybackStopped; /// - /// Gets all connections. + /// Gets the sessions. /// - /// All connections. - IEnumerable AllConnections { get; } - - /// - /// Gets the active connections. - /// - /// The active connections. - IEnumerable RecentConnections { get; } + /// The sessions. + IEnumerable Sessions { get; } /// /// Logs the user activity. @@ -67,12 +60,13 @@ namespace MediaBrowser.Controller.Session /// The user. /// The item. /// The position ticks. + /// if set to true [is paused]. /// Type of the client. /// The device id. /// Name of the device. /// Task. /// - Task OnPlaybackProgress(User user, BaseItem item, long? positionTicks, string clientType, string deviceId, string deviceName); + Task OnPlaybackProgress(User user, BaseItem item, long? positionTicks, bool isPaused, string clientType, string deviceId, string deviceName); /// /// Used to report that playback has ended for an item diff --git a/MediaBrowser.Controller/Session/SessionInfo.cs b/MediaBrowser.Controller/Session/SessionInfo.cs index 21c65df97..93ef4f694 100644 --- a/MediaBrowser.Controller/Session/SessionInfo.cs +++ b/MediaBrowser.Controller/Session/SessionInfo.cs @@ -1,5 +1,6 @@ using MediaBrowser.Common.Net; using MediaBrowser.Controller.Entities; +using MediaBrowser.Model.Net; using System; namespace MediaBrowser.Controller.Session @@ -39,6 +40,24 @@ namespace MediaBrowser.Controller.Session /// The name of the device. public string DeviceName { get; set; } + /// + /// Gets or sets the now viewing context. + /// + /// The now viewing context. + public string NowViewingContext { get; set; } + + /// + /// Gets or sets the type of the now viewing item. + /// + /// The type of the now viewing item. + public string NowViewingItemType { get; set; } + + /// + /// Gets or sets the now viewing item identifier. + /// + /// The now viewing item identifier. + public string NowViewingItemIdentifier { get; set; } + /// /// Gets or sets the now playing item. /// @@ -51,6 +70,12 @@ namespace MediaBrowser.Controller.Session /// The now playing position ticks. public long? NowPlayingPositionTicks { get; set; } + /// + /// Gets or sets a value indicating whether this instance is paused. + /// + /// true if this instance is paused; otherwise, false. + public bool? IsPaused { get; set; } + /// /// Gets or sets the device id. /// @@ -62,5 +87,34 @@ namespace MediaBrowser.Controller.Session /// /// The web socket. public IWebSocketConnection WebSocket { get; set; } + + /// + /// Gets a value indicating whether this instance is active. + /// + /// true if this instance is active; otherwise, false. + public bool IsActive + { + get + { + if (WebSocket != null) + { + return WebSocket.State == WebSocketState.Open; + } + + return (DateTime.UtcNow - LastActivityDate).TotalMinutes <= 5; + } + } + + /// + /// Gets a value indicating whether [supports remote control]. + /// + /// true if [supports remote control]; otherwise, false. + public bool SupportsRemoteControl + { + get + { + return WebSocket != null && WebSocket.State == WebSocketState.Open; + } + } } } -- cgit v1.2.3