Skip to content

Fix removing unwatched streams from playlist when using "remove watched"#12929

Merged
Stypox merged 5 commits intodevfrom
fix/playlist-remove-watched
Jan 27, 2026
Merged

Fix removing unwatched streams from playlist when using "remove watched"#12929
Stypox merged 5 commits intodevfrom
fix/playlist-remove-watched

Conversation

@TobiGr
Copy link
Copy Markdown
Contributor

@TobiGr TobiGr commented Dec 21, 2025

What is it?

  • Bugfix (user facing)

Description of the changes in your PR

Bug fix

The bug is caused by a wanted but forgotten inconsistency in the database. A stream can be listed in the watch history (StreamHistoryEntity) while having no corresponding playback state (StreamStateEntity) containing the matching playback position. This is caused by the fact that NewPipe does not consider a watch time of less than five seconds to be worthy to be put into the StreamStateEntity because the video was most likely played by error. Those videos are, however, counted and stored in the watch history.

I think we need to discuss whether we should add the stream to the watch history at all.

UI/UX improvements

The dialog with three options was changed to a yes and cancel button and a checkbox. The strings were changed to respect that a playlist can also contain audio streams. "streams" is now used in favour of "video".

Before/After Screenshots/Screen Record

A screen record with the old version is in #12917. The following recording shows the new behaviour and dialog.

Screen_recording_20251221_212542.webm

Fixes the following issue(s)

APK testing

The APK can be found by going to the "Checks" tab below the title. On the left pane, click on "CI", scroll down to "artifacts" and click "app" to download the zip file which contains the debug APK of this PR. You can find more info and a video demonstration on this wiki page.

This backup can be used to easily test different scenarios: NewPipe-Data-Playlist-stream-states.zip

The test playlist contains five streams:

  • not watched
  • watched, but playback position < 5 sec
  • watched (playback position in the middle of the video)
  • watched more than 3/4, but not completely
  • watched until the end

Due diligence

@TobiGr TobiGr added this to v0.28.x Dec 21, 2025
@TobiGr TobiGr added bug Issue is related to a bug playlist Anything to do with playlists in the app history Anything to do with previously watched stuff labels Dec 21, 2025
@github-project-automation github-project-automation Bot moved this to Todo in v0.28.x Dec 21, 2025
@github-actions github-actions Bot added the size/medium PRs with less than 250 changed lines label Dec 21, 2025
@TobiGr TobiGr force-pushed the fix/playlist-remove-watched branch 3 times, most recently from 655666c to 6cefb4b Compare December 21, 2025 20:01
@TobiGr TobiGr changed the base branch from dev to release-0-28.1 January 2, 2026 08:26
Base automatically changed from release-0-28.1 to master January 11, 2026 16:58
@Stypox Stypox changed the base branch from master to dev January 27, 2026 20:38
Copy link
Copy Markdown
Member

@Stypox Stypox left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! I will fix that small thing myself and then merge

Comment on lines +446 to +447
final var streamStates = recordManager
.loadLocalStreamStateBatch(playlist).blockingGet();
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now streamStates is fetched even when not needed, i.e. when removePartiallyWatched is false

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nevermind I was wrong :-)

TobiGr and others added 5 commits January 27, 2026 22:00
The bug is caused by a wanted but forgotten inconsistency in the database.
A stream can be listed in the watch history (StreamHistoryEntity) while having no corresponding playback state (StreamStateEntity) containing the matching playback position. This is caused by the fact that NewPipe does not consider a watch time of less than five seconds to be worthy to be put into the StreamStateEntity because the video was most likely played by error. Those videos are, however, counted and stored in the watch history.
Playlists can also contain audio-only items. Therefore, the term "stream" is used.
@Stypox Stypox force-pushed the fix/playlist-remove-watched branch from 3ab4f14 to 817fccb Compare January 27, 2026 21:06
@Stypox Stypox merged commit 4e0d542 into dev Jan 27, 2026
5 checks passed
@github-project-automation github-project-automation Bot moved this from Todo to Done in v0.28.x Jan 27, 2026
@TobiGr TobiGr deleted the fix/playlist-remove-watched branch February 3, 2026 04:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Issue is related to a bug history Anything to do with previously watched stuff playlist Anything to do with playlists in the app size/medium PRs with less than 250 changed lines

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

"Remove watched" removes unwatched videos

2 participants