mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-06-02 13:15:25 -04:00
Reduce nesting in SessionManager.OnPlaybackStopped
This commit is contained in:
parent
78e00578c2
commit
12b51cf2ba
@ -951,12 +951,13 @@ namespace Emby.Server.Implementations.Session
|
|||||||
|
|
||||||
private bool OnPlaybackStopped(User user, BaseItem item, long? positionTicks, bool playbackFailed)
|
private bool OnPlaybackStopped(User user, BaseItem item, long? positionTicks, bool playbackFailed)
|
||||||
{
|
{
|
||||||
bool playedToCompletion = false;
|
if (playbackFailed)
|
||||||
|
|
||||||
if (!playbackFailed)
|
|
||||||
{
|
{
|
||||||
var data = _userDataManager.GetUserData(user, item);
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
var data = _userDataManager.GetUserData(user, item);
|
||||||
|
bool playedToCompletion;
|
||||||
if (positionTicks.HasValue)
|
if (positionTicks.HasValue)
|
||||||
{
|
{
|
||||||
playedToCompletion = _userDataManager.UpdatePlayState(item, data, positionTicks.Value);
|
playedToCompletion = _userDataManager.UpdatePlayState(item, data, positionTicks.Value);
|
||||||
@ -971,7 +972,6 @@ namespace Emby.Server.Implementations.Session
|
|||||||
}
|
}
|
||||||
|
|
||||||
_userDataManager.SaveUserData(user, item, data, UserDataSaveReason.PlaybackFinished, CancellationToken.None);
|
_userDataManager.SaveUserData(user, item, data, UserDataSaveReason.PlaybackFinished, CancellationToken.None);
|
||||||
}
|
|
||||||
|
|
||||||
return playedToCompletion;
|
return playedToCompletion;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user