Browse Source

Merge pull request #4628 from MrTimscampi/no-next-resumable

Prevent GetUpNext from returning episodes in progress
Claus Vium 4 years ago
parent
commit
81823f9a3d
1 changed files with 13 additions and 1 deletions
  1. 13 1
      Emby.Server.Implementations/TV/TVSeriesManager.cs

+ 13 - 1
Emby.Server.Implementations/TV/TVSeriesManager.cs

@@ -192,7 +192,7 @@ namespace Emby.Server.Implementations.TV
 
             Func<Episode> getEpisode = () =>
             {
-                return _libraryManager.GetItemList(new InternalItemsQuery(user)
+                var nextEpisode = _libraryManager.GetItemList(new InternalItemsQuery(user)
                 {
                     AncestorWithPresentationUniqueKey = null,
                     SeriesPresentationUniqueKey = seriesKey,
@@ -205,6 +205,18 @@ namespace Emby.Server.Implementations.TV
                     MinSortName = lastWatchedEpisode?.SortName,
                     DtoOptions = dtoOptions
                 }).Cast<Episode>().FirstOrDefault();
+
+                if (nextEpisode != null)
+                {
+                    var userData = _userDataManager.GetUserData(user, nextEpisode);
+
+                    if (userData.PlaybackPositionTicks > 0)
+                    {
+                        return null;
+                    }
+                }
+
+                return nextEpisode;
             };
 
             if (lastWatchedEpisode != null)