From 3cb57db7fee72a634fb124bba3f3422128d7ef85 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Fri, 11 Oct 2013 09:47:38 -0400 Subject: [PATCH] fixes #564 - Enforce CanSeek and QueueableMediaTypes --- MediaBrowser.Api/ApiEntryPoint.cs | 3 ++- .../UserLibrary/UserLibraryService.cs | 7 ------- .../Session/SessionManager.cs | 20 +++++++++++++++++++ .../Api/DashboardService.cs | 1 + 4 files changed, 23 insertions(+), 8 deletions(-) diff --git a/MediaBrowser.Api/ApiEntryPoint.cs b/MediaBrowser.Api/ApiEntryPoint.cs index 07b24c259..5cd0aae80 100644 --- a/MediaBrowser.Api/ApiEntryPoint.cs +++ b/MediaBrowser.Api/ApiEntryPoint.cs @@ -182,7 +182,8 @@ namespace MediaBrowser.Api if (job.ActiveRequestCount == 0) { - var timerDuration = type == TranscodingJobType.Progressive ? 1000 : 180000; + // The HLS kill timer is long - 1/2 hr. clients should use the manual kill command when stopping. + var timerDuration = type == TranscodingJobType.Progressive ? 1000 : 1800000; if (job.KillTimer == null) { diff --git a/MediaBrowser.Api/UserLibrary/UserLibraryService.cs b/MediaBrowser.Api/UserLibrary/UserLibraryService.cs index 9c6f5d826..3041ce6ce 100644 --- a/MediaBrowser.Api/UserLibrary/UserLibraryService.cs +++ b/MediaBrowser.Api/UserLibrary/UserLibraryService.cs @@ -224,13 +224,6 @@ namespace MediaBrowser.Api.UserLibrary [Api(Description = "Reports that a user has begun playing an item")] public class OnPlaybackStart : IReturnVoid { - public OnPlaybackStart() - { - // Have to default these until all clients have a chance to incorporate them - CanSeek = true; - QueueableMediaTypes = "Audio,Video,Book,Game"; - } - /// /// Gets or sets the user id. /// diff --git a/MediaBrowser.Server.Implementations/Session/SessionManager.cs b/MediaBrowser.Server.Implementations/Session/SessionManager.cs index 9fb9010e5..3cbd54c7b 100644 --- a/MediaBrowser.Server.Implementations/Session/SessionManager.cs +++ b/MediaBrowser.Server.Implementations/Session/SessionManager.cs @@ -38,6 +38,8 @@ namespace MediaBrowser.Server.Implementations.Session /// private readonly ILogger _logger; + private readonly ILibraryManager _libraryManager; + /// /// Gets or sets the configuration manager. /// @@ -471,6 +473,19 @@ namespace MediaBrowser.Server.Implementations.Session { var session = GetSessionForRemoteControl(sessionId); + if (command.PlayCommand != PlayCommand.PlayNow) + { + if (command.ItemIds.Any(i => + { + var item = _libraryManager.GetItemById(new Guid(i)); + + return !session.QueueableMediaTypes.Contains(item.MediaType, StringComparer.OrdinalIgnoreCase); + })) + { + throw new ArgumentException(string.Format("Session {0} is unable to queue the requested media type.", session.Id)); + } + } + return session.SessionController.SendPlayCommand(command, cancellationToken); } @@ -499,6 +514,11 @@ namespace MediaBrowser.Server.Implementations.Session { var session = GetSessionForRemoteControl(sessionId); + if (command.Command == PlaystateCommand.Seek && !session.CanSeek) + { + throw new ArgumentException(string.Format("Session {0} is unable to seek.", session.Id)); + } + return session.SessionController.SendPlaystateCommand(command, cancellationToken); } diff --git a/MediaBrowser.WebDashboard/Api/DashboardService.cs b/MediaBrowser.WebDashboard/Api/DashboardService.cs index 992931947..ac38b767c 100644 --- a/MediaBrowser.WebDashboard/Api/DashboardService.cs +++ b/MediaBrowser.WebDashboard/Api/DashboardService.cs @@ -374,6 +374,7 @@ namespace MediaBrowser.WebDashboard.Api sb.Append(""); sb.Append(""); + sb.Append(""); //sb.Append(""); // http://developer.apple.com/library/ios/#DOCUMENTATION/AppleApplications/Reference/SafariWebContent/ConfiguringWebApplications/ConfiguringWebApplications.html