-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixed a bug that incorrectly removed videos from a playlist when using the "Remove Viewed" dialog #9445
Conversation
Kudos, SonarCloud Quality Gate passed! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
I am not sure I understand: what's the difference between storing the watched items or the not-watched ones? Aren't the following statements always true?
whole playlist ≡ non watched items ∪ watched items
non watched items ∩ watched items ≡ ∅
Unless I am getting something wrong, I think it's better if you revert the parts of the PR regarding inverting watched and not-watched item lists.
app/src/main/java/org/schabi/newpipe/local/playlist/LocalPlaylistFragment.java
Outdated
Show resolved
Hide resolved
Thanks for the review.
This leads to the deleted video being re-added to the playlist, even though we just deleted it. After further debugging, I found out today that we can also fix this by updating the playlist immediately after deleting the video. So, it would be possible to revert my changes and save the |
This problem is not caused by the method we use to store (non) watched items, but rather is a bug in the way the internal list is updated when an item is deleted. Inverting the solution would maybe solve this problem but may then fail on the opposite problem (i.e. adding manually a non-watched video to a playlist, then using "Remove watched" => suddenly the newly added video is not there anymore because the list from which to remove
Because removing all videos and then readding the non-watched ones takes I also don't agree on the solution being more intuitive. The confusing thing in my opinion is the name of the list, i.e.
So yes, in my opinion you should undo that part of the changes, sorry for this ;-) |
Thanks for the detailed answer. I understand you a lot better now and will revert my changes. If there isn't one already, should I just create a new issue regarding the faulty updating of the internal list, or should I try to fix it in this PR? |
I think it's better to create a separate PR for that, so opening an issue might be a good idea. If you then want to take care of it feel free to ;-) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works, thanks!
Reverted changes and fixed bug in a different way
41974c6
to
38c4a1e
Compare
Kudos, SonarCloud Quality Gate passed! |
What is it?
Description of the changes in your PR
After a lot of troubleshooting, I found out that this bug is bigger than I initially thought, as I encountered another issue: If you manually remove videos from your playlist and then use the "Removed Watched Videos" feature, the manually deleted videos reappear.
The reason why these bugs occur is that the streamStateTable is not up-to-date when you remove the watched videos. However, updating the playlist/streamStateTable beforehand doesn't work either, as we only save the state of an entity if it has been viewed for more than 5 seconds (maybe you want to use this feature directly after starting to watch a video). I wouldn't recommend lowering this number, as it would cause accidentally clicked videos to be counted as viewed as well.
Therefore, I decided to slightly change the way we remove these videos. Instead of clearing the entire playlist and reinserting all the “not watched videos”, I decided to collect the “watched videos” and remove them from the playlist. This approach is IMO the best option.
This will be my first bug fix for NewPipe, so if there is anything I did wrong, please let me know and I will fix it.
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.
Due diligence