diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2013-10-11 09:47:38 -0400 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2013-10-11 09:47:38 -0400 |
| commit | 3cb57db7fee72a634fb124bba3f3422128d7ef85 (patch) | |
| tree | 8f8cf230efddc150b1da58377ca0d4eecdd6ba7e /MediaBrowser.Server.Implementations/Session | |
| parent | 204f7f68792e629acc78b6a9a2a53b63b35d8cac (diff) | |
fixes #564 - Enforce CanSeek and QueueableMediaTypes
Diffstat (limited to 'MediaBrowser.Server.Implementations/Session')
| -rw-r--r-- | MediaBrowser.Server.Implementations/Session/SessionManager.cs | 20 |
1 files changed, 20 insertions, 0 deletions
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 /// </summary> private readonly ILogger _logger; + private readonly ILibraryManager _libraryManager; + /// <summary> /// Gets or sets the configuration manager. /// </summary> @@ -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); } |
