added model classes for remote control

This commit is contained in:
Luke Pulverenti
2013-05-09 18:43:11 -04:00
parent 2b28320764
commit 35a7986b3f
22 changed files with 289 additions and 30 deletions

View File

@@ -868,7 +868,7 @@ namespace MediaBrowser.Controller.Dto
return GetClientItemId(indexFolder.Parent) + IndexFolderDelimeter + (indexFolder.IndexName ?? string.Empty) + IndexFolderDelimeter + indexFolder.Id;
}
return item.Id.ToString();
return item.Id.ToString("N");
}
/// <summary>

View File

@@ -0,0 +1,45 @@
using MediaBrowser.Controller.Session;
using MediaBrowser.Model.Net;
using MediaBrowser.Model.Session;
namespace MediaBrowser.Controller.Dto
{
/// <summary>
/// Class SessionInfoDtoBuilder
/// </summary>
public static class SessionInfoDtoBuilder
{
/// <summary>
/// Gets the session info dto.
/// </summary>
/// <param name="session">The session.</param>
/// <returns>SessionInfoDto.</returns>
public static SessionInfoDto GetSessionInfoDto(SessionInfo session)
{
var dto = new SessionInfoDto
{
Client = session.Client,
DeviceId = session.DeviceId,
DeviceName = session.DeviceName,
Id = session.Id,
LastActivityDate = session.LastActivityDate,
NowPlayingPositionTicks = session.NowPlayingPositionTicks
};
if (session.NowPlayingItem != null)
{
dto.NowPlayingItem = DtoBuilder.GetBaseItemInfo(session.NowPlayingItem);
}
if (session.UserId.HasValue)
{
dto.UserId = session.UserId.Value.ToString("N");
}
dto.SupportsRemoteControl = session.WebSocket != null &&
session.WebSocket.State == WebSocketState.Open;
return dto;
}
}
}

View File

@@ -41,7 +41,7 @@ namespace MediaBrowser.Controller.Dto
var dto = new UserDto
{
Id = user.Id.ToString(),
Id = user.Id.ToString("N"),
Name = user.Name,
HasPassword = !String.IsNullOrEmpty(user.Password),
LastActivityDate = user.LastActivityDate,

View File

@@ -70,6 +70,7 @@
<Link>Properties\SharedVersion.cs</Link>
</Compile>
<Compile Include="Configuration\IServerConfigurationManager.cs" />
<Compile Include="Dto\SessionInfoDtoBuilder.cs" />
<Compile Include="Session\ISessionManager.cs" />
<Compile Include="Drawing\ImageExtensions.cs" />
<Compile Include="Drawing\ImageHeader.cs" />
@@ -191,6 +192,7 @@
<Compile Include="Providers\FolderProviderFromXml.cs" />
<Compile Include="Providers\ImageFromMediaLocationProvider.cs" />
<Compile Include="Providers\MediaInfo\FFProbeVideoInfoProvider.cs" />
<Compile Include="Session\SessionInfo.cs" />
<Compile Include="Sorting\IBaseItemComparer.cs" />
<Compile Include="Sorting\IUserBaseItemComparer.cs" />
<Compile Include="Updates\IInstallationManager.cs" />

View File

@@ -0,0 +1,66 @@
using MediaBrowser.Common.Net;
using MediaBrowser.Controller.Entities;
using System;
namespace MediaBrowser.Controller.Session
{
/// <summary>
/// Class SessionInfo
/// </summary>
public class SessionInfo
{
/// <summary>
/// Gets or sets the id.
/// </summary>
/// <value>The id.</value>
public Guid Id { get; set; }
/// <summary>
/// Gets or sets the user id.
/// </summary>
/// <value>The user id.</value>
public Guid? UserId { get; set; }
/// <summary>
/// Gets or sets the type of the client.
/// </summary>
/// <value>The type of the client.</value>
public string Client { get; set; }
/// <summary>
/// Gets or sets the last activity date.
/// </summary>
/// <value>The last activity date.</value>
public DateTime LastActivityDate { get; set; }
/// <summary>
/// Gets or sets the name of the device.
/// </summary>
/// <value>The name of the device.</value>
public string DeviceName { get; set; }
/// <summary>
/// Gets or sets the now playing item.
/// </summary>
/// <value>The now playing item.</value>
public BaseItem NowPlayingItem { get; set; }
/// <summary>
/// Gets or sets the now playing position ticks.
/// </summary>
/// <value>The now playing position ticks.</value>
public long? NowPlayingPositionTicks { get; set; }
/// <summary>
/// Gets or sets the device id.
/// </summary>
/// <value>The device id.</value>
public string DeviceId { get; set; }
/// <summary>
/// Gets or sets the web socket.
/// </summary>
/// <value>The web socket.</value>
public IWebSocketConnection WebSocket { get; set; }
}
}