diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2017-04-17 16:33:07 -0400 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2017-04-17 16:33:07 -0400 |
| commit | eb9b63c7a711528089b6d418f98a2b63870392e7 (patch) | |
| tree | f575803110c3989f1df24b62058c408a179ce6ca | |
| parent | 561028c90734b911ebb5eec26aa071fb6851a2a6 (diff) | |
update playback progress reporting
| -rw-r--r-- | Emby.Dlna/PlayTo/PlayToController.cs | 3 | ||||
| -rw-r--r-- | Emby.Server.Implementations/Session/SessionManager.cs | 24 | ||||
| -rw-r--r-- | Emby.Server.Implementations/Session/SessionWebSocketListener.cs | 6 | ||||
| -rw-r--r-- | MediaBrowser.Api/UserLibrary/PlaystateService.cs | 10 | ||||
| -rw-r--r-- | MediaBrowser.Controller/Session/SessionInfo.cs | 22 | ||||
| -rw-r--r-- | MediaBrowser.Model/Session/PlaybackStartInfo.cs | 13 | ||||
| -rw-r--r-- | MediaBrowser.Model/Session/SessionInfoDto.cs | 7 |
7 files changed, 21 insertions, 64 deletions
diff --git a/Emby.Dlna/PlayTo/PlayToController.cs b/Emby.Dlna/PlayTo/PlayToController.cs index b73332c4b..3a7e75381 100644 --- a/Emby.Dlna/PlayTo/PlayToController.cs +++ b/Emby.Dlna/PlayTo/PlayToController.cs @@ -318,8 +318,7 @@ namespace Emby.Dlna.PlayTo CanSeek = info.MediaSource == null ? _device.Duration.HasValue : info.MediaSource.RunTimeTicks.HasValue, - PlayMethod = info.IsDirectStream ? PlayMethod.DirectStream : PlayMethod.Transcode, - QueueableMediaTypes = new List<string> { mediaInfo.MediaType } + PlayMethod = info.IsDirectStream ? PlayMethod.DirectStream : PlayMethod.Transcode }; } diff --git a/Emby.Server.Implementations/Session/SessionManager.cs b/Emby.Server.Implementations/Session/SessionManager.cs index 63556c1ce..0a2312735 100644 --- a/Emby.Server.Implementations/Session/SessionManager.cs +++ b/Emby.Server.Implementations/Session/SessionManager.cs @@ -612,8 +612,7 @@ namespace Emby.Server.Implementations.Session ClearTranscodingInfo(session.DeviceId); } - session.StopAutomaticProgress(); - session.QueueableMediaTypes = info.QueueableMediaTypes; + session.StartAutomaticProgress(_timerFactory, info); var users = GetUsers(session); @@ -720,7 +719,11 @@ namespace Emby.Server.Implementations.Session }, _logger); - session.StartAutomaticProgress(_timerFactory, info); + if (!isAutomated) + { + session.StartAutomaticProgress(_timerFactory, info); + } + StartIdleCheckTimer(); } @@ -1005,19 +1008,9 @@ namespace Emby.Server.Implementations.Session } } - if (command.PlayCommand != PlayCommand.PlayNow) + if (items.Any(i => !session.PlayableMediaTypes.Contains(i.MediaType, StringComparer.OrdinalIgnoreCase))) { - if (items.Any(i => !session.QueueableMediaTypes.Contains(i.MediaType, StringComparer.OrdinalIgnoreCase))) - { - throw new ArgumentException(string.Format("{0} is unable to queue the requested media type.", session.DeviceName ?? session.Id)); - } - } - else - { - if (items.Any(i => !session.PlayableMediaTypes.Contains(i.MediaType, StringComparer.OrdinalIgnoreCase))) - { - throw new ArgumentException(string.Format("{0} is unable to play the requested media type.", session.DeviceName ?? session.Id)); - } + throw new ArgumentException(string.Format("{0} is unable to play the requested media type.", session.DeviceName ?? session.Id)); } if (user != null && command.ItemIds.Length == 1 && user.Configuration.EnableNextEpisodeAutoPlay) @@ -1597,7 +1590,6 @@ namespace Emby.Server.Implementations.Session LastActivityDate = session.LastActivityDate, NowViewingItem = session.NowViewingItem, ApplicationVersion = session.ApplicationVersion, - QueueableMediaTypes = session.QueueableMediaTypes, PlayableMediaTypes = session.PlayableMediaTypes, AdditionalUsers = session.AdditionalUsers, SupportedCommands = session.SupportedCommands, diff --git a/Emby.Server.Implementations/Session/SessionWebSocketListener.cs b/Emby.Server.Implementations/Session/SessionWebSocketListener.cs index 336c2caee..478f9da71 100644 --- a/Emby.Server.Implementations/Session/SessionWebSocketListener.cs +++ b/Emby.Server.Implementations/Session/SessionWebSocketListener.cs @@ -289,7 +289,6 @@ namespace Emby.Server.Implementations.Session var itemId = vals[0]; - var queueableMediaTypes = string.Empty; var canSeek = true; if (vals.Length > 1) @@ -298,15 +297,14 @@ namespace Emby.Server.Implementations.Session } if (vals.Length > 2) { - queueableMediaTypes = vals[2]; + // vals[2] used to be QueueableMediaTypes } var info = new PlaybackStartInfo { CanSeek = canSeek, ItemId = itemId, - SessionId = session.Id, - QueueableMediaTypes = queueableMediaTypes.Split(',').ToList() + SessionId = session.Id }; if (vals.Length > 3) diff --git a/MediaBrowser.Api/UserLibrary/PlaystateService.cs b/MediaBrowser.Api/UserLibrary/PlaystateService.cs index 504dd29a7..c4cc90955 100644 --- a/MediaBrowser.Api/UserLibrary/PlaystateService.cs +++ b/MediaBrowser.Api/UserLibrary/PlaystateService.cs @@ -109,13 +109,6 @@ namespace MediaBrowser.Api.UserLibrary [ApiMember(Name = "CanSeek", Description = "Indicates if the client can seek", IsRequired = false, DataType = "boolean", ParameterType = "query", Verb = "POST")] public bool CanSeek { get; set; } - /// <summary> - /// Gets or sets the id. - /// </summary> - /// <value>The id.</value> - [ApiMember(Name = "QueueableMediaTypes", Description = "A list of media types that can be queued from this item, comma delimited. Audio,Video,Book,Game", IsRequired = true, DataType = "string", ParameterType = "query", Verb = "POST", AllowMultiple = true)] - public string QueueableMediaTypes { get; set; } - [ApiMember(Name = "AudioStreamIndex", IsRequired = false, DataType = "int", ParameterType = "query", Verb = "POST")] public int? AudioStreamIndex { get; set; } @@ -292,13 +285,10 @@ namespace MediaBrowser.Api.UserLibrary /// <param name="request">The request.</param> public void Post(OnPlaybackStart request) { - var queueableMediaTypes = request.QueueableMediaTypes ?? string.Empty; - Post(new ReportPlaybackStart { CanSeek = request.CanSeek, ItemId = request.Id, - QueueableMediaTypes = queueableMediaTypes.Split(',').ToList(), MediaSourceId = request.MediaSourceId, AudioStreamIndex = request.AudioStreamIndex, SubtitleStreamIndex = request.SubtitleStreamIndex, diff --git a/MediaBrowser.Controller/Session/SessionInfo.cs b/MediaBrowser.Controller/Session/SessionInfo.cs index 4cb08de9f..5cef56d1c 100644 --- a/MediaBrowser.Controller/Session/SessionInfo.cs +++ b/MediaBrowser.Controller/Session/SessionInfo.cs @@ -21,7 +21,6 @@ namespace MediaBrowser.Controller.Session { _sessionManager = sessionManager; _logger = logger; - QueueableMediaTypes = new List<string>(); AdditionalUsers = new List<SessionUserInfo>(); PlayState = new PlayerStateInfo(); @@ -40,12 +39,6 @@ namespace MediaBrowser.Controller.Session public string RemoteEndPoint { get; set; } /// <summary> - /// Gets or sets the queueable media types. - /// </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> @@ -214,12 +207,14 @@ namespace MediaBrowser.Controller.Session { _lastProgressInfo = progressInfo; - if (_progressTimer != null) + if (_progressTimer == null) { - return; + _progressTimer = timerFactory.Create(OnProgressTimerCallback, null, 1000, 1000); + } + else + { + _progressTimer.Change(1000, 1000); } - - _progressTimer = timerFactory.Create(OnProgressTimerCallback, null, 1000, 1000); } } @@ -237,10 +232,11 @@ namespace MediaBrowser.Controller.Session { return; } + var positionTicks = progressInfo.PositionTicks ?? 0; - if (positionTicks <= 0) + if (positionTicks < 0) { - return; + positionTicks = 0; } var newPositionTicks = positionTicks + ProgressIncrement; diff --git a/MediaBrowser.Model/Session/PlaybackStartInfo.cs b/MediaBrowser.Model/Session/PlaybackStartInfo.cs index d1ea2841e..f6f496e4e 100644 --- a/MediaBrowser.Model/Session/PlaybackStartInfo.cs +++ b/MediaBrowser.Model/Session/PlaybackStartInfo.cs @@ -1,5 +1,4 @@ -using System.Collections.Generic; - + namespace MediaBrowser.Model.Session { /// <summary> @@ -7,15 +6,5 @@ namespace MediaBrowser.Model.Session /// </summary> public class PlaybackStartInfo : PlaybackProgressInfo { - public PlaybackStartInfo() - { - QueueableMediaTypes = new List<string>(); - } - - /// <summary> - /// Gets or sets the queueable media types. - /// </summary> - /// <value>The queueable media types.</value> - public List<string> QueueableMediaTypes { get; set; } } } diff --git a/MediaBrowser.Model/Session/SessionInfoDto.cs b/MediaBrowser.Model/Session/SessionInfoDto.cs index 42263c644..0909d255a 100644 --- a/MediaBrowser.Model/Session/SessionInfoDto.cs +++ b/MediaBrowser.Model/Session/SessionInfoDto.cs @@ -15,12 +15,6 @@ namespace MediaBrowser.Model.Session public List<string> SupportedCommands { get; set; } /// <summary> - /// Gets or sets the queueable media types. - /// </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> @@ -119,7 +113,6 @@ namespace MediaBrowser.Model.Session AdditionalUsers = new List<SessionUserInfo>(); PlayableMediaTypes = new List<string>(); - QueueableMediaTypes = new List<string>(); SupportedCommands = new List<string>(); } } |
