mirror of
				https://github.com/jellyfin/jellyfin.git
				synced 2025-11-04 03:27:21 -05:00 
			
		
		
		
	Merge pull request #2152 from dkanada/progress
Track progress for any item that supports the feature
This commit is contained in:
		
						commit
						831d1daa68
					
				@ -226,24 +226,21 @@ namespace Emby.Server.Implementations.Library
 | 
				
			|||||||
            {
 | 
					            {
 | 
				
			||||||
                var pctIn = decimal.Divide(positionTicks, runtimeTicks) * 100;
 | 
					                var pctIn = decimal.Divide(positionTicks, runtimeTicks) * 100;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                // Don't track in very beginning
 | 
					 | 
				
			||||||
                if (pctIn < _config.Configuration.MinResumePct)
 | 
					                if (pctIn < _config.Configuration.MinResumePct)
 | 
				
			||||||
                {
 | 
					                {
 | 
				
			||||||
 | 
					                    // ignore progress during the beginning
 | 
				
			||||||
                    positionTicks = 0;
 | 
					                    positionTicks = 0;
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
 | 
					 | 
				
			||||||
                // If we're at the end, assume completed
 | 
					 | 
				
			||||||
                else if (pctIn > _config.Configuration.MaxResumePct || positionTicks >= runtimeTicks)
 | 
					                else if (pctIn > _config.Configuration.MaxResumePct || positionTicks >= runtimeTicks)
 | 
				
			||||||
                {
 | 
					                {
 | 
				
			||||||
 | 
					                    // mark as completed close to the end
 | 
				
			||||||
                    positionTicks = 0;
 | 
					                    positionTicks = 0;
 | 
				
			||||||
                    data.Played = playedToCompletion = true;
 | 
					                    data.Played = playedToCompletion = true;
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
 | 
					 | 
				
			||||||
                else
 | 
					                else
 | 
				
			||||||
                {
 | 
					                {
 | 
				
			||||||
                    // Enforce MinResumeDuration
 | 
					                    // Enforce MinResumeDuration
 | 
				
			||||||
                    var durationSeconds = TimeSpan.FromTicks(runtimeTicks).TotalSeconds;
 | 
					                    var durationSeconds = TimeSpan.FromTicks(runtimeTicks).TotalSeconds;
 | 
				
			||||||
 | 
					 | 
				
			||||||
                    if (durationSeconds < _config.Configuration.MinResumeDurationSeconds)
 | 
					                    if (durationSeconds < _config.Configuration.MinResumeDurationSeconds)
 | 
				
			||||||
                    {
 | 
					                    {
 | 
				
			||||||
                        positionTicks = 0;
 | 
					                        positionTicks = 0;
 | 
				
			||||||
@ -263,6 +260,7 @@ namespace Emby.Server.Implementations.Library
 | 
				
			|||||||
                positionTicks = 0;
 | 
					                positionTicks = 0;
 | 
				
			||||||
                data.Played = false;
 | 
					                data.Played = false;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if (!item.SupportsPositionTicksResume)
 | 
					            if (!item.SupportsPositionTicksResume)
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                positionTicks = 0;
 | 
					                positionTicks = 0;
 | 
				
			||||||
 | 
				
			|||||||
@ -667,12 +667,9 @@ namespace Emby.Server.Implementations.Session
 | 
				
			|||||||
            data.PlayCount++;
 | 
					            data.PlayCount++;
 | 
				
			||||||
            data.LastPlayedDate = DateTime.UtcNow;
 | 
					            data.LastPlayedDate = DateTime.UtcNow;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if (item.SupportsPlayedStatus)
 | 
					            if (item.SupportsPlayedStatus && !item.SupportsPositionTicksResume)
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                if (!(item is Video))
 | 
					                data.Played = true;
 | 
				
			||||||
                {
 | 
					 | 
				
			||||||
                    data.Played = true;
 | 
					 | 
				
			||||||
                }
 | 
					 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            else
 | 
					            else
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
@ -769,7 +766,6 @@ namespace Emby.Server.Implementations.Session
 | 
				
			|||||||
            {
 | 
					            {
 | 
				
			||||||
                _userDataManager.SaveUserData(user, item, data, UserDataSaveReason.PlaybackProgress, CancellationToken.None);
 | 
					                _userDataManager.SaveUserData(user, item, data, UserDataSaveReason.PlaybackProgress, CancellationToken.None);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        private static bool UpdatePlaybackSettings(User user, PlaybackProgressInfo info, UserItemData data)
 | 
					        private static bool UpdatePlaybackSettings(User user, PlaybackProgressInfo info, UserItemData data)
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user