fixes #574 - Add ability to report playable media types

This commit is contained in:
Luke Pulverenti 2014-01-05 00:34:06 -05:00
parent be0f683e62
commit d365e1df23
4 changed files with 52 additions and 3 deletions

View File

@ -194,6 +194,21 @@ namespace MediaBrowser.Api
public Guid UserId { get; set; }
}
[Route("/Sessions/{Id}/Capabilities", "POST")]
[Api(("Updates capabilities for a device"))]
public class PostCapabilities : IReturnVoid
{
/// <summary>
/// Gets or sets the id.
/// </summary>
/// <value>The id.</value>
[ApiMember(Name = "Id", Description = "Session Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "POST")]
public Guid Id { get; set; }
[ApiMember(Name = "PlayableMediaTypes", Description = "A list of playable media types, comma delimited.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "POST")]
public string PlayableMediaTypes { get; set; }
}
/// <summary>
/// Class SessionsService
/// </summary>
@ -335,5 +350,14 @@ namespace MediaBrowser.Api
{
_sessionManager.RemoveAdditionalUser(request.Id, request.UserId);
}
public void Post(PostCapabilities request)
{
var session = _sessionManager.Sessions.First(i => i.Id == request.Id);
session.PlayableMediaTypes = request.PlayableMediaTypes
.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries)
.ToList();
}
}
}

View File

@ -1,4 +1,5 @@
using MediaBrowser.Controller.Entities;
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Session;
using System;
using System.Collections.Generic;
@ -14,12 +15,20 @@ namespace MediaBrowser.Controller.Session
public SessionInfo()
{
QueueableMediaTypes = new List<string>();
PlayableMediaTypes = new List<string>
{
MediaType.Audio,
MediaType.Book,
MediaType.Game,
MediaType.Photo,
MediaType.Video
};
AdditionalUsers = new List<SessionUserInfo>();
}
public List<SessionUserInfo> AdditionalUsers { get; set; }
/// <summary>
/// Gets or sets the remote end point.
/// </summary>
@ -37,7 +46,13 @@ namespace MediaBrowser.Controller.Session
/// </summary>
/// <value>The queueable media types.</value>
public List<string> QueueableMediaTypes { get; set; }
/// <summary>
/// Gets or sets the playable media types.
/// </summary>
/// <value>The playable media types.</value>
public List<string> PlayableMediaTypes { get; set; }
/// <summary>
/// Gets or sets the id.
/// </summary>
@ -169,7 +184,7 @@ namespace MediaBrowser.Controller.Session
{
return SessionController.SupportsMediaRemoteControl;
}
return false;
}
}

View File

@ -24,6 +24,12 @@ namespace MediaBrowser.Model.Session
/// </summary>
/// <value>The queueable media types.</value>
public List<string> QueueableMediaTypes { get; set; }
/// <summary>
/// Gets or sets the playable media types.
/// </summary>
/// <value>The playable media types.</value>
public List<string> PlayableMediaTypes { get; set; }
/// <summary>
/// Gets or sets the id.
@ -138,6 +144,9 @@ namespace MediaBrowser.Model.Session
public SessionInfoDto()
{
AdditionalUsers = new List<SessionUserInfo>();
PlayableMediaTypes = new List<string>();
QueueableMediaTypes = new List<string>();
}
}

View File

@ -244,6 +244,7 @@ namespace MediaBrowser.Server.Implementations.Dto
ApplicationVersion = session.ApplicationVersion,
CanSeek = session.CanSeek,
QueueableMediaTypes = session.QueueableMediaTypes,
PlayableMediaTypes = session.PlayableMediaTypes,
RemoteEndPoint = session.RemoteEndPoint,
AdditionalUsers = session.AdditionalUsers
};