Fix Playlist order from Spotify Library not being used #26
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hey!
This commit fixes the Playlist list not appearing in the same order as in your Spotify Library.
How:
I did this by adding a new
idx
parameter to theUserPlaylist
class.This parameter is getting fed by a totalindex variable that counts all iterations of the first and the second (offset) loop which fetch the users playlist data in
frontend/spotify_manager.py
.The init function of the
PlaylistPage
class inview_model.py
then sorts the playlists list by getting theidx
of each playlist from theUserPlaylist
class using the addedget_idx()
function.When fetching all playlists using spotipy in
refresh_data()
the order of supplied playlists was always the same as in the users Spotify library. But this order wasn't kept in the list and therefore also not in the Playlists menu.Note: Deleting pycache and calling refresh_data() once is necessary.
Another note:This pull request does not include my changes from my other pull request so if that should get accepted do I then need to add those changes to this branch too? Otherwise they would get reset by this pull request or am I wrong? That would be no problem to do but I just want to ask before doing something stupid and combining these two pull requests together didn't seem logical for me as they address different issues.
Sorry, I haven't worked with pull requests that much.
Edit: Doesn't make sense - the point of pull requests is to update parts of the code and not to replace a whole file.