aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2014-01-05 00:34:06 -0500
committerLuke Pulverenti <luke.pulverenti@gmail.com>2014-01-05 00:34:06 -0500
commitd365e1df238acfdc974ea8f42668d2c88a3d961f (patch)
treed6ea5e0426da6802939e8d82968cb71fb7ee5808
parentbe0f683e624cd04df17a73cce8f8ceb2be90d40a (diff)
fixes #574 - Add ability to report playable media types
-rw-r--r--MediaBrowser.Api/SessionsService.cs24
-rw-r--r--MediaBrowser.Controller/Session/SessionInfo.cs21
-rw-r--r--MediaBrowser.Model/Session/SessionInfoDto.cs9
-rw-r--r--MediaBrowser.Server.Implementations/Dto/DtoService.cs1
4 files changed, 52 insertions, 3 deletions
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
+ {
+ /// <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.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<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.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
/// </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>();
}
}
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
};