The Free Software Media System - Server Backend & API
fixes #574 - Add ability to report playable media types
Luke Pulverentid365e1df238a
diff --git a/MediaBrowser.Api/SessionsService.cs b/MediaBrowser.Api/SessionsService.csindex 8d5e9e0d7d..5433ecc2e3 100644--- a/MediaBrowser.Api/SessionsService.cs+++ b/MediaBrowser.Api/SessionsService.cs@@ -194,6 +194,21 @@ namespace MediaBrowser.Apipublic 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();+ }}}diff --git a/MediaBrowser.Controller/Session/SessionInfo.cs b/MediaBrowser.Controller/Session/SessionInfo.csindex b05a68a842..f84204d11b 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.Sessionpublic 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;}}diff --git a/MediaBrowser.Model/Session/SessionInfoDto.cs b/MediaBrowser.Model/Session/SessionInfoDto.csindex 7116900227..dabafad7ba 100644--- a/MediaBrowser.Model/Session/SessionInfoDto.cs+++ b/MediaBrowser.Model/Session/SessionInfoDto.cs@@ -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.Sessionpublic SessionInfoDto(){AdditionalUsers = new List<SessionUserInfo>();++ PlayableMediaTypes = new List<string>();+ QueueableMediaTypes = new List<string>();}}diff --git a/MediaBrowser.Server.Implementations/Dto/DtoService.cs b/MediaBrowser.Server.Implementations/Dto/DtoService.csindex 0f6d680b12..59accba1f3 100644--- a/MediaBrowser.Server.Implementations/Dto/DtoService.cs+++ b/MediaBrowser.Server.Implementations/Dto/DtoService.cs@@ -244,6 +244,7 @@ namespace MediaBrowser.Server.Implementations.DtoApplicationVersion = session.ApplicationVersion,CanSeek = session.CanSeek,QueueableMediaTypes = session.QueueableMediaTypes,+ PlayableMediaTypes = session.PlayableMediaTypes,RemoteEndPoint = session.RemoteEndPoint,AdditionalUsers = session.AdditionalUsers};