updated playstate methods

This commit is contained in:
Luke Pulverenti 2015-02-17 13:42:46 -05:00
parent ee632803b3
commit b52bc327f2
3 changed files with 4 additions and 3 deletions

View File

@ -64,6 +64,6 @@ namespace MediaBrowser.Controller.Library
/// <summary>
/// Updates playstate for an item and returns true or false indicating if it was played to completion
/// </summary>
bool UpdatePlayState(BaseItem item, UserItemData data, long positionTicks);
bool UpdatePlayState(BaseItem item, UserItemData data, long? positionTicks);
}
}

View File

@ -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

View File

@ -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);
}