NewPipe
                                
                                 NewPipe copied to clipboard
                                
                                    NewPipe copied to clipboard
                            
                            
                            
                        Strange Playlist Order in the Add to Playlist preview
Checklist
- [X] I am able to reproduce the bug with the latest version given here: CLICK THIS LINK.
- [X] I made sure that there are no existing issues - open or closed - which I could contribute my information to.
- [X] I have read the FAQ and my problem isn't listed.
- [X] I have taken the time to fill in all the required details. I understand that the bug report will be dismissed otherwise.
- [X] This issue contains only one bug.
- [X] I have read and understood the contribution guidelines.
Affected version
0.27.0
Steps to reproduce the bug
Not really an issue
- Open New Pipe
- Add a Video to a Playlist (Either when you long press on a video or when you press the icon on a video)
- The order of the playlists is no longer alphabetical / numeric. At first I thought it was sorted by playlist creation date, but it looks more like thrown together.
Expected behavior
The order of the playlist should be the same as in the previous versions (0.26.1, etc.)
Actual behavior
Wildly thrown together playlist order. (Only in the Add to Playlist preview)
Screenshots/Screen recordings
No response
Logs
No response
Affected Android/Custom ROM version
Android 13 Vanilla
Affected device model
Nokia X10
Additional information
No response
I can't replicate this, but on a semi-related note, new playlists now go to the top. I like the sort option but I also liked it when they were put in alphabetical order when they were created.
I can't replicate this, but on a semi-related note, new playlists now go to the top. I like the sort option but I also liked it when they were put in alphabetical order when they were created.
I know how to reproduce the bug. If you upgrade from 0.26.1 to 0.27.0 and then add a video to a playlist without rearranging a playlist first, the playlist will look messed up in the Add to Playlist Preview. However, if you rearrange a playlist, the preview will look the same as before. The issue can be closed.
@Monstanner thank you for the details. Although this behavior is somewhat unintended, it's also something that can happen only right after upgrading to 0.27.0, so I wouldn't worry about it. It's ok that the order is not updated when querying playlists, but only when doing something with them.
Anyway, this can be fixed by adding a clause to the ORDER BY of some SQL query, in case someone wants to solve it.
Hi, I noticed this strange behavior as well and wouldve been fine with manually reordering my playlists if they were to have only been messed up once by the update, but it seems that the problem persists in a way that is pretty annoying. Specifically, in my saved playlists, I have (i am using "local" to denote playlists that are created from within newpipe, and "remote" to denote playlists which are present on youtube, please tell me if there is a more fitting vocabulary):
- local playlists that i created
- remote playlists created on my youtube account or by other youtube users (example)
- remote playlists of music albums that are autogenerated by youtube (example)
local playlists seem not pose an issue, and user-created remote playlists seem fine too (i think one of them mightve exhibited strange behavior once, but this must be the one-time issue brought up by @Stypox). However, remote playlists autogenerated by youtube exhibit strange behavior:
- remote playlist is somewhere in the middle of my saved playlist tab
- i click on it to open it from the saved playlists tab, and then exit back to the saved playlist tab
- the playlist has been moved back all the way to the top of the tab
this seems to me like an actual bug that must be addressed, and i'd be interested in trying to contribute to solve it. however, it may be good to first attempt to confirm that it is happening for other newpipe 27.0 users too
as a follow up to my last comment, i have tried to find the source of this behavior and i think i have a culprit.
- this line sets the display index to -1 for all remote playlists by default (so that new bookmarked playlists appear at the top of the bookmarks list, i would imagine)
- the only place in the entire codebase where setDisplayIndexis called on aPlaylistRemoteEntityis inBookmarkFragment.saveImmediate(), which is called byBookmarkFragment.onPause()(which corresponds with the moment at which the playlists are sent back all the way up by the bug)
- in saveImmediate(),debounceSaver.getIsModified()returns false so the function returns immediately. The code which computes and updates the display index for playlists is not executed. it seems that the issue is with thedebounceSaverin some way, but i do not understand this part of the application very well.
I'm not sure how to fix this right now, and trying to make sense of this database with 0 android dev experience has already fried my brain a bit too much, but if anyone has pointers, i am down to come back to it and try and fix it.
Anyway, this can be fixed by adding a clause to the ORDER BY of some SQL query, in case someone wants to solve it.
@ajgae Did this not work?
Anyway, this can be fixed by adding a clause to the ORDER BY of some SQL query, in case someone wants to solve it.
@ajgae Did this not work?
@opusforlife2 i did not look at the queries in detail as i spent a lot of time trying to understand the codebase better mostly, but a couple of clues are leading me to think that the culprit is not the queries themselves, but rather the merge logic:
- the getPlaylists()queries in theRemotePlaylistDAOand local playlist DAO classes seem to be ordered by display index, as expected
- as mentioned previously, it seems that the remote playlists' display indices are set to -1 and then never updated; this would explain the behavior shown in the video below (ordering of autogenerated by youtube remote playlists by alphabetical order at the top of the bookmarks)
here's the video to demonstrate: https://github.com/TeamNewPipe/NewPipe/assets/69397914/5c581c1f-27e6-4a32-8266-123bc8362c93
- before the recording, i had moved the watch later local playlist at the very top of the bookmarks
- when i click on remote playlists generated by youtube (the three Album playlists), they are sent above watch later, but ordered by alphabetical order in that group
- when i click on watch later, it doesnt move
- lower down, when i click on a remote playlist that i created on my youtube account and bookmarked on newpipe, it does not move either
the most confusing part about this is that only remote playlists autogenerated by youtube seem to be affected. what do you think?
i am also realizing now that i got so caught up with the code i didnt read the initial issue properly. this should probably be its own issue, since it is not about the ordering of playlists in the add to playlist fragment but rather in the bookmarks fragment. i can open a new one if youd like.
@ajgae Thanks, yeah, that would be appropriate. I'll mark the comments here as off-topic, but you can copy the content for your own issue where needed.
@Monstanner
The issue can be closed.
@Stypox
only right after upgrading to 0.27.0, so I wouldn't worry about it. It's ok that the order is not updated when querying playlists, but only when doing something with them.
Whilst that conclusion feels reasonable from the perspective of github folks and power users, I don't think it aligns very well with the reality of not-so-techy end users who appreciate NewPipe for their everyday yt endeavors and have learned how to use it, but e. g. wouldn't file bug reports - for the following reasons:
1. Who's affected: If this bug reproducibly shows up by the upgrade to 0.27.0, this means the entire userbase runs into it, with the exception of only those who don't upgrade to 0.27.0, or accidentally rearrange playlists before their next use of "add to playlist".
2. How severely affected: There are more severe bugs for sure, but if your collection of playlists has grown into the dozens, the messed-up order is a real nuisance every time you wish to playlist a new medium.
3. How easy to overcome: If you've never faced a need to rearrange playlists (because they've always been in consistent alphabetical order on their own), it's far from obvious how the sudden mess-up in the "add to playlist" dialog can be fixed. 3.1. In the "add to playlist" dialog, there is no button to switch sorting back to alphabetical (or to any other sorting mode), nor are there handles that would allow manual rearrangment. 3.2. In the playlist tab (where you could solve the problem if you knew), the problem doesn't even exist. Why should it be relevant to the bug? The suggested "hidden solution" by rearranging a listing that already is in perfect alphabetical order, in order to fix a different listing elsewhere that is not, doesn't make a lot of common sense.
Anyway, this can be fixed by adding a clause to the ORDER BY of some SQL query, in case someone wants to solve it.
Although I'm able to contribute to github issues (which already separates me from the majority of NewPipe users I know), I'm not a coder, hence left hoping for someone more technically adept to take care of the code side of things.
Given the above reasons, would it be appropriate to reopen this issue, or am I totally off the road?
It's also happening to me. It's annoying since the order of the playlists in the preview seems completely random, so one has to go through all the names to find the intended one... A big nuisance when adding many items to different playlists in a row.
Edit: @Monstanner is right and after rearranging any one playlist the order gets fixed again. Thanks!
Hello everybody!
I am new to the open source community and I would like to contribute to NewPipe project.
I had the same problem with the strange playlist order. It happens only when the user has not yet given an order to the playlists because at this phase the value displayIndex of each playlist (local or remote) is set to -1 and the code that create the list of playlist in "Bookmarked Playlists" sort every playlist with the same displayIndex value using a case insensitive order during the merge between remote and local playlists. While this case insensitive sorting does not happen for the add to playlist dialog list.
We have some possible solutions that can be applied to fix the problem:
- Order also the list on the add to playlist dialog using a case insensitive order when the user has not yet given an order to the playlists.
- Skip the case insensitive ordering of playlists with the same displayIndex value in "Bookmarked Playlists" when the user has not yet given an order to the playlists.
- Use an incremental value and not -1 for the new playlist since the beginning. In this way there can be no playlists with the same displayIndex value and both playlist lists are ordered chronologically (when the user has not yet given an order). Probably this is the best solution even if it can be more tricky and it needs a proper database migration.
@Stypox what do you think about that ? In case you can assign this issue to me, thank you
@nicholasala thank you for the interest! I would go with 1., which should be solvable by "adding a clause to the ORDER BY of some SQL query". I assigned the issue to you.