mirror of
https://github.com/jpochyla/psst.git
synced 2026-04-27 15:35:56 +03:00
[PR #293] [MERGED] Add support for 'Remove from playlist' #471
Labels
No labels
api
bug
build
documentation
duplicate
enhancement
good first issue
help wanted
idea
invalid
linux
lowprio
macos
pull-request
upstream
windows
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/psst#471
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?
📋 Pull Request Information
Original PR: https://github.com/jpochyla/psst/pull/293
Author: @itsjunetime
Created: 4/13/2022
Status: ✅ Merged
Merged: 8/15/2022
Merged by: @jpochyla
Base:
master← Head:remove_from_playlist📝 Commits (5)
2120b73Add support for 'Remove from playlist'84755b8Fix formatting for CIeba4418gui: Remove playlist backlink from Trackfe03126Conditionally show 'Remove from playlist' depending on whether you can edit the playlist or not2aa4be7Fix formatting for CI📊 Changes
8 files changed (+128 additions, -11 deletions)
View changed files
📝
psst-gui/src/data/mod.rs(+14 -1)📝
psst-gui/src/data/playlist.rs(+6 -0)📝
psst-gui/src/ui/playable.rs(+6 -0)📝
psst-gui/src/ui/playback.rs(+3 -1)📝
psst-gui/src/ui/playlist.rs(+26 -1)📝
psst-gui/src/ui/search.rs(+2 -3)📝
psst-gui/src/ui/track.rs(+53 -3)📝
psst-gui/src/webapi/client.rs(+18 -2)📄 Description
This adds support for the 'Remove from playlist' option when right-clicking on a track within a playlist. Clicking this button will remove the track from the playlist, show a banner at the bottom of the window stating if it succeeded or failed, and reload the list of tracks so that it is fully updated (ideally it would just remove that specific track from the list currently displayed, but I wasn't able to figure out how to do that :).
I like nearly everything about how I set this up, besides how I decided to implement storing the data about the current playlist. I added another parameter to
Trackcalledcurrent_playlist, which stores thePlaylistLinkof the currently displayed playlist (if it is being displayed in a playlist, otherwiseNone). This is not ideal for two reasons:PlaylistLinkis stored once for every track in the playlist, which is just unnecessary data duplication since it is the same for every track.Ideally, I would've liked to store the data about the current playlist in
track::Display, but I couldn't find any way to pass that data in - it seems thattrack::Displayis constructed without knowledge of any external context. Since the only other way to pass in data to the track's context menu is through theTrackorLibrary, I thought that storing the data onTrackwould make the most sense. If it was stored onLibrary, there's a higher chance of it getting out-of-sync with what playlist is actually being displayed, andTrackis destroyed when the view moves away, so we don't have to worry as much about the data not being tracked correctly.If someone has better ideas about how to pass the data through, I welcome all suggestions :)
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.