diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2017-05-30 14:24:50 -0400 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2017-05-30 14:24:50 -0400 |
| commit | d8ec7109ab5ec561254465e1664974049cc556d7 (patch) | |
| tree | b91f6642d01828f32120650129905c6d53a328bb /MediaBrowser.Api/UserLibrary/PlaystateService.cs | |
| parent | 01843ad4c3739399059a82d47032303b74972c40 (diff) | |
add FindByPath error handling
Diffstat (limited to 'MediaBrowser.Api/UserLibrary/PlaystateService.cs')
| -rw-r--r-- | MediaBrowser.Api/UserLibrary/PlaystateService.cs | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/MediaBrowser.Api/UserLibrary/PlaystateService.cs b/MediaBrowser.Api/UserLibrary/PlaystateService.cs index acbbde769..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); |
