diff options
| author | Bond-009 <bond.009@outlook.com> | 2023-10-04 15:02:21 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-10-04 15:02:21 +0200 |
| commit | c124d025015ff03f474fc506855d2051e22db23f (patch) | |
| tree | eab02d0c1eb0e89e1c96ea89dc684df02d954b08 /Emby.Server.Implementations/Session/SessionManager.cs | |
| parent | 487d79f8acd5449c8c01d68b0df2caeb979213cc (diff) | |
| parent | 12b51cf2ba537a6f56882277dc856ab39ace94a0 (diff) | |
Merge pull request #10331 from barronpm/minor-cleanup
Diffstat (limited to 'Emby.Server.Implementations/Session/SessionManager.cs')
| -rw-r--r-- | Emby.Server.Implementations/Session/SessionManager.cs | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/Emby.Server.Implementations/Session/SessionManager.cs b/Emby.Server.Implementations/Session/SessionManager.cs index 50d3e8e46..e935f7e5e 100644 --- a/Emby.Server.Implementations/Session/SessionManager.cs +++ b/Emby.Server.Implementations/Session/SessionManager.cs @@ -951,27 +951,27 @@ namespace Emby.Server.Implementations.Session private bool OnPlaybackStopped(User user, BaseItem item, long? positionTicks, bool playbackFailed) { - bool playedToCompletion = false; - - if (!playbackFailed) + if (playbackFailed) { - var data = _userDataManager.GetUserData(user, item); - - if (positionTicks.HasValue) - { - playedToCompletion = _userDataManager.UpdatePlayState(item, data, positionTicks.Value); - } - else - { - // If the client isn't able to report this, then we'll just have to make an assumption - data.PlayCount++; - data.Played = item.SupportsPlayedStatus; - data.PlaybackPositionTicks = 0; - playedToCompletion = true; - } + return false; + } - _userDataManager.SaveUserData(user, item, data, UserDataSaveReason.PlaybackFinished, CancellationToken.None); + var data = _userDataManager.GetUserData(user, item); + bool playedToCompletion; + if (positionTicks.HasValue) + { + playedToCompletion = _userDataManager.UpdatePlayState(item, data, positionTicks.Value); } + else + { + // If the client isn't able to report this, then we'll just have to make an assumption + data.PlayCount++; + data.Played = item.SupportsPlayedStatus; + data.PlaybackPositionTicks = 0; + playedToCompletion = true; + } + + _userDataManager.SaveUserData(user, item, data, UserDataSaveReason.PlaybackFinished, CancellationToken.None); return playedToCompletion; } |
