diff options
| author | Luke <luke.pulverenti@gmail.com> | 2017-05-31 15:40:34 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-05-31 15:40:34 -0400 |
| commit | 91176d9ccc1dde8155c10411c70e62a9f4b059d5 (patch) | |
| tree | 21365f5a8dd09534a53d9f88d2a7a3116f3f3f98 /MediaBrowser.Api/UserLibrary/PlaystateService.cs | |
| parent | c37c9a75073b1b9caa3af2c3bc62abd837bd630e (diff) | |
| parent | 4e10daf646e0788409f2bc52ef70effa2616e3f3 (diff) | |
Merge pull request #2677 from MediaBrowser/beta
Beta
Diffstat (limited to 'MediaBrowser.Api/UserLibrary/PlaystateService.cs')
| -rw-r--r-- | MediaBrowser.Api/UserLibrary/PlaystateService.cs | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/MediaBrowser.Api/UserLibrary/PlaystateService.cs b/MediaBrowser.Api/UserLibrary/PlaystateService.cs index c4cc90955..98b4a5d5d 100644 --- a/MediaBrowser.Api/UserLibrary/PlaystateService.cs +++ b/MediaBrowser.Api/UserLibrary/PlaystateService.cs @@ -279,6 +279,20 @@ namespace MediaBrowser.Api.UserLibrary return dto; } + private PlayMethod ValidatePlayMethod(PlayMethod method, string playSessionId) + { + if (method == PlayMethod.Transcode) + { + var job = string.IsNullOrWhiteSpace(playSessionId) ? null : ApiEntryPoint.Instance.GetTranscodingJob(playSessionId); + if (job == null) + { + return PlayMethod.DirectPlay; + } + } + + return method; + } + /// <summary> /// Posts the specified request. /// </summary> @@ -300,6 +314,8 @@ namespace MediaBrowser.Api.UserLibrary public void Post(ReportPlaybackStart request) { + request.PlayMethod = ValidatePlayMethod(request.PlayMethod, request.PlaySessionId); + request.SessionId = GetSession(_sessionContext).Result.Id; var task = _sessionManager.OnPlaybackStart(request); @@ -332,6 +348,8 @@ namespace MediaBrowser.Api.UserLibrary public void Post(ReportPlaybackProgress request) { + request.PlayMethod = ValidatePlayMethod(request.PlayMethod, request.PlaySessionId); + request.SessionId = GetSession(_sessionContext).Result.Id; var task = _sessionManager.OnPlaybackProgress(request); @@ -427,7 +445,7 @@ namespace MediaBrowser.Api.UserLibrary await item.MarkUnplayed(user).ConfigureAwait(false); } - return await _userDataRepository.GetUserDataDto(item, user).ConfigureAwait(false); + return _userDataRepository.GetUserDataDto(item, user); } } }
\ No newline at end of file |
