updated nuget

This commit is contained in:
Luke Pulverenti
2013-10-02 21:22:50 -04:00
parent 33a3e215d0
commit eb72c2db51
18 changed files with 390 additions and 235 deletions

View File

@@ -1,4 +1,5 @@
using MediaBrowser.Model.Session;
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Session;
using System.Threading;
using System.Threading.Tasks;
@@ -7,55 +8,70 @@ namespace MediaBrowser.Controller.Session
public interface ISessionController
{
/// <summary>
/// Supportses the specified session.
/// Gets a value indicating whether [supports media remote control].
/// </summary>
/// <param name="session">The session.</param>
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise</returns>
bool Supports(SessionInfo session);
/// <value><c>true</c> if [supports media remote control]; otherwise, <c>false</c>.</value>
bool SupportsMediaRemoteControl { get; }
/// <summary>
/// Gets a value indicating whether this instance is session active.
/// </summary>
/// <value><c>true</c> if this instance is session active; otherwise, <c>false</c>.</value>
bool IsSessionActive { get; }
/// <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);
Task SendSystemCommand(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);
Task SendMessageCommand(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);
Task SendPlayCommand(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);
Task SendBrowseCommand(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);
Task SendPlaystateCommand(PlaystateRequest command, CancellationToken cancellationToken);
/// <summary>
/// Sends the library update info.
/// </summary>
/// <param name="info">The info.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task.</returns>
Task SendLibraryUpdateInfo(LibraryUpdateInfo info, CancellationToken cancellationToken);
/// <summary>
/// Sends the restart required message.
/// </summary>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task.</returns>
Task SendRestartRequiredMessage(CancellationToken cancellationToken);
}
}

View File

@@ -13,12 +13,6 @@ namespace MediaBrowser.Controller.Session
/// </summary>
public interface ISessionManager
{
/// <summary>
/// Adds the parts.
/// </summary>
/// <param name="remoteControllers">The remote controllers.</param>
void AddParts(IEnumerable<ISessionController> remoteControllers);
/// <summary>
/// Occurs when [playback start].
/// </summary>
@@ -119,5 +113,12 @@ namespace MediaBrowser.Controller.Session
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task.</returns>
Task SendPlaystateCommand(Guid sessionId, PlaystateRequest command, CancellationToken cancellationToken);
/// <summary>
/// Sends the restart required message.
/// </summary>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task.</returns>
Task SendRestartRequiredMessage(CancellationToken cancellationToken);
}
}

View File

@@ -1,9 +1,6 @@
using MediaBrowser.Common.Net;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Model.Net;
using MediaBrowser.Controller.Entities;
using System;
using System.Collections.Generic;
using System.Linq;
namespace MediaBrowser.Controller.Session
{
@@ -14,7 +11,6 @@ namespace MediaBrowser.Controller.Session
{
public SessionInfo()
{
WebSockets = new List<IWebSocketConnection>();
QueueableMediaTypes = new List<string>();
}
@@ -114,18 +110,18 @@ namespace MediaBrowser.Controller.Session
/// <value>The device id.</value>
public string DeviceId { get; set; }
/// <summary>
/// Gets or sets the web socket.
/// </summary>
/// <value>The web socket.</value>
public List<IWebSocketConnection> WebSockets { get; set; }
/// <summary>
/// Gets or sets the application version.
/// </summary>
/// <value>The application version.</value>
public string ApplicationVersion { get; set; }
/// <summary>
/// Gets or sets the session controller.
/// </summary>
/// <value>The session controller.</value>
public ISessionController SessionController { get; set; }
/// <summary>
/// Gets a value indicating whether this instance is active.
/// </summary>
@@ -134,9 +130,9 @@ namespace MediaBrowser.Controller.Session
{
get
{
if (WebSockets.Count > 0)
if (SessionController != null)
{
return WebSockets.Any(i => i.State == WebSocketState.Open);
return SessionController.IsSessionActive;
}
return (DateTime.UtcNow - LastActivityDate).TotalMinutes <= 10;
@@ -151,7 +147,12 @@ namespace MediaBrowser.Controller.Session
{
get
{
return WebSockets.Any(i => i.State == WebSocketState.Open);
if (SessionController != null)
{
return SessionController.SupportsMediaRemoteControl;
}
return false;
}
}
}