diff --git a/MediaBrowser.Controller/Library/IUserDataManager.cs b/MediaBrowser.Controller/Library/IUserDataManager.cs index 06e7d1763e..f230f14725 100644 --- a/MediaBrowser.Controller/Library/IUserDataManager.cs +++ b/MediaBrowser.Controller/Library/IUserDataManager.cs @@ -64,6 +64,6 @@ namespace MediaBrowser.Controller.Library /// /// Updates playstate for an item and returns true or false indicating if it was played to completion /// - bool UpdatePlayState(BaseItem item, UserItemData data, long positionTicks); + bool UpdatePlayState(BaseItem item, UserItemData data, long? positionTicks); } } diff --git a/MediaBrowser.Server.Implementations/Library/UserDataManager.cs b/MediaBrowser.Server.Implementations/Library/UserDataManager.cs index ed3503c1b9..8cbb2eb1aa 100644 --- a/MediaBrowser.Server.Implementations/Library/UserDataManager.cs +++ b/MediaBrowser.Server.Implementations/Library/UserDataManager.cs @@ -208,10 +208,11 @@ namespace MediaBrowser.Server.Implementations.Library }; } - public bool UpdatePlayState(BaseItem item, UserItemData data, long positionTicks) + public bool UpdatePlayState(BaseItem item, UserItemData data, long? reportedPositionTicks) { var playedToCompletion = false; + var positionTicks = reportedPositionTicks ?? item.RunTimeTicks ?? 0; var hasRuntime = item.RunTimeTicks.HasValue && item.RunTimeTicks > 0; // If a position has been reported, and if we know the duration diff --git a/MediaBrowser.Server.Implementations/Sync/SyncManager.cs b/MediaBrowser.Server.Implementations/Sync/SyncManager.cs index b412d9a0b6..be6034e082 100644 --- a/MediaBrowser.Server.Implementations/Sync/SyncManager.cs +++ b/MediaBrowser.Server.Implementations/Sync/SyncManager.cs @@ -683,7 +683,7 @@ namespace MediaBrowser.Server.Implementations.Sync var userData = _userDataManager.GetUserData(new Guid(action.UserId), item.GetUserDataKey()); userData.LastPlayedDate = action.Date; - _userDataManager.UpdatePlayState(item, userData, action.PositionTicks ?? item.RunTimeTicks ?? 0); + _userDataManager.UpdatePlayState(item, userData, action.PositionTicks); return _userDataManager.SaveUserData(new Guid(action.UserId), item, userData, UserDataSaveReason.Import, CancellationToken.None); }