diff options
Diffstat (limited to 'Emby.Server.Implementations/Session/SessionManager.cs')
| -rw-r--r-- | Emby.Server.Implementations/Session/SessionManager.cs | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/Emby.Server.Implementations/Session/SessionManager.cs b/Emby.Server.Implementations/Session/SessionManager.cs index 94215bed79..dd71f843e8 100644 --- a/Emby.Server.Implementations/Session/SessionManager.cs +++ b/Emby.Server.Implementations/Session/SessionManager.cs @@ -846,7 +846,13 @@ namespace Emby.Server.Implementations.Session var data = _userDataManager.GetUserData(user, item); data.PlayCount++; - data.LastPlayedDate = DateTime.UtcNow; + + // Re-watching a played item only counts once a progress or stop report gets past the resume threshold, + // otherwise rewatch Next Up moves on from an episode that was barely started + if (!data.Played || !item.SupportsPositionTicksResume) + { + data.LastPlayedDate = DateTime.UtcNow; + } if (item.SupportsPlayedStatus && !item.SupportsPositionTicksResume) { @@ -972,7 +978,12 @@ namespace Emby.Server.Implementations.Session if (positionTicks.HasValue) { - _userDataManager.UpdatePlayState(item, data, positionTicks.Value); + var playedToCompletion = _userDataManager.UpdatePlayState(item, data, positionTicks.Value); + if (playedToCompletion || data.PlaybackPositionTicks > 0) + { + data.LastPlayedDate = DateTime.UtcNow; + } + changed = true; } @@ -1174,6 +1185,10 @@ namespace Emby.Server.Implementations.Session if (positionTicks.HasValue) { playedToCompletion = _userDataManager.UpdatePlayState(item, data, positionTicks.Value); + if (playedToCompletion || data.PlaybackPositionTicks > 0) + { + data.LastPlayedDate = DateTime.UtcNow; + } } else { @@ -1181,6 +1196,7 @@ namespace Emby.Server.Implementations.Session data.PlayCount++; data.Played = item.SupportsPlayedStatus; data.PlaybackPositionTicks = 0; + data.LastPlayedDate = DateTime.UtcNow; playedToCompletion = true; } @@ -1449,6 +1465,8 @@ namespace Emby.Server.Implementations.Session if (item is IItemByName byName) { + // A by-name item tags containers as well as leaves: a music genre tags its artists, + // and a by-name artist row is not a folder, so IsFolder does not exclude it here. return byName.GetTaggedItems(new InternalItemsQuery(user) { IsFolder = false, @@ -1463,7 +1481,7 @@ namespace Emby.Server.Implementations.Session }, IsVirtualItem = false, OrderBy = new[] { (ItemSortBy.SortName, SortOrder.Ascending) } - }); + }).Where(i => i is not IItemByName); } if (item.IsFolder) |
