File tree Expand file tree Collapse file tree
app/src/main/java/org/schabi/newpipe/local/playlist Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -414,14 +414,21 @@ public void removeWatchedStreams(final boolean removePartiallyWatched) {
414414 } else {
415415 final Iterator <StreamStateEntity > streamStatesIter = recordManager
416416 .loadLocalStreamStateBatch (playlist ).blockingGet ().iterator ();
417-
418417 while (playlistIter .hasNext ()) {
419418 final PlaylistStreamEntry playlistItem = playlistIter .next ();
420419 final int indexInHistory = Collections .binarySearch (historyStreamIds ,
421420 playlistItem .getStreamId ());
422-
423- final boolean hasState = streamStatesIter .next () != null ;
424- if (indexInHistory < 0 || hasState ) {
421+ final StreamStateEntity streamStateEntity = streamStatesIter .next ();
422+ final long duration = playlistItem .toStreamInfoItem ().getDuration ();
423+ boolean isFinished = false ;
424+ if (streamStateEntity != null ) {
425+ isFinished = streamStateEntity .isFinished (duration );
426+ }
427+ final boolean isNotWatchedItem = (streamStateEntity != null
428+ && !isFinished );
429+ if (indexInHistory < 0 ) {
430+ notWatchedItems .add (playlistItem );
431+ } else if (isNotWatchedItem ) {
425432 notWatchedItems .add (playlistItem );
426433 } else if (!thumbnailVideoRemoved
427434 && playlistManager .getPlaylistThumbnail (playlistId )
You can’t perform that action at this time.
0 commit comments