mirror of
https://github.com/Rigellute/spotify-tui.git
synced 2026-04-25 23:55:53 +03:00
[GH-ISSUE #76] Change sort order of playlist #51
Labels
No labels
bug
enhancement
good first issue
help wanted
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/spotify-tui#51
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @t89 on GitHub (Oct 17, 2019).
Original GitHub issue: https://github.com/Rigellute/spotify-tui/issues/76
An option to sort the playlist in different ways would be nice: Show the most recently added songs on top for example.
@Rigellute commented on GitHub (Oct 18, 2019):
Intereting point 👍
@SgiobairOg commented on GitHub (Oct 18, 2019):
Completely new to Rust but, as this is a super interesting project could I offer to take a crack at this issue?
@jfaltis commented on GitHub (Oct 18, 2019):
I would suggest to use Shift+S or Alt+s to enter a "sort mode" which basically just listens for the next keypress and processes it to decide to sort by what criteria. E.g t for title, a for artist, l for length etc. Maybe it could also show some kind of "Statusbar" with the sorting criterias and corresponding keys while being in "sort mode"
@Rigellute commented on GitHub (Oct 18, 2019):
Upper case
S(i.e.<Shift+S>) sounds like a good binding to me.And if you want to take a crack at it @SgiobairOg, be my guest!
@SgiobairOg commented on GitHub (Oct 27, 2019):
So, handling the key inputs is straightforward enough, even with no Rust experience.
Could someone point me to the code that handles populating the track table though? I'm assuming I can just grab the tracks from
app.track_table.tracks, and sort them withslice::sort_by. Not sure how to update the display and set the current track if one is playing.@debdutto commented on GitHub (Nov 26, 2019):
@SgiobairOg Are you still working on this? Was hoping to have a crack at it over the weekend?
@SgiobairOg commented on GitHub (Nov 26, 2019):
I was, but don’t actually know how to do the sort and haven’t had time to figure it out. I can commit a branch if you want so you can have what I’ve got so far.
@luiswirth commented on GitHub (Nov 26, 2019):
I've been spending some time on this issue and there seem to be some obstacles in implementing this...
I was successful in sorting the tracks by Title, Artist, Album and Duration depending on the keyboard input. But the difficulty lies in starting the playback and have the tracks play in the same order as they are in the
TrackTable. If I'm right I must pass all theURIs of all tracks in the correct order to the spotify-api. So far we've just passedNoneas argument, since we just used the default ordering. I hope this doesn't have any noticeable performance implications when playing big playlists.I will continue working on it.
If somebody wants to follow along: My Fork. Feedback is very welcome!
@Rigellute commented on GitHub (Nov 27, 2019):
You are right @LU15W1R7H, we can sort the display for the tracks and can even get the playback to work in that order - but the limitation is that Spotify will only play those tracks that have been sorted (once you get to the end of that list, playback will stop).
Perhaps this is intentional, but means we will need to correctly manage unsorted (i.e. default) mode, which has the full context of the current playback (playlist/album etc.). That is to say we don't specify an array of URLs.
Totally doable, but more state to manage!
@luiswirth commented on GitHub (Nov 27, 2019):
@Rigellute yeah, thats totally true. I would also prefer another solution, I just haven't found one so far. It seems the spotify-api just doesn't provide the ability the play the songs in some predefined order...