diff --git a/MediaBrowser.Api/SessionsService.cs b/MediaBrowser.Api/SessionsService.cs index 8d5e9e0d7..5433ecc2e 100644 --- a/MediaBrowser.Api/SessionsService.cs +++ b/MediaBrowser.Api/SessionsService.cs @@ -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 + { + /// + /// Gets or sets the id. + /// + /// The id. + [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; } + } + /// /// Class SessionsService /// @@ -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(); + } } } diff --git a/MediaBrowser.Controller/Session/SessionInfo.cs b/MediaBrowser.Controller/Session/SessionInfo.cs index b05a68a84..f84204d11 100644 --- a/MediaBrowser.Controller/Session/SessionInfo.cs +++ b/MediaBrowser.Controller/Session/SessionInfo.cs @@ -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(); + PlayableMediaTypes = new List + { + MediaType.Audio, + MediaType.Book, + MediaType.Game, + MediaType.Photo, + MediaType.Video + }; AdditionalUsers = new List(); } public List AdditionalUsers { get; set; } - + /// /// Gets or sets the remote end point. /// @@ -37,7 +46,13 @@ namespace MediaBrowser.Controller.Session /// /// The queueable media types. public List QueueableMediaTypes { get; set; } - + + /// + /// Gets or sets the playable media types. + /// + /// The playable media types. + public List PlayableMediaTypes { get; set; } + /// /// Gets or sets the id. /// @@ -169,7 +184,7 @@ namespace MediaBrowser.Controller.Session { return SessionController.SupportsMediaRemoteControl; } - + return false; } } diff --git a/MediaBrowser.Model/Session/SessionInfoDto.cs b/MediaBrowser.Model/Session/SessionInfoDto.cs index 711690022..dabafad7b 100644 --- a/MediaBrowser.Model/Session/SessionInfoDto.cs +++ b/MediaBrowser.Model/Session/SessionInfoDto.cs @@ -24,6 +24,12 @@ namespace MediaBrowser.Model.Session /// /// The queueable media types. public List QueueableMediaTypes { get; set; } + + /// + /// Gets or sets the playable media types. + /// + /// The playable media types. + public List PlayableMediaTypes { get; set; } /// /// Gets or sets the id. @@ -138,6 +144,9 @@ namespace MediaBrowser.Model.Session public SessionInfoDto() { AdditionalUsers = new List(); + + PlayableMediaTypes = new List(); + QueueableMediaTypes = new List(); } } diff --git a/MediaBrowser.Server.Implementations/Dto/DtoService.cs b/MediaBrowser.Server.Implementations/Dto/DtoService.cs index 0f6d680b1..59accba1f 100644 --- a/MediaBrowser.Server.Implementations/Dto/DtoService.cs +++ b/MediaBrowser.Server.Implementations/Dto/DtoService.cs @@ -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 };