From b52bc327f2735b4a9c8dc216e6323484db3bf2b1 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Tue, 17 Feb 2015 13:42:46 -0500 Subject: [PATCH] updated playstate methods --- MediaBrowser.Controller/Library/IUserDataManager.cs | 2 +- MediaBrowser.Server.Implementations/Library/UserDataManager.cs | 3 ++- MediaBrowser.Server.Implementations/Sync/SyncManager.cs | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) 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); }